/** * * @param NewsletterEntity $newsletter * @return NewsletterEntity */ public function createNewsletter(NewsletterEntity $newsletter) { $request = Request::post("{$this->getCompanyId()}/newsletters"); $request->setContentAsEntity($newsletter); $response = $this->getConnector()->sendRequest($request); $newsletter->setId($response->getCreatedId()); return $newsletter; }
/** * * @param EmailAddressesEntity $emails */ public function unsubscribe(EmailAddressesEntity $emails) { $request = Request::post("{$this->getCompanyId()}/unsubscribers/"); $data = $emails->toArray(); $json = Json::encode($data['emails']); $request->setContent($json); $this->getConnector()->sendRequest($request); }
/** * * @param int $notificationId * @param string $email * @return NotificationsDataEntity */ public function getNotificationsData($notificationId, $email) { $request = Request::post("{$this->getCompanyId()}/notifications/{$notificationId}/history/{$email}"); $response = $this->getConnector()->sendRequest($request); $data = Json::decode($response->getContent()); $json = new stdClass(); $json->notifications = $data; return new NotificationsDataEntity($response->getContent()); }
/** * * @param SmsNotificationEntity $smsNotification */ public function createSmsNotification(SmsNotificationEntity $smsNotification) { $request = Request::post("{$this->getCompanyId()}/sms-notifications/"); $request->setContentAsEntity($smsNotification); $this->getConnector()->sendRequest($request); }
/** * @param RecipientsListEntity $recipientsList * @return RecipientsListEntity */ public function createRecipientsList(RecipientsListEntity $recipientsList) { $request = Request::post("{$this->getCompanyId()}/recipients-lists"); $request->setContentAsEntity($recipientsList); $response = $this->getConnector()->sendRequest($request); $recipientsList->setId($response->getCreatedId()); return $recipientsList; }