@@ 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 | /** |
|
@@ 445-463 (lines=19) @@ | ||
442 | * |
|
443 | * @return Comment[] |
|
444 | */ |
|
445 | public function getLeadComments($lead) |
|
446 | { |
|
447 | if ($lead instanceof Lead) { |
|
448 | $lead = $lead->getId(); |
|
449 | } else { |
|
450 | $lead = intval($lead); |
|
451 | } |
|
452 | ||
453 | $url = '/lead/'.$lead.'/comments'; |
|
454 | ||
455 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
456 | ||
457 | $result = []; |
|
458 | foreach ($response as $commentData) { |
|
459 | $result[] = new Comment($commentData); |
|
460 | } |
|
461 | ||
462 | return $result; |
|
463 | } |
|
464 | ||
465 | ||
466 | /** |
|
@@ 472-491 (lines=20) @@ | ||
469 | * |
|
470 | * @return Comment |
|
471 | */ |
|
472 | public function addCommentToLead($lead, $text) |
|
473 | { |
|
474 | if ($lead instanceof Lead) { |
|
475 | $lead = $lead->getId(); |
|
476 | } else { |
|
477 | $lead = intval($lead); |
|
478 | } |
|
479 | ||
480 | $url = '/lead/'.$lead.'/comment'; |
|
481 | ||
482 | $data = [ |
|
483 | 'text' => $text |
|
484 | ]; |
|
485 | ||
486 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
487 | ||
488 | $comment = new Comment($response); |
|
489 | ||
490 | return $comment; |
|
491 | } |
|
492 | ||
493 | ||
494 | /** |