| @@ 101-119 (lines=19) @@ | ||
| 98 | * |
|
| 99 | * @return Custom[] |
|
| 100 | */ |
|
| 101 | public function getProjectCustoms($project) |
|
| 102 | { |
|
| 103 | if ($project instanceof Project) { |
|
| 104 | $project = $project->getId(); |
|
| 105 | } else { |
|
| 106 | $project = intval($project); |
|
| 107 | } |
|
| 108 | ||
| 109 | $url = '/project/'.$project.'/customs'; |
|
| 110 | ||
| 111 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 112 | ||
| 113 | $result = []; |
|
| 114 | foreach ($response as $customData) { |
|
| 115 | $result[] = new Custom($customData); |
|
| 116 | } |
|
| 117 | ||
| 118 | return $result; |
|
| 119 | } |
|
| 120 | ||
| 121 | ||
| 122 | /** |
|
| @@ 127-145 (lines=19) @@ | ||
| 124 | * |
|
| 125 | * @return ContactField[] |
|
| 126 | */ |
|
| 127 | public function getProjectFields($project) |
|
| 128 | { |
|
| 129 | if ($project instanceof Project) { |
|
| 130 | $project = $project->getId(); |
|
| 131 | } else { |
|
| 132 | $project = intval($project); |
|
| 133 | } |
|
| 134 | ||
| 135 | $url = '/project/'.$project.'/fields'; |
|
| 136 | ||
| 137 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 138 | ||
| 139 | $result = []; |
|
| 140 | foreach ($response as $customData) { |
|
| 141 | $result[] = new ContactField($customData); |
|
| 142 | } |
|
| 143 | ||
| 144 | return $result; |
|
| 145 | } |
|
| 146 | ||
| 147 | ||
| 148 | /** |
|
| @@ 565-583 (lines=19) @@ | ||
| 562 | * |
|
| 563 | * @return Comment[] |
|
| 564 | */ |
|
| 565 | public function getLeadComments($lead) |
|
| 566 | { |
|
| 567 | if ($lead instanceof Lead) { |
|
| 568 | $lead = $lead->getId(); |
|
| 569 | } else { |
|
| 570 | $lead = intval($lead); |
|
| 571 | } |
|
| 572 | ||
| 573 | $url = '/lead/'.$lead.'/comments'; |
|
| 574 | ||
| 575 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 576 | ||
| 577 | $result = []; |
|
| 578 | foreach ($response as $commentData) { |
|
| 579 | $result[] = new Comment($commentData); |
|
| 580 | } |
|
| 581 | ||
| 582 | return $result; |
|
| 583 | } |
|
| 584 | ||
| 585 | ||
| 586 | /** |
|
| @@ 592-611 (lines=20) @@ | ||
| 589 | * |
|
| 590 | * @return Comment |
|
| 591 | */ |
|
| 592 | public function addCommentToLead($lead, $text) |
|
| 593 | { |
|
| 594 | if ($lead instanceof Lead) { |
|
| 595 | $lead = $lead->getId(); |
|
| 596 | } else { |
|
| 597 | $lead = intval($lead); |
|
| 598 | } |
|
| 599 | ||
| 600 | $url = '/lead/'.$lead.'/comment'; |
|
| 601 | ||
| 602 | $data = [ |
|
| 603 | 'text' => $text |
|
| 604 | ]; |
|
| 605 | ||
| 606 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 607 | ||
| 608 | $comment = new Comment($response); |
|
| 609 | ||
| 610 | return $comment; |
|
| 611 | } |
|
| 612 | ||
| 613 | ||
| 614 | /** |
|