| @@ 776-790 (lines=15) @@ | ||
| 773 | * @return Lead |
|
| 774 | * @throws LPTrackerSDKException |
|
| 775 | */ |
|
| 776 | public function editLeadStage($lead, $newStageId, array $options = []) |
|
| 777 | { |
|
| 778 | if ($lead instanceof Lead) { |
|
| 779 | $lead = $lead->getId(); |
|
| 780 | } else { |
|
| 781 | $lead = (int) $lead; |
|
| 782 | } |
|
| 783 | $url = '/lead/' . $lead . '/funnel'; |
|
| 784 | $data = [ |
|
| 785 | 'funnel' => $newStageId, |
|
| 786 | 'options' => $options, |
|
| 787 | ]; |
|
| 788 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 789 | return new Lead($response); |
|
| 790 | } |
|
| 791 | ||
| 792 | /** |
|
| 793 | * @param Lead|int $lead |
|
| @@ 811-825 (lines=15) @@ | ||
| 808 | * @return Lead |
|
| 809 | * @throws LPTrackerSDKException |
|
| 810 | */ |
|
| 811 | public function editLeadOwner($lead, $newOwnerId, array $options = []) |
|
| 812 | { |
|
| 813 | if ($lead instanceof Lead) { |
|
| 814 | $lead = $lead->getId(); |
|
| 815 | } else { |
|
| 816 | $lead = (int) $lead; |
|
| 817 | } |
|
| 818 | $url = '/lead/' . $lead . '/owner'; |
|
| 819 | $data = [ |
|
| 820 | 'owner' => $newOwnerId, |
|
| 821 | 'options' => $options, |
|
| 822 | ]; |
|
| 823 | $response = LPTrackerRequest::sendRequest($url, $data, 'PUT', $this->token, $this->address); |
|
| 824 | return new Lead($response); |
|
| 825 | } |
|
| 826 | ||
| 827 | /** |
|
| 828 | * @param Lead|int $lead |
|
| @@ 857-871 (lines=15) @@ | ||
| 854 | * @throws exceptions\LPTrackerResponseException |
|
| 855 | * @throws exceptions\LPTrackerServerException |
|
| 856 | */ |
|
| 857 | public function addCommentToLead($lead, $text, array $options = []) |
|
| 858 | { |
|
| 859 | if ($lead instanceof Lead) { |
|
| 860 | $lead = $lead->getId(); |
|
| 861 | } else { |
|
| 862 | $lead = (int) $lead; |
|
| 863 | } |
|
| 864 | $url = '/lead/' . $lead . '/comment'; |
|
| 865 | $data = [ |
|
| 866 | 'text' => $text, |
|
| 867 | 'options' => $options, |
|
| 868 | ]; |
|
| 869 | $response = LPTrackerRequest::sendRequest($url, $data, 'POST', $this->token, $this->address); |
|
| 870 | return new Comment($response); |
|
| 871 | } |
|
| 872 | ||
| 873 | /** |
|
| 874 | * @param Lead|int $lead |
|