| @@ 102-120 (lines=19) @@ | ||
| 99 | * |
|
| 100 | * @return Custom[] |
|
| 101 | */ |
|
| 102 | public function getProjectCustoms($project) |
|
| 103 | { |
|
| 104 | if ($project instanceof Project) { |
|
| 105 | $project = $project->getId(); |
|
| 106 | } else { |
|
| 107 | $project = intval($project); |
|
| 108 | } |
|
| 109 | ||
| 110 | $url = '/project/'.$project.'/customs'; |
|
| 111 | ||
| 112 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 113 | ||
| 114 | $result = []; |
|
| 115 | foreach ($response as $customData) { |
|
| 116 | $result[] = new Custom($customData); |
|
| 117 | } |
|
| 118 | ||
| 119 | return $result; |
|
| 120 | } |
|
| 121 | ||
| 122 | ||
| 123 | /** |
|
| @@ 128-146 (lines=19) @@ | ||
| 125 | * |
|
| 126 | * @return ContactField[] |
|
| 127 | */ |
|
| 128 | public function getProjectFields($project) |
|
| 129 | { |
|
| 130 | if ($project instanceof Project) { |
|
| 131 | $project = $project->getId(); |
|
| 132 | } else { |
|
| 133 | $project = intval($project); |
|
| 134 | } |
|
| 135 | ||
| 136 | $url = '/project/'.$project.'/fields'; |
|
| 137 | ||
| 138 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 139 | ||
| 140 | $result = []; |
|
| 141 | foreach ($response as $customData) { |
|
| 142 | $result[] = new ContactField($customData); |
|
| 143 | } |
|
| 144 | ||
| 145 | return $result; |
|
| 146 | } |
|
| 147 | ||
| 148 | ||
| 149 | /** |
|
| @@ 670-688 (lines=19) @@ | ||
| 667 | * |
|
| 668 | * @return Comment[] |
|
| 669 | */ |
|
| 670 | public function getLeadComments($lead) |
|
| 671 | { |
|
| 672 | if ($lead instanceof Lead) { |
|
| 673 | $lead = $lead->getId(); |
|
| 674 | } else { |
|
| 675 | $lead = intval($lead); |
|
| 676 | } |
|
| 677 | ||
| 678 | $url = '/lead/'.$lead.'/comments'; |
|
| 679 | ||
| 680 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 681 | ||
| 682 | $result = []; |
|
| 683 | foreach ($response as $commentData) { |
|
| 684 | $result[] = new Comment($commentData); |
|
| 685 | } |
|
| 686 | ||
| 687 | return $result; |
|
| 688 | } |
|
| 689 | ||
| 690 | ||
| 691 | /** |
|
| @@ 697-716 (lines=20) @@ | ||
| 694 | * |
|
| 695 | * @return Comment |
|
| 696 | */ |
|
| 697 | public function addCommentToLead($lead, $text) |
|
| 698 | { |
|
| 699 | if ($lead instanceof Lead) { |
|
| 700 | $lead = $lead->getId(); |
|
| 701 | } else { |
|
| 702 | $lead = intval($lead); |
|
| 703 | } |
|
| 704 | ||
| 705 | $url = '/lead/'.$lead.'/comment'; |
|
| 706 | ||
| 707 | $data = [ |
|
| 708 | 'text' => $text |
|
| 709 | ]; |
|
| 710 | ||
| 711 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 712 | ||
| 713 | $comment = new Comment($response); |
|
| 714 | ||
| 715 | return $comment; |
|
| 716 | } |
|
| 717 | ||
| 718 | ||
| 719 | /** |
|