/** * @param Mailxpert $mailxpert * @param string $id * * @return \Mailxpert\MailxpertResponse * @throws MailxpertSDKResponseException */ public static function delete(Mailxpert $mailxpert, $id) { $response = $mailxpert->sendRequest('DELETE', sprintf('custom_fields/%s', $id)); if (!$response->isHttpResponseCodeOK()) { throw new MailxpertSDKResponseException($response, 'An error occured during the CustomField deletion.'); } return $response; }
/** * @param Mailxpert $mailxpert * @param string $name * * @return \Mailxpert\MailxpertResponse * @throws MailxpertSDKException */ public static function post(Mailxpert $mailxpert, $name) { $response = $mailxpert->sendRequest('POST', 'contact_lists', [], null, json_encode(['name' => $name])); if (!$response->getHeader('Location')) { throw new MailxpertSDKException('An error occured during the Contact list creation.'); } return $response; }
/** * @param Mailxpert $mailxpert * @param string $customFieldId * @param array $params * * @return \Mailxpert\MailxpertResponse * @throws MailxpertSDKException */ public static function post(Mailxpert $mailxpert, $customFieldId, array $params) { $response = $mailxpert->sendRequest('POST', sprintf('custom_fields/%s/choices', $customFieldId), [], null, json_encode($params)); if (!$response->getHeader('Location')) { throw new MailxpertSDKException('An error occured during the Contactfield Choice creation.'); } return $response; }