| @@ 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 |
|
| @@ 605-619 (lines=15) @@ | ||
| 602 | * @return Lead |
|
| 603 | * @throws LPTrackerSDKException |
|
| 604 | */ |
|
| 605 | public function getLead($lead) |
|
| 606 | { |
|
| 607 | if ($lead instanceof Lead) { |
|
| 608 | $lead = $lead->getId(); |
|
| 609 | } else { |
|
| 610 | $lead = (int) $lead; |
|
| 611 | } |
|
| 612 | if ($lead <= 0) { |
|
| 613 | throw new LPTrackerSDKException('Invalid lead ID'); |
|
| 614 | } |
|
| 615 | ||
| 616 | $url = '/lead/' . $lead; |
|
| 617 | $response = LPTrackerRequest::sendRequest($url, [], 'GET', $this->token, $this->address); |
|
| 618 | return new Lead($response); |
|
| 619 | } |
|
| 620 | ||
| 621 | /** |
|
| 622 | * @param Lead|int $lead |
|
| @@ 969-979 (lines=11) @@ | ||
| 966 | * @throws exceptions\LPTrackerResponseException |
|
| 967 | * @throws exceptions\LPTrackerServerException |
|
| 968 | */ |
|
| 969 | public function createCustom($project, $options) |
|
| 970 | { |
|
| 971 | if ($project instanceof Project) { |
|
| 972 | $project = $project->getId(); |
|
| 973 | } else { |
|
| 974 | $project = (int) $project; |
|
| 975 | } |
|
| 976 | $actionUrl = '/custom/' . $project . '/create'; |
|
| 977 | $response = LPTrackerRequest::sendRequest($actionUrl, $options, 'POST', $this->token, $this->address); |
|
| 978 | return new CustomField($response); |
|
| 979 | } |
|
| 980 | ||
| 981 | /** |
|
| 982 | * @param Project|int $project |
|