@@ 253-267 (lines=15) @@ | ||
250 | * @return Contact |
|
251 | * @throws LPTrackerSDKException |
|
252 | */ |
|
253 | public function getContact($contact) |
|
254 | { |
|
255 | if ($contact instanceof Contact) { |
|
256 | $contact = $contact->getId(); |
|
257 | } else { |
|
258 | $contact = (int) $contact; |
|
259 | } |
|
260 | if ($contact <= 0) { |
|
261 | throw new LPTrackerSDKException('Invalid contact ID'); |
|
262 | } |
|
263 | ||
264 | $url = '/contact/' . $contact; |
|
265 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
266 | return new Contact($response); |
|
267 | } |
|
268 | ||
269 | /** |
|
270 | * @param Contact $contact |
|
@@ 511-525 (lines=15) @@ | ||
508 | * @return View |
|
509 | * @throws LPTrackerSDKException |
|
510 | */ |
|
511 | public function getView($view) |
|
512 | { |
|
513 | if ($view instanceof View) { |
|
514 | $view = $view->getId(); |
|
515 | } else { |
|
516 | $view = (int) $view; |
|
517 | } |
|
518 | if ($view <= 0) { |
|
519 | throw new LPTrackerSDKException('Invalid view ID'); |
|
520 | } |
|
521 | ||
522 | $url = '/view/' . $view; |
|
523 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
524 | return new View($response); |
|
525 | } |
|
526 | ||
527 | /** |
|
528 | * @param View $view |
|
@@ 599-613 (lines=15) @@ | ||
596 | * @return Lead |
|
597 | * @throws LPTrackerSDKException |
|
598 | */ |
|
599 | public function getLead($lead) |
|
600 | { |
|
601 | if ($lead instanceof Lead) { |
|
602 | $lead = $lead->getId(); |
|
603 | } else { |
|
604 | $lead = (int) $lead; |
|
605 | } |
|
606 | if ($lead <= 0) { |
|
607 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
608 | } |
|
609 | ||
610 | $url = '/lead/' . $lead; |
|
611 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
612 | return new Lead($response); |
|
613 | } |
|
614 | ||
615 | /** |
|
616 | * @param Lead|int $lead |
|
@@ 963-973 (lines=11) @@ | ||
960 | * @throws exceptions\LPTrackerResponseException |
|
961 | * @throws exceptions\LPTrackerServerException |
|
962 | */ |
|
963 | public function createCustom($project, $options) |
|
964 | { |
|
965 | if ($project instanceof Project) { |
|
966 | $project = $project->getId(); |
|
967 | } else { |
|
968 | $project = (int) $project; |
|
969 | } |
|
970 | $actionUrl = '/custom/' . $project . '/create'; |
|
971 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
|
972 | return new CustomField($response); |
|
973 | } |
|
974 | ||
975 | /** |
|
976 | * @param Project|int $project |