| @@ 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 | /** |
|
| @@ 690-707 (lines=18) @@ | ||
| 687 | * @return Lead |
|
| 688 | * @throws LPTrackerSDKException |
|
| 689 | */ |
|
| 690 | public function changeLeadFunnel($lead, $newFunnelId) |
|
| 691 | { |
|
| 692 | if ($lead instanceof Lead) { |
|
| 693 | $lead = $lead->getId(); |
|
| 694 | } |
|
| 695 | ||
| 696 | $url = '/lead/'.$lead.'/funnel'; |
|
| 697 | ||
| 698 | $data = [ |
|
| 699 | 'funnel' => $newFunnelId |
|
| 700 | ]; |
|
| 701 | ||
| 702 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 703 | ||
| 704 | $resultLead = new Lead($response); |
|
| 705 | ||
| 706 | return $resultLead; |
|
| 707 | } |
|
| 708 | ||
| 709 | ||
| 710 | /** |
|
| @@ 717-735 (lines=19) @@ | ||
| 714 | * @throws exceptions\LPTrackerResponseException |
|
| 715 | * @throws exceptions\LPTrackerServerException |
|
| 716 | */ |
|
| 717 | public function getLeadComments($lead) |
|
| 718 | { |
|
| 719 | if ($lead instanceof Lead) { |
|
| 720 | $lead = $lead->getId(); |
|
| 721 | } else { |
|
| 722 | $lead = intval($lead); |
|
| 723 | } |
|
| 724 | ||
| 725 | $url = '/lead/'.$lead.'/comments'; |
|
| 726 | ||
| 727 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 728 | ||
| 729 | $result = []; |
|
| 730 | foreach ($response as $commentData) { |
|
| 731 | $result[] = new Comment($commentData); |
|
| 732 | } |
|
| 733 | ||
| 734 | return $result; |
|
| 735 | } |
|
| 736 | ||
| 737 | ||
| 738 | /** |
|
| @@ 746-765 (lines=20) @@ | ||
| 743 | * @throws exceptions\LPTrackerResponseException |
|
| 744 | * @throws exceptions\LPTrackerServerException |
|
| 745 | */ |
|
| 746 | public function addCommentToLead($lead, $text) |
|
| 747 | { |
|
| 748 | if ($lead instanceof Lead) { |
|
| 749 | $lead = $lead->getId(); |
|
| 750 | } else { |
|
| 751 | $lead = intval($lead); |
|
| 752 | } |
|
| 753 | ||
| 754 | $url = '/lead/'.$lead.'/comment'; |
|
| 755 | ||
| 756 | $data = [ |
|
| 757 | 'text' => $text |
|
| 758 | ]; |
|
| 759 | ||
| 760 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 761 | ||
| 762 | $comment = new Comment($response); |
|
| 763 | ||
| 764 | return $comment; |
|
| 765 | } |
|
| 766 | ||
| 767 | ||
| 768 | /** |
|