| @@ 717-731 (lines=15) @@ | ||
| 714 | * @return Lead |
|
| 715 | * @throws LPTrackerSDKException |
|
| 716 | */ |
|
| 717 | public function editLeadStage($lead, $newStageId, array $options = []) |
|
| 718 | { |
|
| 719 | if ($lead instanceof Lead) { |
|
| 720 | $lead = $lead->getId(); |
|
| 721 | } else { |
|
| 722 | $lead = (int) $lead; |
|
| 723 | } |
|
| 724 | $url = '/lead/' . $lead . '/funnel'; |
|
| 725 | $data = [ |
|
| 726 | 'funnel' => $newStageId, |
|
| 727 | 'options' => $options, |
|
| 728 | ]; |
|
| 729 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 730 | return new Lead($response); |
|
| 731 | } |
|
| 732 | ||
| 733 | /** |
|
| 734 | * @param Lead|int $lead |
|
| @@ 752-766 (lines=15) @@ | ||
| 749 | * @return Lead |
|
| 750 | * @throws LPTrackerSDKException |
|
| 751 | */ |
|
| 752 | public function editLeadOwner($lead, $newOwnerId, array $options = []) |
|
| 753 | { |
|
| 754 | if ($lead instanceof Lead) { |
|
| 755 | $lead = $lead->getId(); |
|
| 756 | } else { |
|
| 757 | $lead = (int) $lead; |
|
| 758 | } |
|
| 759 | $url = '/lead/' . $lead . '/owner'; |
|
| 760 | $data = [ |
|
| 761 | 'owner' => $newOwnerId, |
|
| 762 | 'options' => $options, |
|
| 763 | ]; |
|
| 764 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 765 | return new Lead($response); |
|
| 766 | } |
|
| 767 | ||
| 768 | /** |
|
| 769 | * @param Lead|int $lead |
|
| @@ 798-812 (lines=15) @@ | ||
| 795 | * @throws exceptions\LPTrackerResponseException |
|
| 796 | * @throws exceptions\LPTrackerServerException |
|
| 797 | */ |
|
| 798 | public function addCommentToLead($lead, $text, array $options = []) |
|
| 799 | { |
|
| 800 | if ($lead instanceof Lead) { |
|
| 801 | $lead = $lead->getId(); |
|
| 802 | } else { |
|
| 803 | $lead = (int) $lead; |
|
| 804 | } |
|
| 805 | $url = '/lead/' . $lead . '/comment'; |
|
| 806 | $data = [ |
|
| 807 | 'text' => $text, |
|
| 808 | 'options' => $options, |
|
| 809 | ]; |
|
| 810 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 811 | return new Comment($response); |
|
| 812 | } |
|
| 813 | ||
| 814 | /** |
|
| 815 | * @param Lead|int $lead |
|