| @@ 760-774 (lines=15) @@ | ||
| 757 | * @return Lead |
|
| 758 | * @throws LPTrackerSDKException |
|
| 759 | */ |
|
| 760 | public function editLeadStage($lead, $newStageId, array $options = []) |
|
| 761 | { |
|
| 762 | if ($lead instanceof Lead) { |
|
| 763 | $lead = $lead->getId(); |
|
| 764 | } else { |
|
| 765 | $lead = (int) $lead; |
|
| 766 | } |
|
| 767 | $url = '/lead/' . $lead . '/funnel'; |
|
| 768 | $data = [ |
|
| 769 | 'funnel' => $newStageId, |
|
| 770 | 'options' => $options, |
|
| 771 | ]; |
|
| 772 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 773 | return new Lead($response); |
|
| 774 | } |
|
| 775 | ||
| 776 | /** |
|
| 777 | * @param Lead|int $lead |
|
| @@ 795-809 (lines=15) @@ | ||
| 792 | * @return Lead |
|
| 793 | * @throws LPTrackerSDKException |
|
| 794 | */ |
|
| 795 | public function editLeadOwner($lead, $newOwnerId, array $options = []) |
|
| 796 | { |
|
| 797 | if ($lead instanceof Lead) { |
|
| 798 | $lead = $lead->getId(); |
|
| 799 | } else { |
|
| 800 | $lead = (int) $lead; |
|
| 801 | } |
|
| 802 | $url = '/lead/' . $lead . '/owner'; |
|
| 803 | $data = [ |
|
| 804 | 'owner' => $newOwnerId, |
|
| 805 | 'options' => $options, |
|
| 806 | ]; |
|
| 807 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 808 | return new Lead($response); |
|
| 809 | } |
|
| 810 | ||
| 811 | /** |
|
| 812 | * @param Lead|int $lead |
|
| @@ 841-855 (lines=15) @@ | ||
| 838 | * @throws exceptions\LPTrackerResponseException |
|
| 839 | * @throws exceptions\LPTrackerServerException |
|
| 840 | */ |
|
| 841 | public function addCommentToLead($lead, $text, array $options = []) |
|
| 842 | { |
|
| 843 | if ($lead instanceof Lead) { |
|
| 844 | $lead = $lead->getId(); |
|
| 845 | } else { |
|
| 846 | $lead = (int) $lead; |
|
| 847 | } |
|
| 848 | $url = '/lead/' . $lead . '/comment'; |
|
| 849 | $data = [ |
|
| 850 | 'text' => $text, |
|
| 851 | 'options' => $options, |
|
| 852 | ]; |
|
| 853 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 854 | return new Comment($response); |
|
| 855 | } |
|
| 856 | ||
| 857 | /** |
|
| 858 | * @param Lead|int $lead |
|