@@ 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 | /** |
|
@@ 516-534 (lines=19) @@ | ||
513 | * |
|
514 | * @return Comment[] |
|
515 | */ |
|
516 | public function getLeadComments($lead) |
|
517 | { |
|
518 | if ($lead instanceof Lead) { |
|
519 | $lead = $lead->getId(); |
|
520 | } else { |
|
521 | $lead = intval($lead); |
|
522 | } |
|
523 | ||
524 | $url = '/lead/'.$lead.'/comments'; |
|
525 | ||
526 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
527 | ||
528 | $result = []; |
|
529 | foreach ($response as $commentData) { |
|
530 | $result[] = new Comment($commentData); |
|
531 | } |
|
532 | ||
533 | return $result; |
|
534 | } |
|
535 | ||
536 | ||
537 | /** |
|
@@ 543-562 (lines=20) @@ | ||
540 | * |
|
541 | * @return Comment |
|
542 | */ |
|
543 | public function addCommentToLead($lead, $text) |
|
544 | { |
|
545 | if ($lead instanceof Lead) { |
|
546 | $lead = $lead->getId(); |
|
547 | } else { |
|
548 | $lead = intval($lead); |
|
549 | } |
|
550 | ||
551 | $url = '/lead/'.$lead.'/comment'; |
|
552 | ||
553 | $data = [ |
|
554 | 'text' => $text |
|
555 | ]; |
|
556 | ||
557 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
558 | ||
559 | $comment = new Comment($response); |
|
560 | ||
561 | return $comment; |
|
562 | } |
|
563 | ||
564 | ||
565 | /** |