@@ 109-127 (lines=19) @@ | ||
106 | * @throws exceptions\LPTrackerResponseException |
|
107 | * @throws exceptions\LPTrackerServerException |
|
108 | */ |
|
109 | public function getProjectCustoms($project) |
|
110 | { |
|
111 | if ($project instanceof Project) { |
|
112 | $project = $project->getId(); |
|
113 | } else { |
|
114 | $project = intval($project); |
|
115 | } |
|
116 | ||
117 | $url = '/project/'.$project.'/customs'; |
|
118 | ||
119 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
120 | ||
121 | $result = []; |
|
122 | foreach ($response as $customData) { |
|
123 | $result[] = new Custom($customData); |
|
124 | } |
|
125 | ||
126 | return $result; |
|
127 | } |
|
128 | ||
129 | ||
130 | /** |
|
@@ 137-155 (lines=19) @@ | ||
134 | * @throws exceptions\LPTrackerResponseException |
|
135 | * @throws exceptions\LPTrackerServerException |
|
136 | */ |
|
137 | public function getProjectFields($project) |
|
138 | { |
|
139 | if ($project instanceof Project) { |
|
140 | $project = $project->getId(); |
|
141 | } else { |
|
142 | $project = intval($project); |
|
143 | } |
|
144 | ||
145 | $url = '/project/'.$project.'/fields'; |
|
146 | ||
147 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
148 | ||
149 | $result = []; |
|
150 | foreach ($response as $customData) { |
|
151 | $result[] = new ContactField($customData); |
|
152 | } |
|
153 | ||
154 | return $result; |
|
155 | } |
|
156 | ||
157 | ||
158 | /** |
|
@@ 694-711 (lines=18) @@ | ||
691 | * @return Lead |
|
692 | * @throws LPTrackerSDKException |
|
693 | */ |
|
694 | public function changeLeadFunnel($lead, $newFunnelId) |
|
695 | { |
|
696 | if ($lead instanceof Lead) { |
|
697 | $lead = $lead->getId(); |
|
698 | } |
|
699 | ||
700 | $url = '/lead/'.$lead.'/funnel'; |
|
701 | ||
702 | $data = [ |
|
703 | 'funnel' => $newFunnelId |
|
704 | ]; |
|
705 | ||
706 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
707 | ||
708 | $resultLead = new Lead($response); |
|
709 | ||
710 | return $resultLead; |
|
711 | } |
|
712 | ||
713 | ||
714 | /** |
|
@@ 721-739 (lines=19) @@ | ||
718 | * @throws exceptions\LPTrackerResponseException |
|
719 | * @throws exceptions\LPTrackerServerException |
|
720 | */ |
|
721 | public function getLeadComments($lead) |
|
722 | { |
|
723 | if ($lead instanceof Lead) { |
|
724 | $lead = $lead->getId(); |
|
725 | } else { |
|
726 | $lead = intval($lead); |
|
727 | } |
|
728 | ||
729 | $url = '/lead/'.$lead.'/comments'; |
|
730 | ||
731 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
732 | ||
733 | $result = []; |
|
734 | foreach ($response as $commentData) { |
|
735 | $result[] = new Comment($commentData); |
|
736 | } |
|
737 | ||
738 | return $result; |
|
739 | } |
|
740 | ||
741 | ||
742 | /** |
|
@@ 750-769 (lines=20) @@ | ||
747 | * @throws exceptions\LPTrackerResponseException |
|
748 | * @throws exceptions\LPTrackerServerException |
|
749 | */ |
|
750 | public function addCommentToLead($lead, $text) |
|
751 | { |
|
752 | if ($lead instanceof Lead) { |
|
753 | $lead = $lead->getId(); |
|
754 | } else { |
|
755 | $lead = intval($lead); |
|
756 | } |
|
757 | ||
758 | $url = '/lead/'.$lead.'/comment'; |
|
759 | ||
760 | $data = [ |
|
761 | 'text' => $text |
|
762 | ]; |
|
763 | ||
764 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
765 | ||
766 | $comment = new Comment($response); |
|
767 | ||
768 | return $comment; |
|
769 | } |
|
770 | ||
771 | ||
772 | /** |