| @@ 770-784 (lines=15) @@ | ||
| 767 | * @return Lead |
|
| 768 | * @throws LPTrackerSDKException |
|
| 769 | */ |
|
| 770 | public function editLeadStage($lead, $newStageId, array $options = []) |
|
| 771 | { |
|
| 772 | if ($lead instanceof Lead) { |
|
| 773 | $lead = $lead->getId(); |
|
| 774 | } else { |
|
| 775 | $lead = (int) $lead; |
|
| 776 | } |
|
| 777 | $url = '/lead/' . $lead . '/funnel'; |
|
| 778 | $data = [ |
|
| 779 | 'funnel' => $newStageId, |
|
| 780 | 'options' => $options, |
|
| 781 | ]; |
|
| 782 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 783 | return new Lead($response); |
|
| 784 | } |
|
| 785 | ||
| 786 | /** |
|
| 787 | * @param Lead|int $lead |
|
| @@ 805-819 (lines=15) @@ | ||
| 802 | * @return Lead |
|
| 803 | * @throws LPTrackerSDKException |
|
| 804 | */ |
|
| 805 | public function editLeadOwner($lead, $newOwnerId, array $options = []) |
|
| 806 | { |
|
| 807 | if ($lead instanceof Lead) { |
|
| 808 | $lead = $lead->getId(); |
|
| 809 | } else { |
|
| 810 | $lead = (int) $lead; |
|
| 811 | } |
|
| 812 | $url = '/lead/' . $lead . '/owner'; |
|
| 813 | $data = [ |
|
| 814 | 'owner' => $newOwnerId, |
|
| 815 | 'options' => $options, |
|
| 816 | ]; |
|
| 817 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 818 | return new Lead($response); |
|
| 819 | } |
|
| 820 | ||
| 821 | /** |
|
| 822 | * @param Lead|int $lead |
|
| @@ 851-865 (lines=15) @@ | ||
| 848 | * @throws exceptions\LPTrackerResponseException |
|
| 849 | * @throws exceptions\LPTrackerServerException |
|
| 850 | */ |
|
| 851 | public function addCommentToLead($lead, $text, array $options = []) |
|
| 852 | { |
|
| 853 | if ($lead instanceof Lead) { |
|
| 854 | $lead = $lead->getId(); |
|
| 855 | } else { |
|
| 856 | $lead = (int) $lead; |
|
| 857 | } |
|
| 858 | $url = '/lead/' . $lead . '/comment'; |
|
| 859 | $data = [ |
|
| 860 | 'text' => $text, |
|
| 861 | 'options' => $options, |
|
| 862 | ]; |
|
| 863 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 864 | return new Comment($response); |
|
| 865 | } |
|
| 866 | ||
| 867 | /** |
|
| 868 | * @param Lead|int $lead |
|