Esempio n. 1
0
 /**
  * Searching contacts by criteria
  * @param Search $search
  * @param bool $extended
  * @return bool|Response
  * @throws \Exception
  */
 public function search(Search $search, $extended = false)
 {
     if ($extended) {
         $extended = '/extended';
     }
     return $this->service->setRequestPath('contact/search' . $extended)->setRequestType(Service::REQUEST_METHOD_POST)->setPostData(['contact' => $search->getCriteria()])->request();
 }
 /**
  * @param integer $idSegmentation
  * @param Segmentation $segmentation
  * @return bool|Response
  * @throws \Exception
  */
 public function addContact($idSegmentation, Segmentation $segmentation)
 {
     if (!is_numeric($idSegmentation)) {
         throw new \Exception('Wrong segmentation id.');
     }
     return $this->service->setRequestPath('segmentation/' . $idSegmentation . '/contact')->setRequestType(Service::REQUEST_METHOD_POST)->setPostData($segmentation->getSegmentationContact())->request();
 }
Esempio n. 3
0
 /**
  * Send intentable direct marketing campaign
  * @param integer $idCampaign
  * @param Campaign $campaign
  * @param bool $key
  * @return bool|Response
  * @throws \Exception
  */
 public function send($idCampaign, Campaign $campaign, $key = false)
 {
     if ($key) {
         $key = '?key=1';
     }
     return $this->service->setRequestPath('campaign/' . $idCampaign . '/send' . $key)->setRequestType(Service::REQUEST_METHOD_POST)->setPostData($campaign->getCampaign())->request();
 }
Esempio n. 4
0
 /**
  * Assignee contact type to a contact
  * @param string $typeKey
  * @param array $contactIds
  * @return bool|Response
  * @throws \Exception
  */
 public function addContact($typeKey, $contactIds)
 {
     if (!is_array($contactIds) || empty($contactIds)) {
         throw new \Exception('Set idContacts array first.');
     }
     $data['contact'] = $contactIds;
     return $this->service->setRequestPath('type/' . $typeKey . '/contact')->setRequestType(Service::REQUEST_METHOD_POST)->setPostData($data)->request();
 }
Esempio n. 5
0
 /**
  * Get available actions
  * @return bool|Response
  */
 public function get()
 {
     return $this->service->setRequestPath('action')->setRequestType(Service::REQUEST_METHOD_GET)->request();
 }
Esempio n. 6
0
 /**
  * Connect contacts
  * @param integer $idContact
  * @param integer $idContactToConnect
  * @return bool|Response
  */
 public function setConnection($idContact, $idContactToConnect)
 {
     $data['connection'] = [$idContactToConnect];
     return $this->service->setRequestPath('contact/' . $idContact . '/connection')->setRequestType(Service::REQUEST_METHOD_POST)->setPostData($data)->request();
 }
Esempio n. 7
0
 /**
  * Delete contact’s agreement
  * @param integer $idAgreement
  * @param integer $idContact
  * @return bool|Response
  */
 public function deleteContact($idAgreement, $idContact)
 {
     return $this->service->setRequestPath('agreement/' . $idAgreement . '/contact/' . $idContact)->setRequestType(Service::REQUEST_METHOD_DELETE)->request();
 }
Esempio n. 8
0
 /**
  * @return iPresso
  */
 public function debug()
 {
     $this->service->debug();
     return $this;
 }
Esempio n. 9
0
 /**
  * Delete contact in category
  * @param integer $idCategory
  * @param integer $idContact
  * @return bool|Response
  */
 public function deleteContact($idCategory, $idContact)
 {
     return $this->service->setRequestPath('category/' . $idCategory . '/contact/' . $idContact)->setRequestType(Service::REQUEST_METHOD_DELETE)->request();
 }