| @@ 108-126 (lines=19) @@ | ||
| 105 | * @throws exceptions\LPTrackerResponseException |
|
| 106 | * @throws exceptions\LPTrackerServerException |
|
| 107 | */ |
|
| 108 | public function getProjectCustoms($project) |
|
| 109 | { |
|
| 110 | if ($project instanceof Project) { |
|
| 111 | $project = $project->getId(); |
|
| 112 | } else { |
|
| 113 | $project = intval($project); |
|
| 114 | } |
|
| 115 | ||
| 116 | $url = '/project/'.$project.'/customs'; |
|
| 117 | ||
| 118 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 119 | ||
| 120 | $result = []; |
|
| 121 | foreach ($response as $customData) { |
|
| 122 | $result[] = new Custom($customData); |
|
| 123 | } |
|
| 124 | ||
| 125 | return $result; |
|
| 126 | } |
|
| 127 | ||
| 128 | ||
| 129 | /** |
|
| @@ 136-154 (lines=19) @@ | ||
| 133 | * @throws exceptions\LPTrackerResponseException |
|
| 134 | * @throws exceptions\LPTrackerServerException |
|
| 135 | */ |
|
| 136 | public function getProjectFields($project) |
|
| 137 | { |
|
| 138 | if ($project instanceof Project) { |
|
| 139 | $project = $project->getId(); |
|
| 140 | } else { |
|
| 141 | $project = intval($project); |
|
| 142 | } |
|
| 143 | ||
| 144 | $url = '/project/'.$project.'/fields'; |
|
| 145 | ||
| 146 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 147 | ||
| 148 | $result = []; |
|
| 149 | foreach ($response as $customData) { |
|
| 150 | $result[] = new ContactField($customData); |
|
| 151 | } |
|
| 152 | ||
| 153 | return $result; |
|
| 154 | } |
|
| 155 | ||
| 156 | ||
| 157 | /** |
|
| @@ 703-721 (lines=19) @@ | ||
| 700 | * @throws exceptions\LPTrackerResponseException |
|
| 701 | * @throws exceptions\LPTrackerServerException |
|
| 702 | */ |
|
| 703 | public function getLeadComments($lead) |
|
| 704 | { |
|
| 705 | if ($lead instanceof Lead) { |
|
| 706 | $lead = $lead->getId(); |
|
| 707 | } else { |
|
| 708 | $lead = intval($lead); |
|
| 709 | } |
|
| 710 | ||
| 711 | $url = '/lead/'.$lead.'/comments'; |
|
| 712 | ||
| 713 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 714 | ||
| 715 | $result = []; |
|
| 716 | foreach ($response as $commentData) { |
|
| 717 | $result[] = new Comment($commentData); |
|
| 718 | } |
|
| 719 | ||
| 720 | return $result; |
|
| 721 | } |
|
| 722 | ||
| 723 | ||
| 724 | /** |
|
| @@ 732-751 (lines=20) @@ | ||
| 729 | * @throws exceptions\LPTrackerResponseException |
|
| 730 | * @throws exceptions\LPTrackerServerException |
|
| 731 | */ |
|
| 732 | public function addCommentToLead($lead, $text) |
|
| 733 | { |
|
| 734 | if ($lead instanceof Lead) { |
|
| 735 | $lead = $lead->getId(); |
|
| 736 | } else { |
|
| 737 | $lead = intval($lead); |
|
| 738 | } |
|
| 739 | ||
| 740 | $url = '/lead/'.$lead.'/comment'; |
|
| 741 | ||
| 742 | $data = [ |
|
| 743 | 'text' => $text |
|
| 744 | ]; |
|
| 745 | ||
| 746 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 747 | ||
| 748 | $comment = new Comment($response); |
|
| 749 | ||
| 750 | return $comment; |
|
| 751 | } |
|
| 752 | ||
| 753 | ||
| 754 | /** |
|