| @@ 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 | /** |
|
| @@ 374-392 (lines=19) @@ | ||
| 371 | * |
|
| 372 | * @return Comment[] |
|
| 373 | */ |
|
| 374 | public function getLeadComments($lead) |
|
| 375 | { |
|
| 376 | if ($lead instanceof Lead) { |
|
| 377 | $lead = $lead->getId(); |
|
| 378 | } else { |
|
| 379 | $lead = intval($lead); |
|
| 380 | } |
|
| 381 | ||
| 382 | $url = '/lead/'.$lead.'/comments'; |
|
| 383 | ||
| 384 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 385 | ||
| 386 | $result = []; |
|
| 387 | foreach ($response as $commentData) { |
|
| 388 | $result[] = new Comment($commentData); |
|
| 389 | } |
|
| 390 | ||
| 391 | return $result; |
|
| 392 | } |
|
| 393 | ||
| 394 | ||
| 395 | /** |
|
| @@ 401-420 (lines=20) @@ | ||
| 398 | * |
|
| 399 | * @return Comment |
|
| 400 | */ |
|
| 401 | public function addCommentToLead($lead, $text) |
|
| 402 | { |
|
| 403 | if ($lead instanceof Lead) { |
|
| 404 | $lead = $lead->getId(); |
|
| 405 | } else { |
|
| 406 | $lead = intval($lead); |
|
| 407 | } |
|
| 408 | ||
| 409 | $url = '/lead/'.$lead.'/comment'; |
|
| 410 | ||
| 411 | $data = [ |
|
| 412 | 'text' => $text |
|
| 413 | ]; |
|
| 414 | ||
| 415 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 416 | ||
| 417 | $comment = new Comment($response); |
|
| 418 | ||
| 419 | return $comment; |
|
| 420 | } |
|
| 421 | ||
| 422 | ||
| 423 | /** |
|