From 141280390e819933f8cfdd9eeef5428d078fd437 Mon Sep 17 00:00:00 2001 From: jmulford-bw Date: Mon, 8 Mar 2021 21:34:57 +0000 Subject: [PATCH 1/4] New deploy --- src/BandwidthClient.php | 14 +- src/Configuration.php | 36 +- src/Messaging/Controllers/APIController.php | 228 ++++++++----- ...p => MessagingExceptionErrorException.php} | 2 +- src/Messaging/Models/Media.php | 67 +--- src/Messaging/Models/MessagingException.php | 51 +++ .../Controllers/MFAController.php | 50 +-- .../ErrorWithRequestErrorException.php} | 4 +- .../ForbiddenRequestErrorException.php} | 4 +- .../UnauthorizedRequestErrorException.php} | 4 +- .../Models/ErrorWithRequest.php | 49 +++ .../Models/ForbiddenRequest.php | 42 +++ .../Models/TwoFactorCodeRequestSchema.php | 2 +- .../Models/TwoFactorMessagingResponse.php | 2 +- .../Models/TwoFactorVerifyCodeResponse.php | 2 +- .../Models/TwoFactorVerifyRequestSchema.php | 2 +- .../Models/TwoFactorVoiceResponse.php | 2 +- .../Models/UnauthorizedRequest.php | 41 +++ .../MultiFactorAuthClient.php} | 6 +- src/Servers.php | 2 +- src/Voice/Controllers/APIController.php | 317 +++++++++++------- ...php => ApiErrorResponseErrorException.php} | 2 +- src/Voice/Models/ApiCallStateResponse.php | 32 +- src/Voice/Models/ApiErrorResponse.php | 57 ++++ src/WebRtc/Controllers/APIController.php | 22 +- ...rException.php => ErrorErrorException.php} | 2 +- src/WebRtc/Models/DeviceApiVersionEnum.php | 24 ++ src/WebRtc/Models/Error.php | 51 +++ src/WebRtc/Models/Participant.php | 28 +- 29 files changed, 781 insertions(+), 364 deletions(-) rename src/Messaging/Exceptions/{MessagingException.php => MessagingExceptionErrorException.php} (92%) create mode 100644 src/Messaging/Models/MessagingException.php rename src/{TwoFactorAuth => MultiFactorAuth}/Controllers/MFAController.php (83%) rename src/{TwoFactorAuth/Exceptions/ErrorWithRequestException.php => MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php} (87%) rename src/{TwoFactorAuth/Exceptions/ForbiddenRequestException.php => MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php} (86%) rename src/{TwoFactorAuth/Exceptions/UnauthorizedRequestException.php => MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php} (85%) create mode 100644 src/MultiFactorAuth/Models/ErrorWithRequest.php create mode 100644 src/MultiFactorAuth/Models/ForbiddenRequest.php rename src/{TwoFactorAuth => MultiFactorAuth}/Models/TwoFactorCodeRequestSchema.php (98%) rename src/{TwoFactorAuth => MultiFactorAuth}/Models/TwoFactorMessagingResponse.php (94%) rename src/{TwoFactorAuth => MultiFactorAuth}/Models/TwoFactorVerifyCodeResponse.php (94%) rename src/{TwoFactorAuth => MultiFactorAuth}/Models/TwoFactorVerifyRequestSchema.php (97%) rename src/{TwoFactorAuth => MultiFactorAuth}/Models/TwoFactorVoiceResponse.php (94%) create mode 100644 src/MultiFactorAuth/Models/UnauthorizedRequest.php rename src/{TwoFactorAuth/TwoFactorAuthClient.php => MultiFactorAuth/MultiFactorAuthClient.php} (83%) rename src/Voice/Exceptions/{ApiErrorResponseException.php => ApiErrorResponseErrorException.php} (93%) create mode 100644 src/Voice/Models/ApiErrorResponse.php rename src/WebRtc/Exceptions/{ErrorException.php => ErrorErrorException.php} (93%) create mode 100644 src/WebRtc/Models/DeviceApiVersionEnum.php create mode 100644 src/WebRtc/Models/Error.php diff --git a/src/BandwidthClient.php b/src/BandwidthClient.php index 8aad560..fe5db80 100644 --- a/src/BandwidthClient.php +++ b/src/BandwidthClient.php @@ -21,7 +21,7 @@ public function __construct($config) } private $messaging; - private $twoFactorAuth; + private $multiFactorAuth; private $voice; private $webRtc; @@ -38,15 +38,15 @@ public function getMessaging() } /** - * Provides access to TwoFactorAuth client - * @return TwoFactorAuth\TwoFactorAuthClient + * Provides access to MultiFactorAuth client + * @return MultiFactorAuth\MultiFactorAuthClient */ - public function getTwoFactorAuth() + public function getMultiFactorAuth() { - if ($this->twoFactorAuth == null) { - $this->twoFactorAuth = new TwoFactorAuth\TwoFactorAuthClient($this->config); + if ($this->multiFactorAuth == null) { + $this->multiFactorAuth = new MultiFactorAuth\MultiFactorAuthClient($this->config); } - return $this->twoFactorAuth; + return $this->multiFactorAuth; } /** diff --git a/src/Configuration.php b/src/Configuration.php index 7094a77..c0876de 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -35,13 +35,13 @@ class Configuration * The username to use with basic authentication * @var string */ - private $twoFactorAuthBasicAuthUserName = 'TODO: Replace'; + private $multiFactorAuthBasicAuthUserName = 'TODO: Replace'; /** * The password to use with basic authentication * @var string */ - private $twoFactorAuthBasicAuthPassword = 'TODO: Replace'; + private $multiFactorAuthBasicAuthPassword = 'TODO: Replace'; /** * The username to use with basic authentication @@ -90,11 +90,11 @@ public function __construct($configOptions = null) if (isset($configOptions['messagingBasicAuthPassword'])) { $this->messagingBasicAuthPassword = $configOptions['messagingBasicAuthPassword']; } - if (isset($configOptions['twoFactorAuthBasicAuthUserName'])) { - $this->twoFactorAuthBasicAuthUserName = $configOptions['twoFactorAuthBasicAuthUserName']; + if (isset($configOptions['multiFactorAuthBasicAuthUserName'])) { + $this->multiFactorAuthBasicAuthUserName = $configOptions['multiFactorAuthBasicAuthUserName']; } - if (isset($configOptions['twoFactorAuthBasicAuthPassword'])) { - $this->twoFactorAuthBasicAuthPassword = $configOptions['twoFactorAuthBasicAuthPassword']; + if (isset($configOptions['multiFactorAuthBasicAuthPassword'])) { + $this->multiFactorAuthBasicAuthPassword = $configOptions['multiFactorAuthBasicAuthPassword']; } if (isset($configOptions['voiceBasicAuthUserName'])) { $this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName']; @@ -129,11 +129,11 @@ public function getConfigurationMap() if (isset($this->messagingBasicAuthPassword)) { $configMap['messagingBasicAuthPassword'] = $this->messagingBasicAuthPassword; } - if (isset($this->twoFactorAuthBasicAuthUserName)) { - $configMap['twoFactorAuthBasicAuthUserName'] = $this->twoFactorAuthBasicAuthUserName; + if (isset($this->multiFactorAuthBasicAuthUserName)) { + $configMap['multiFactorAuthBasicAuthUserName'] = $this->multiFactorAuthBasicAuthUserName; } - if (isset($this->twoFactorAuthBasicAuthPassword)) { - $configMap['twoFactorAuthBasicAuthPassword'] = $this->twoFactorAuthBasicAuthPassword; + if (isset($this->multiFactorAuthBasicAuthPassword)) { + $configMap['multiFactorAuthBasicAuthPassword'] = $this->multiFactorAuthBasicAuthPassword; } if (isset($this->voiceBasicAuthUserName)) { $configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName; @@ -175,16 +175,16 @@ public function getMessagingBasicAuthPassword() return $this->messagingBasicAuthPassword; } - // Getter for twoFactorAuthBasicAuthUserName - public function getTwoFactorAuthBasicAuthUserName() + // Getter for multiFactorAuthBasicAuthUserName + public function getMultiFactorAuthBasicAuthUserName() { - return $this->twoFactorAuthBasicAuthUserName; + return $this->multiFactorAuthBasicAuthUserName; } - // Getter for twoFactorAuthBasicAuthPassword - public function getTwoFactorAuthBasicAuthPassword() + // Getter for multiFactorAuthBasicAuthPassword + public function getMultiFactorAuthBasicAuthPassword() { - return $this->twoFactorAuthBasicAuthPassword; + return $this->multiFactorAuthBasicAuthPassword; } // Getter for voiceBasicAuthUserName @@ -247,14 +247,14 @@ public function getBaseUri($server = Servers::DEFAULT_) Environments::PRODUCTION => array( Servers::DEFAULT_ => 'api.bandwidth.com', Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2', - Servers::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1', + Servers::MULTIFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1', Servers::VOICEDEFAULT => 'https://voice.bandwidth.com', Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1', ), Environments::CUSTOM => array( Servers::DEFAULT_ => '{base_url}', Servers::MESSAGINGDEFAULT => '{base_url}', - Servers::TWOFACTORAUTHDEFAULT => '{base_url}', + Servers::MULTIFACTORAUTHDEFAULT => '{base_url}', Servers::VOICEDEFAULT => '{base_url}', Servers::WEBRTCDEFAULT => '{base_url}', ), diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php index c6f378d..446ce05 100644 --- a/src/Messaging/Controllers/APIController.php +++ b/src/Messaging/Controllers/APIController.php @@ -33,22 +33,22 @@ public function __construct($config, $httpCallBack = null) /** * listMedia * - * @param string $userId User's account ID + * @param string $accountId User's account ID * @param string $continuationToken (optional) Continuation token used to retrieve subsequent media. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function listMedia( - $userId, + $accountId, $continuationToken = null ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/media'; + $_queryBuilder = '/users/{accountId}/media'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, + 'accountId' => $accountId, )); //validate and preprocess url @@ -86,30 +86,42 @@ public function listMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level @@ -122,25 +134,24 @@ public function listMedia( /** * getMedia * - * @param string $userId User's account ID - * @param string $mediaId Media ID to retrieve + * @param string $accountId User's account ID + * @param string $mediaId Media ID to retrieve * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function getMedia( - $userId, + $accountId, $mediaId ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/media/{mediaId}'; + $_queryBuilder = '/users/{accountId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, - 'mediaId' => $mediaId, - ), false - ); + 'accountId' => $accountId, + 'mediaId' => $mediaId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -175,30 +186,42 @@ public function getMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level @@ -210,34 +233,31 @@ public function getMedia( /** * uploadMedia * - * @param string $userId User's account ID - * @param string $mediaId The user supplied custom media ID - * @param integer $contentLength The size of the entity-body - * @param string $body TODO: type description here - * @param string $contentType (optional) The media type of the entity-body - * @param string $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed - * by all caching mechanisms along the request/response chain. + * @param string $accountId User's account ID + * @param string $mediaId The user supplied custom media ID + * @param string $body TODO: type description here + * @param string $contentType (optional) The media type of the entity-body + * @param string $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed + * by all caching mechanisms along the request/response chain. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function uploadMedia( - $userId, + $accountId, $mediaId, - $contentLength, $body, $contentType = 'application/octet-stream', $cacheControl = null ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/media/{mediaId}'; + $_queryBuilder = '/users/{accountId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, - 'mediaId' => $mediaId, - ), false - ); + 'accountId' => $accountId, + 'mediaId' => $mediaId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -245,7 +265,6 @@ public function uploadMedia( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Content-Length' => $contentLength, 'Content-Type' => (null != $contentType) ? $contentType : 'application/octet-stream', 'Cache-Control' => $cacheControl ); @@ -278,30 +297,42 @@ public function uploadMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level @@ -312,25 +343,24 @@ public function uploadMedia( /** * deleteMedia * - * @param string $userId User's account ID - * @param string $mediaId The media ID to delete + * @param string $accountId User's account ID + * @param string $mediaId The media ID to delete * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function deleteMedia( - $userId, + $accountId, $mediaId ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/media/{mediaId}'; + $_queryBuilder = '/users/{accountId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, - 'mediaId' => $mediaId, - ), false - ); + 'accountId' => $accountId, + 'mediaId' => $mediaId, + )); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -365,30 +395,42 @@ public function deleteMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level @@ -399,13 +441,13 @@ public function deleteMedia( /** * getMessages * - * @param string $userId User's account ID + * @param string $accountId User's account ID * @param string $messageId (optional) The ID of the message to search for. Special characters need to be * encoded using URL encoding * @param string $sourceTn (optional) The phone number that sent the message * @param string $destinationTn (optional) The phone number that received the message * @param string $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, - * FAILED, DELIVERED, DLR_EXPIRED + * FAILED, DELIVERED, ACCEPTED, UNDELIVERED * @param integer $errorCode (optional) The error code of the message * @param string $fromDateTime (optional) The start of the date range to search in ISO 8601 format. Uses the * message receive time. The date range to search in is currently 14 days. @@ -418,7 +460,7 @@ public function deleteMedia( * @throws APIException Thrown if API call fails */ public function getMessages( - $userId, + $accountId, $messageId = null, $sourceTn = null, $destinationTn = null, @@ -431,11 +473,11 @@ public function getMessages( ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/messages'; + $_queryBuilder = '/users/{accountId}/messages'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, + 'accountId' => $accountId, )); //process optional query parameters @@ -485,30 +527,42 @@ public function getMessages( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level @@ -524,22 +578,22 @@ public function getMessages( /** * createMessage * - * @param string $userId User's account ID - * @param Models\MessageRequest $body TODO: type description here + * @param string $accountId User's account ID + * @param Models\MessageRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createMessage( - $userId, + $accountId, $body ) { //prepare query string for API call - $_queryBuilder = '/users/{userId}/messages'; + $_queryBuilder = '/users/{accountId}/messages'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, + 'accountId' => $accountId, )); //validate and preprocess url @@ -580,30 +634,42 @@ public function createMessage( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '400 Request is malformed or invalid', + $_httpContext + ); } if ($response->code == 401) { - throw new Exceptions\MessagingException( + throw new Exceptions\MessagingExceptionErrorException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '403 The user does not have access to this API', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\MessagingException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '415 The content-type of the request is incorrect', + $_httpContext + ); } if ($response->code == 429) { - throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); + throw new Exceptions\MessagingExceptionErrorException( + '429 The rate limit has been reached', + $_httpContext + ); } //handle errors defined at the API level diff --git a/src/Messaging/Exceptions/MessagingException.php b/src/Messaging/Exceptions/MessagingExceptionErrorException.php similarity index 92% rename from src/Messaging/Exceptions/MessagingException.php rename to src/Messaging/Exceptions/MessagingExceptionErrorException.php index 33c31ba..df27cec 100644 --- a/src/Messaging/Exceptions/MessagingException.php +++ b/src/Messaging/Exceptions/MessagingExceptionErrorException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class MessagingException extends \BandwidthLib\APIException +class MessagingExceptionErrorException extends \BandwidthLib\APIException { /** * @todo Write general description for this property diff --git a/src/Messaging/Models/Media.php b/src/Messaging/Models/Media.php index c5eeaaa..dd74801 100644 --- a/src/Messaging/Models/Media.php +++ b/src/Messaging/Models/Media.php @@ -12,12 +12,6 @@ */ class Media implements \JsonSerializable { - /** - * @todo Write general description for this property - * @var object|null $inputStream public property - */ - public $inputStream; - /** * @todo Write general description for this property * @var string|null $content public property @@ -26,68 +20,25 @@ class Media implements \JsonSerializable /** * @todo Write general description for this property - * @var string|null $url public property - */ - public $url; - - /** - * @todo Write general description for this property - * @var string|null $contentLength public property + * @var integer|null $contentLength public property */ public $contentLength; - /** - * @todo Write general description for this property - * @var string|null $contentType public property - */ - public $contentType; - - /** - * @todo Write general description for this property - * @var \BandwidthLib\Messaging\Models\Tag[]|null $tags public property - */ - public $tags; - - /** - * User's account ID - * @var string|null $userId public property - */ - public $userId; - /** * @todo Write general description for this property * @var string|null $mediaName public property */ public $mediaName; - /** - * @todo Write general description for this property - * @var string|null $mediaId public property - */ - public $mediaId; - - /** - * @todo Write general description for this property - * @var string|null $cacheControl public property - */ - public $cacheControl; - /** * Constructor to set initial or default values of member properties */ public function __construct() { - if (10 == func_num_args()) { - $this->inputStream = func_get_arg(0); - $this->content = func_get_arg(1); - $this->url = func_get_arg(2); - $this->contentLength = func_get_arg(3); - $this->contentType = func_get_arg(4); - $this->tags = func_get_arg(5); - $this->userId = func_get_arg(6); - $this->mediaName = func_get_arg(7); - $this->mediaId = func_get_arg(8); - $this->cacheControl = func_get_arg(9); + if (3 == func_num_args()) { + $this->content = func_get_arg(0); + $this->contentLength = func_get_arg(1); + $this->mediaName = func_get_arg(2); } } @@ -97,17 +48,9 @@ public function __construct() public function jsonSerialize() { $json = array(); - $json['inputStream'] = $this->inputStream; $json['content'] = $this->content; - $json['url'] = $this->url; $json['contentLength'] = $this->contentLength; - $json['contentType'] = $this->contentType; - $json['tags'] = isset($this->tags) ? - array_values($this->tags) : null; - $json['userId'] = $this->userId; $json['mediaName'] = $this->mediaName; - $json['mediaId'] = $this->mediaId; - $json['cacheControl'] = $this->cacheControl; return array_filter($json); } diff --git a/src/Messaging/Models/MessagingException.php b/src/Messaging/Models/MessagingException.php new file mode 100644 index 0000000..8a8e760 --- /dev/null +++ b/src/Messaging/Models/MessagingException.php @@ -0,0 +1,51 @@ +type = func_get_arg(0); + $this->description = func_get_arg(1); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['description'] = $this->description; + + return array_filter($json); + } +} diff --git a/src/TwoFactorAuth/Controllers/MFAController.php b/src/MultiFactorAuth/Controllers/MFAController.php similarity index 83% rename from src/TwoFactorAuth/Controllers/MFAController.php rename to src/MultiFactorAuth/Controllers/MFAController.php index ff3136d..ff16c2f 100644 --- a/src/TwoFactorAuth/Controllers/MFAController.php +++ b/src/MultiFactorAuth/Controllers/MFAController.php @@ -5,12 +5,12 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Controllers; +namespace BandwidthLib\MultiFactorAuth\Controllers; use BandwidthLib\APIException; use BandwidthLib\APIHelper; -use BandwidthLib\TwoFactorAuth\Exceptions; -use BandwidthLib\TwoFactorAuth\Models; +use BandwidthLib\MultiFactorAuth\Exceptions; +use BandwidthLib\MultiFactorAuth\Models; use BandwidthLib\Controllers\BaseController; use BandwidthLib\Http\ApiResponse; use BandwidthLib\Http\HttpRequest; @@ -52,7 +52,7 @@ public function createVoiceTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -65,7 +65,7 @@ public function createVoiceTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); + Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -89,28 +89,28 @@ public function createVoiceTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( + throw new Exceptions\ErrorWithRequestErrorException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( + throw new Exceptions\UnauthorizedRequestErrorException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( + throw new Exceptions\ForbiddenRequestErrorException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -118,7 +118,7 @@ public function createVoiceTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorVoiceResponse' + 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVoiceResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } @@ -145,7 +145,7 @@ public function createMessagingTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -158,7 +158,7 @@ public function createMessagingTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); + Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -182,28 +182,28 @@ public function createMessagingTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( + throw new Exceptions\ErrorWithRequestErrorException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( + throw new Exceptions\UnauthorizedRequestErrorException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( + throw new Exceptions\ForbiddenRequestErrorException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -211,7 +211,7 @@ public function createMessagingTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorMessagingResponse' + 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorMessagingResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } @@ -238,7 +238,7 @@ public function createVerifyTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -251,7 +251,7 @@ public function createVerifyTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); + Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -275,35 +275,35 @@ public function createVerifyTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestException( + throw new Exceptions\ErrorWithRequestErrorException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestException( + throw new Exceptions\UnauthorizedRequestErrorException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestException( + throw new Exceptions\ForbiddenRequestErrorException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 429) { - throw new Exceptions\ErrorWithRequestException( + throw new Exceptions\ErrorWithRequestErrorException( 'The user has made too many bad requests and is temporarily locked out', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -311,7 +311,7 @@ public function createVerifyTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorVerifyCodeResponse' + 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVerifyCodeResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } diff --git a/src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php b/src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php similarity index 87% rename from src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php rename to src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php index cd59b2f..bb29098 100644 --- a/src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php +++ b/src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Exceptions; +namespace BandwidthLib\MultiFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class ErrorWithRequestException extends \BandwidthLib\APIException +class ErrorWithRequestErrorException extends \BandwidthLib\APIException { /** * An error message pertaining to what the issue could be diff --git a/src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php b/src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php similarity index 86% rename from src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php rename to src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php index 1027f57..9b0353f 100644 --- a/src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php +++ b/src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Exceptions; +namespace BandwidthLib\MultiFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class ForbiddenRequestException extends \BandwidthLib\APIException +class ForbiddenRequestErrorException extends \BandwidthLib\APIException { /** * The message containing the reason behind the request being forbidden diff --git a/src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php b/src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php similarity index 85% rename from src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php rename to src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php index 25ee2da..ecf6247 100644 --- a/src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php +++ b/src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Exceptions; +namespace BandwidthLib\MultiFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class UnauthorizedRequestException extends \BandwidthLib\APIException +class UnauthorizedRequestErrorException extends \BandwidthLib\APIException { /** * The message containing the reason behind the request being unauthorized diff --git a/src/MultiFactorAuth/Models/ErrorWithRequest.php b/src/MultiFactorAuth/Models/ErrorWithRequest.php new file mode 100644 index 0000000..5bcf1ba --- /dev/null +++ b/src/MultiFactorAuth/Models/ErrorWithRequest.php @@ -0,0 +1,49 @@ +error = func_get_arg(0); + $this->requestId = func_get_arg(1); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['error'] = $this->error; + $json['requestId'] = $this->requestId; + + return array_filter($json); + } +} diff --git a/src/MultiFactorAuth/Models/ForbiddenRequest.php b/src/MultiFactorAuth/Models/ForbiddenRequest.php new file mode 100644 index 0000000..177139d --- /dev/null +++ b/src/MultiFactorAuth/Models/ForbiddenRequest.php @@ -0,0 +1,42 @@ +message = func_get_arg(0); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['Message'] = $this->message; + + return array_filter($json); + } +} diff --git a/src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php b/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php similarity index 98% rename from src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php rename to src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php index f4332b1..a4c6d6f 100644 --- a/src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php +++ b/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Models; +namespace BandwidthLib\MultiFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php b/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php similarity index 94% rename from src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php rename to src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php index 6c79721..1560a98 100644 --- a/src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Models; +namespace BandwidthLib\MultiFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php b/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php similarity index 94% rename from src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php rename to src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php index e2c5e2c..ef768c0 100644 --- a/src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Models; +namespace BandwidthLib\MultiFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php b/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php similarity index 97% rename from src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php rename to src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php index 075ff3a..b1bf423 100644 --- a/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php +++ b/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Models; +namespace BandwidthLib\MultiFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php b/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php similarity index 94% rename from src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php rename to src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php index d45cbf6..3cf2428 100644 --- a/src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php +++ b/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth\Models; +namespace BandwidthLib\MultiFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/Models/UnauthorizedRequest.php b/src/MultiFactorAuth/Models/UnauthorizedRequest.php new file mode 100644 index 0000000..6092aab --- /dev/null +++ b/src/MultiFactorAuth/Models/UnauthorizedRequest.php @@ -0,0 +1,41 @@ +message = func_get_arg(0); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['message'] = $this->message; + + return array_filter($json); + } +} diff --git a/src/TwoFactorAuth/TwoFactorAuthClient.php b/src/MultiFactorAuth/MultiFactorAuthClient.php similarity index 83% rename from src/TwoFactorAuth/TwoFactorAuthClient.php rename to src/MultiFactorAuth/MultiFactorAuthClient.php index 48d4e0e..93bab6e 100644 --- a/src/TwoFactorAuth/TwoFactorAuthClient.php +++ b/src/MultiFactorAuth/MultiFactorAuthClient.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\TwoFactorAuth; +namespace BandwidthLib\MultiFactorAuth; -use BandwidthLib\TwoFactorAuth\Controllers; +use BandwidthLib\MultiFactorAuth\Controllers; /** * BandwidthLib client class */ -class TwoFactorAuthClient +class MultiFactorAuthClient { private $config; public function __construct($config) diff --git a/src/Servers.php b/src/Servers.php index 519ae0f..ec597ed 100644 --- a/src/Servers.php +++ b/src/Servers.php @@ -25,7 +25,7 @@ class Servers /** * TODO: Write general description for this element */ - const TWOFACTORAUTHDEFAULT = "TwoFactorAuthDefault"; + const MULTIFACTORAUTHDEFAULT = "MultiFactorAuthDefault"; /** * TODO: Write general description for this element diff --git a/src/Voice/Controllers/APIController.php b/src/Voice/Controllers/APIController.php index 6628b82..f460d5b 100644 --- a/src/Voice/Controllers/APIController.php +++ b/src/Voice/Controllers/APIController.php @@ -89,7 +89,7 @@ public function createCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -104,18 +104,21 @@ public function createCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -123,7 +126,7 @@ public function createCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -131,7 +134,7 @@ public function createCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -200,7 +203,7 @@ public function getCallState( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -215,18 +218,21 @@ public function getCallState( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -234,7 +240,7 @@ public function getCallState( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -242,7 +248,7 @@ public function getCallState( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -316,7 +322,7 @@ public function modifyCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -331,18 +337,21 @@ public function modifyCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -350,7 +359,7 @@ public function modifyCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -358,7 +367,7 @@ public function modifyCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -430,7 +439,7 @@ public function modifyCallRecordingState( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -445,18 +454,21 @@ public function modifyCallRecordingState( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -464,7 +476,7 @@ public function modifyCallRecordingState( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -472,7 +484,7 @@ public function modifyCallRecordingState( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -540,7 +552,7 @@ public function getQueryMetadataForAccountAndCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -555,18 +567,21 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -574,7 +589,7 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -582,7 +597,7 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -657,7 +672,7 @@ public function getMetadataForRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -672,18 +687,21 @@ public function getMetadataForRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -691,7 +709,7 @@ public function getMetadataForRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -699,7 +717,7 @@ public function getMetadataForRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -773,7 +791,7 @@ public function deleteRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -788,18 +806,21 @@ public function deleteRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -807,7 +828,7 @@ public function deleteRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -815,7 +836,7 @@ public function deleteRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -885,7 +906,7 @@ public function getStreamRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -900,18 +921,21 @@ public function getStreamRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -919,7 +943,7 @@ public function getStreamRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -927,7 +951,7 @@ public function getStreamRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -998,7 +1022,7 @@ public function deleteRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1013,18 +1037,21 @@ public function deleteRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1032,7 +1059,7 @@ public function deleteRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1040,7 +1067,7 @@ public function deleteRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1111,7 +1138,7 @@ public function getRecordingTranscription( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1126,18 +1153,21 @@ public function getRecordingTranscription( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1145,7 +1175,7 @@ public function getRecordingTranscription( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1153,7 +1183,7 @@ public function getRecordingTranscription( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1234,7 +1264,7 @@ public function createTranscribeRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1249,25 +1279,28 @@ public function createTranscribeRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 410) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The media for this recording has been deleted, so we can\'t transcribe it', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1275,7 +1308,7 @@ public function createTranscribeRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1283,7 +1316,7 @@ public function createTranscribeRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1353,7 +1386,7 @@ public function deleteRecordingTranscription( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1368,18 +1401,21 @@ public function deleteRecordingTranscription( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1387,7 +1423,7 @@ public function deleteRecordingTranscription( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1395,7 +1431,7 @@ public function deleteRecordingTranscription( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1478,7 +1514,7 @@ public function getConferencesByAccount( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1493,18 +1529,21 @@ public function getConferencesByAccount( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1512,7 +1551,7 @@ public function getConferencesByAccount( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1520,7 +1559,7 @@ public function getConferencesByAccount( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1592,7 +1631,7 @@ public function getConferenceById( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1607,18 +1646,21 @@ public function getConferenceById( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1626,7 +1668,7 @@ public function getConferenceById( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1634,7 +1676,7 @@ public function getConferenceById( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1708,7 +1750,7 @@ public function modifyConference( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1723,18 +1765,21 @@ public function modifyConference( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1742,7 +1787,7 @@ public function modifyConference( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1750,7 +1795,7 @@ public function modifyConference( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1825,7 +1870,7 @@ public function modifyConferenceMember( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1840,18 +1885,21 @@ public function modifyConferenceMember( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1859,7 +1907,7 @@ public function modifyConferenceMember( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1867,7 +1915,7 @@ public function modifyConferenceMember( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1938,7 +1986,7 @@ public function getConferenceMember( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1953,18 +2001,21 @@ public function getConferenceMember( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1972,7 +2023,7 @@ public function getConferenceMember( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1980,7 +2031,7 @@ public function getConferenceMember( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2053,7 +2104,7 @@ public function getQueryMetadataForAccountAndConference( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2068,18 +2119,21 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2087,7 +2141,7 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2095,7 +2149,7 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2171,7 +2225,7 @@ public function getMetadataForConferenceRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2186,18 +2240,21 @@ public function getMetadataForConferenceRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2205,7 +2262,7 @@ public function getMetadataForConferenceRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2213,7 +2270,7 @@ public function getMetadataForConferenceRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2288,7 +2345,7 @@ public function getStreamConferenceRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2303,18 +2360,21 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2322,7 +2382,7 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2330,7 +2390,7 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2413,7 +2473,7 @@ public function getQueryMetadataForAccount( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2428,18 +2488,21 @@ public function getQueryMetadataForAccount( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); + throw new Exceptions\ApiErrorResponseErrorException( + 'User unauthorized to perform this action.', + $_httpContext + ); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2447,7 +2510,7 @@ public function getQueryMetadataForAccount( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2455,7 +2518,7 @@ public function getQueryMetadataForAccount( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseException( + throw new Exceptions\ApiErrorResponseErrorException( 'Something unexpected happened. Please try again.', $_httpContext ); diff --git a/src/Voice/Exceptions/ApiErrorResponseException.php b/src/Voice/Exceptions/ApiErrorResponseErrorException.php similarity index 93% rename from src/Voice/Exceptions/ApiErrorResponseException.php rename to src/Voice/Exceptions/ApiErrorResponseErrorException.php index 19e48b0..3fd3299 100644 --- a/src/Voice/Exceptions/ApiErrorResponseException.php +++ b/src/Voice/Exceptions/ApiErrorResponseErrorException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class ApiErrorResponseException extends \BandwidthLib\APIException +class ApiErrorResponseErrorException extends \BandwidthLib\APIException { /** * @todo Write general description for this property diff --git a/src/Voice/Models/ApiCallStateResponse.php b/src/Voice/Models/ApiCallStateResponse.php index 4ed11c0..9c23ffb 100644 --- a/src/Voice/Models/ApiCallStateResponse.php +++ b/src/Voice/Models/ApiCallStateResponse.php @@ -62,6 +62,18 @@ class ApiCallStateResponse implements \JsonSerializable */ public $state; + /** + * @todo Write general description for this property + * @var string|null $identity public property + */ + public $identity; + + /** + * @todo Write general description for this property + * @var array|null $pai public property + */ + public $pai; + /** * @todo Write general description for this property * @factory \BandwidthLib\Utils\DateTimeHelper::fromRfc3339DateTime @@ -113,7 +125,7 @@ class ApiCallStateResponse implements \JsonSerializable */ public function __construct() { - if (15 == func_num_args()) { + if (17 == func_num_args()) { $this->callId = func_get_arg(0); $this->parentCallId = func_get_arg(1); $this->applicationId = func_get_arg(2); @@ -122,13 +134,15 @@ public function __construct() $this->from = func_get_arg(5); $this->direction = func_get_arg(6); $this->state = func_get_arg(7); - $this->startTime = func_get_arg(8); - $this->answerTime = func_get_arg(9); - $this->endTime = func_get_arg(10); - $this->disconnectCause = func_get_arg(11); - $this->errorMessage = func_get_arg(12); - $this->errorId = func_get_arg(13); - $this->lastUpdate = func_get_arg(14); + $this->identity = func_get_arg(8); + $this->pai = func_get_arg(9); + $this->startTime = func_get_arg(10); + $this->answerTime = func_get_arg(11); + $this->endTime = func_get_arg(12); + $this->disconnectCause = func_get_arg(13); + $this->errorMessage = func_get_arg(14); + $this->errorId = func_get_arg(15); + $this->lastUpdate = func_get_arg(16); } } @@ -146,6 +160,8 @@ public function jsonSerialize() $json['from'] = $this->from; $json['direction'] = $this->direction; $json['state'] = $this->state; + $json['identity'] = $this->identity; + $json['pai'] = $this->pai; $json['startTime'] = isset($this->startTime) ? DateTimeHelper::toRfc3339DateTime($this->startTime) : null; diff --git a/src/Voice/Models/ApiErrorResponse.php b/src/Voice/Models/ApiErrorResponse.php new file mode 100644 index 0000000..9927cfd --- /dev/null +++ b/src/Voice/Models/ApiErrorResponse.php @@ -0,0 +1,57 @@ +type = func_get_arg(0); + $this->description = func_get_arg(1); + $this->id = func_get_arg(2); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['type'] = $this->type; + $json['description'] = $this->description; + $json['id'] = $this->id; + + return array_filter($json); + } +} diff --git a/src/WebRtc/Controllers/APIController.php b/src/WebRtc/Controllers/APIController.php index 5aa97ee..43785ee 100644 --- a/src/WebRtc/Controllers/APIController.php +++ b/src/WebRtc/Controllers/APIController.php @@ -104,7 +104,7 @@ public function createParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -185,7 +185,7 @@ public function getParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -262,7 +262,7 @@ public function deleteParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -344,7 +344,7 @@ public function createSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -422,7 +422,7 @@ public function getSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -499,7 +499,7 @@ public function deleteSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -575,7 +575,7 @@ public function listSessionParticipants( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -664,7 +664,7 @@ public function addParticipantToSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -745,7 +745,7 @@ public function removeParticipantFromSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -825,7 +825,7 @@ public function getParticipantSubscriptions( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -921,7 +921,7 @@ public function updateParticipantSubscriptions( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level diff --git a/src/WebRtc/Exceptions/ErrorException.php b/src/WebRtc/Exceptions/ErrorErrorException.php similarity index 93% rename from src/WebRtc/Exceptions/ErrorException.php rename to src/WebRtc/Exceptions/ErrorErrorException.php index 9a6023b..3b87f84 100644 --- a/src/WebRtc/Exceptions/ErrorException.php +++ b/src/WebRtc/Exceptions/ErrorErrorException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class ErrorException extends \BandwidthLib\APIException +class ErrorErrorException extends \BandwidthLib\APIException { /** * @todo Write general description for this property diff --git a/src/WebRtc/Models/DeviceApiVersionEnum.php b/src/WebRtc/Models/DeviceApiVersionEnum.php new file mode 100644 index 0000000..3ae64f8 --- /dev/null +++ b/src/WebRtc/Models/DeviceApiVersionEnum.php @@ -0,0 +1,24 @@ +code = func_get_arg(0); + $this->message = func_get_arg(1); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['code'] = $this->code; + $json['message'] = $this->message; + + return array_filter($json); + } +} diff --git a/src/WebRtc/Models/Participant.php b/src/WebRtc/Models/Participant.php index 06451d9..9fa2543 100644 --- a/src/WebRtc/Models/Participant.php +++ b/src/WebRtc/Models/Participant.php @@ -50,18 +50,31 @@ class Participant implements \JsonSerializable */ public $tag; + /** + * Optional field to define the device api version of this participant + * @var string|null $deviceApiVersion public property + */ + public $deviceApiVersion; + /** * Constructor to set initial or default values of member properties */ public function __construct() { - if (6 == func_num_args()) { - $this->id = func_get_arg(0); - $this->callbackUrl = func_get_arg(1); - $this->publishPermissions = func_get_arg(2); - $this->sessions = func_get_arg(3); - $this->subscriptions = func_get_arg(4); - $this->tag = func_get_arg(5); + switch (func_num_args()) { + case 7: + $this->id = func_get_arg(0); + $this->callbackUrl = func_get_arg(1); + $this->publishPermissions = func_get_arg(2); + $this->sessions = func_get_arg(3); + $this->subscriptions = func_get_arg(4); + $this->tag = func_get_arg(5); + $this->deviceApiVersion = func_get_arg(6); + break; + + default: + $this->deviceApiVersion = DeviceApiVersionEnum::V2; + break; } } @@ -80,6 +93,7 @@ public function jsonSerialize() array_values($this->sessions) : null; $json['subscriptions'] = $this->subscriptions; $json['tag'] = $this->tag; + $json['deviceApiVersion'] = $this->deviceApiVersion; return array_filter($json); } From e4227362d3b9ecbdea4f32f21dc7029c95f64245 Mon Sep 17 00:00:00 2001 From: jmulford-bandwidth Date: Tue, 9 Mar 2021 14:31:18 -0500 Subject: [PATCH 2/4] reverted changes except for webrtc --- src/BandwidthClient.php | 14 +- src/Configuration.php | 36 +- src/Messaging/Controllers/APIController.php | 228 +++++-------- ...orException.php => MessagingException.php} | 2 +- src/Messaging/Models/Media.php | 67 +++- src/Messaging/Models/MessagingException.php | 51 --- .../Models/ErrorWithRequest.php | 49 --- .../Models/ForbiddenRequest.php | 42 --- .../Models/UnauthorizedRequest.php | 41 --- .../Controllers/MFAController.php | 50 +-- .../Exceptions/ErrorWithRequestException.php} | 4 +- .../Exceptions/ForbiddenRequestException.php} | 4 +- .../UnauthorizedRequestException.php} | 4 +- .../Models/TwoFactorCodeRequestSchema.php | 2 +- .../Models/TwoFactorMessagingResponse.php | 2 +- .../Models/TwoFactorVerifyCodeResponse.php | 2 +- .../Models/TwoFactorVerifyRequestSchema.php | 2 +- .../Models/TwoFactorVoiceResponse.php | 2 +- .../TwoFactorAuthClient.php} | 6 +- src/Voice/Controllers/APIController.php | 317 +++++++----------- .../Exceptions/ApiErrorResponseException.php | 50 +++ src/Voice/Models/ApiCallStateResponse.php | 32 +- src/WebRtc/Controllers/APIController.php | 22 +- src/WebRtc/Models/Error.php | 51 --- 24 files changed, 404 insertions(+), 676 deletions(-) rename src/Messaging/Exceptions/{MessagingExceptionErrorException.php => MessagingException.php} (92%) delete mode 100644 src/Messaging/Models/MessagingException.php delete mode 100644 src/MultiFactorAuth/Models/ErrorWithRequest.php delete mode 100644 src/MultiFactorAuth/Models/ForbiddenRequest.php delete mode 100644 src/MultiFactorAuth/Models/UnauthorizedRequest.php rename src/{MultiFactorAuth => TwoFactorAuth}/Controllers/MFAController.php (83%) rename src/{MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php => TwoFactorAuth/Exceptions/ErrorWithRequestException.php} (87%) rename src/{MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php => TwoFactorAuth/Exceptions/ForbiddenRequestException.php} (86%) rename src/{MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php => TwoFactorAuth/Exceptions/UnauthorizedRequestException.php} (85%) rename src/{MultiFactorAuth => TwoFactorAuth}/Models/TwoFactorCodeRequestSchema.php (98%) rename src/{MultiFactorAuth => TwoFactorAuth}/Models/TwoFactorMessagingResponse.php (94%) rename src/{MultiFactorAuth => TwoFactorAuth}/Models/TwoFactorVerifyCodeResponse.php (94%) rename src/{MultiFactorAuth => TwoFactorAuth}/Models/TwoFactorVerifyRequestSchema.php (97%) rename src/{MultiFactorAuth => TwoFactorAuth}/Models/TwoFactorVoiceResponse.php (94%) rename src/{MultiFactorAuth/MultiFactorAuthClient.php => TwoFactorAuth/TwoFactorAuthClient.php} (83%) create mode 100644 src/Voice/Exceptions/ApiErrorResponseException.php delete mode 100644 src/WebRtc/Models/Error.php diff --git a/src/BandwidthClient.php b/src/BandwidthClient.php index fe5db80..8aad560 100644 --- a/src/BandwidthClient.php +++ b/src/BandwidthClient.php @@ -21,7 +21,7 @@ public function __construct($config) } private $messaging; - private $multiFactorAuth; + private $twoFactorAuth; private $voice; private $webRtc; @@ -38,15 +38,15 @@ public function getMessaging() } /** - * Provides access to MultiFactorAuth client - * @return MultiFactorAuth\MultiFactorAuthClient + * Provides access to TwoFactorAuth client + * @return TwoFactorAuth\TwoFactorAuthClient */ - public function getMultiFactorAuth() + public function getTwoFactorAuth() { - if ($this->multiFactorAuth == null) { - $this->multiFactorAuth = new MultiFactorAuth\MultiFactorAuthClient($this->config); + if ($this->twoFactorAuth == null) { + $this->twoFactorAuth = new TwoFactorAuth\TwoFactorAuthClient($this->config); } - return $this->multiFactorAuth; + return $this->twoFactorAuth; } /** diff --git a/src/Configuration.php b/src/Configuration.php index c0876de..7094a77 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -35,13 +35,13 @@ class Configuration * The username to use with basic authentication * @var string */ - private $multiFactorAuthBasicAuthUserName = 'TODO: Replace'; + private $twoFactorAuthBasicAuthUserName = 'TODO: Replace'; /** * The password to use with basic authentication * @var string */ - private $multiFactorAuthBasicAuthPassword = 'TODO: Replace'; + private $twoFactorAuthBasicAuthPassword = 'TODO: Replace'; /** * The username to use with basic authentication @@ -90,11 +90,11 @@ public function __construct($configOptions = null) if (isset($configOptions['messagingBasicAuthPassword'])) { $this->messagingBasicAuthPassword = $configOptions['messagingBasicAuthPassword']; } - if (isset($configOptions['multiFactorAuthBasicAuthUserName'])) { - $this->multiFactorAuthBasicAuthUserName = $configOptions['multiFactorAuthBasicAuthUserName']; + if (isset($configOptions['twoFactorAuthBasicAuthUserName'])) { + $this->twoFactorAuthBasicAuthUserName = $configOptions['twoFactorAuthBasicAuthUserName']; } - if (isset($configOptions['multiFactorAuthBasicAuthPassword'])) { - $this->multiFactorAuthBasicAuthPassword = $configOptions['multiFactorAuthBasicAuthPassword']; + if (isset($configOptions['twoFactorAuthBasicAuthPassword'])) { + $this->twoFactorAuthBasicAuthPassword = $configOptions['twoFactorAuthBasicAuthPassword']; } if (isset($configOptions['voiceBasicAuthUserName'])) { $this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName']; @@ -129,11 +129,11 @@ public function getConfigurationMap() if (isset($this->messagingBasicAuthPassword)) { $configMap['messagingBasicAuthPassword'] = $this->messagingBasicAuthPassword; } - if (isset($this->multiFactorAuthBasicAuthUserName)) { - $configMap['multiFactorAuthBasicAuthUserName'] = $this->multiFactorAuthBasicAuthUserName; + if (isset($this->twoFactorAuthBasicAuthUserName)) { + $configMap['twoFactorAuthBasicAuthUserName'] = $this->twoFactorAuthBasicAuthUserName; } - if (isset($this->multiFactorAuthBasicAuthPassword)) { - $configMap['multiFactorAuthBasicAuthPassword'] = $this->multiFactorAuthBasicAuthPassword; + if (isset($this->twoFactorAuthBasicAuthPassword)) { + $configMap['twoFactorAuthBasicAuthPassword'] = $this->twoFactorAuthBasicAuthPassword; } if (isset($this->voiceBasicAuthUserName)) { $configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName; @@ -175,16 +175,16 @@ public function getMessagingBasicAuthPassword() return $this->messagingBasicAuthPassword; } - // Getter for multiFactorAuthBasicAuthUserName - public function getMultiFactorAuthBasicAuthUserName() + // Getter for twoFactorAuthBasicAuthUserName + public function getTwoFactorAuthBasicAuthUserName() { - return $this->multiFactorAuthBasicAuthUserName; + return $this->twoFactorAuthBasicAuthUserName; } - // Getter for multiFactorAuthBasicAuthPassword - public function getMultiFactorAuthBasicAuthPassword() + // Getter for twoFactorAuthBasicAuthPassword + public function getTwoFactorAuthBasicAuthPassword() { - return $this->multiFactorAuthBasicAuthPassword; + return $this->twoFactorAuthBasicAuthPassword; } // Getter for voiceBasicAuthUserName @@ -247,14 +247,14 @@ public function getBaseUri($server = Servers::DEFAULT_) Environments::PRODUCTION => array( Servers::DEFAULT_ => 'api.bandwidth.com', Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2', - Servers::MULTIFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1', + Servers::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1', Servers::VOICEDEFAULT => 'https://voice.bandwidth.com', Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1', ), Environments::CUSTOM => array( Servers::DEFAULT_ => '{base_url}', Servers::MESSAGINGDEFAULT => '{base_url}', - Servers::MULTIFACTORAUTHDEFAULT => '{base_url}', + Servers::TWOFACTORAUTHDEFAULT => '{base_url}', Servers::VOICEDEFAULT => '{base_url}', Servers::WEBRTCDEFAULT => '{base_url}', ), diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php index 446ce05..c6f378d 100644 --- a/src/Messaging/Controllers/APIController.php +++ b/src/Messaging/Controllers/APIController.php @@ -33,22 +33,22 @@ public function __construct($config, $httpCallBack = null) /** * listMedia * - * @param string $accountId User's account ID + * @param string $userId User's account ID * @param string $continuationToken (optional) Continuation token used to retrieve subsequent media. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function listMedia( - $accountId, + $userId, $continuationToken = null ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media'; + $_queryBuilder = '/users/{userId}/media'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, + 'userId' => $userId, )); //validate and preprocess url @@ -86,42 +86,30 @@ public function listMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level @@ -134,24 +122,25 @@ public function listMedia( /** * getMedia * - * @param string $accountId User's account ID - * @param string $mediaId Media ID to retrieve + * @param string $userId User's account ID + * @param string $mediaId Media ID to retrieve * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function getMedia( - $accountId, + $userId, $mediaId ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; + $_queryBuilder = '/users/{userId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - )); + 'userId' => $userId, + 'mediaId' => $mediaId, + ), false + ); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -186,42 +175,30 @@ public function getMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level @@ -233,31 +210,34 @@ public function getMedia( /** * uploadMedia * - * @param string $accountId User's account ID - * @param string $mediaId The user supplied custom media ID - * @param string $body TODO: type description here - * @param string $contentType (optional) The media type of the entity-body - * @param string $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed - * by all caching mechanisms along the request/response chain. + * @param string $userId User's account ID + * @param string $mediaId The user supplied custom media ID + * @param integer $contentLength The size of the entity-body + * @param string $body TODO: type description here + * @param string $contentType (optional) The media type of the entity-body + * @param string $cacheControl (optional) General-header field is used to specify directives that MUST be obeyed + * by all caching mechanisms along the request/response chain. * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function uploadMedia( - $accountId, + $userId, $mediaId, + $contentLength, $body, $contentType = 'application/octet-stream', $cacheControl = null ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; + $_queryBuilder = '/users/{userId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - )); + 'userId' => $userId, + 'mediaId' => $mediaId, + ), false + ); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -265,6 +245,7 @@ public function uploadMedia( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, + 'Content-Length' => $contentLength, 'Content-Type' => (null != $contentType) ? $contentType : 'application/octet-stream', 'Cache-Control' => $cacheControl ); @@ -297,42 +278,30 @@ public function uploadMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level @@ -343,24 +312,25 @@ public function uploadMedia( /** * deleteMedia * - * @param string $accountId User's account ID - * @param string $mediaId The media ID to delete + * @param string $userId User's account ID + * @param string $mediaId The media ID to delete * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function deleteMedia( - $accountId, + $userId, $mediaId ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/media/{mediaId}'; + $_queryBuilder = '/users/{userId}/media/{mediaId}'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, - 'mediaId' => $mediaId, - )); + 'userId' => $userId, + 'mediaId' => $mediaId, + ), false + ); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -395,42 +365,30 @@ public function deleteMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level @@ -441,13 +399,13 @@ public function deleteMedia( /** * getMessages * - * @param string $accountId User's account ID + * @param string $userId User's account ID * @param string $messageId (optional) The ID of the message to search for. Special characters need to be * encoded using URL encoding * @param string $sourceTn (optional) The phone number that sent the message * @param string $destinationTn (optional) The phone number that received the message * @param string $messageStatus (optional) The status of the message. One of RECEIVED, QUEUED, SENDING, SENT, - * FAILED, DELIVERED, ACCEPTED, UNDELIVERED + * FAILED, DELIVERED, DLR_EXPIRED * @param integer $errorCode (optional) The error code of the message * @param string $fromDateTime (optional) The start of the date range to search in ISO 8601 format. Uses the * message receive time. The date range to search in is currently 14 days. @@ -460,7 +418,7 @@ public function deleteMedia( * @throws APIException Thrown if API call fails */ public function getMessages( - $accountId, + $userId, $messageId = null, $sourceTn = null, $destinationTn = null, @@ -473,11 +431,11 @@ public function getMessages( ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/messages'; + $_queryBuilder = '/users/{userId}/messages'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, + 'userId' => $userId, )); //process optional query parameters @@ -527,42 +485,30 @@ public function getMessages( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level @@ -578,22 +524,22 @@ public function getMessages( /** * createMessage * - * @param string $accountId User's account ID - * @param Models\MessageRequest $body TODO: type description here + * @param string $userId User's account ID + * @param Models\MessageRequest $body TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ public function createMessage( - $accountId, + $userId, $body ) { //prepare query string for API call - $_queryBuilder = '/users/{accountId}/messages'; + $_queryBuilder = '/users/{userId}/messages'; //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'accountId' => $accountId, + 'userId' => $userId, )); //validate and preprocess url @@ -634,42 +580,30 @@ public function createMessage( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\MessagingExceptionErrorException( - '400 Request is malformed or invalid', - $_httpContext - ); + throw new Exceptions\MessagingException('400 Request is malformed or invalid', $_httpContext); } if ($response->code == 401) { - throw new Exceptions\MessagingExceptionErrorException( + throw new Exceptions\MessagingException( '401 The specified user does not have access to the account', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\MessagingExceptionErrorException( - '403 The user does not have access to this API', - $_httpContext - ); + throw new Exceptions\MessagingException('403 The user does not have access to this API', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\MessagingExceptionErrorException('404 Path not found', $_httpContext); + throw new Exceptions\MessagingException('404 Path not found', $_httpContext); } if ($response->code == 415) { - throw new Exceptions\MessagingExceptionErrorException( - '415 The content-type of the request is incorrect', - $_httpContext - ); + throw new Exceptions\MessagingException('415 The content-type of the request is incorrect', $_httpContext); } if ($response->code == 429) { - throw new Exceptions\MessagingExceptionErrorException( - '429 The rate limit has been reached', - $_httpContext - ); + throw new Exceptions\MessagingException('429 The rate limit has been reached', $_httpContext); } //handle errors defined at the API level diff --git a/src/Messaging/Exceptions/MessagingExceptionErrorException.php b/src/Messaging/Exceptions/MessagingException.php similarity index 92% rename from src/Messaging/Exceptions/MessagingExceptionErrorException.php rename to src/Messaging/Exceptions/MessagingException.php index df27cec..33c31ba 100644 --- a/src/Messaging/Exceptions/MessagingExceptionErrorException.php +++ b/src/Messaging/Exceptions/MessagingException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class MessagingExceptionErrorException extends \BandwidthLib\APIException +class MessagingException extends \BandwidthLib\APIException { /** * @todo Write general description for this property diff --git a/src/Messaging/Models/Media.php b/src/Messaging/Models/Media.php index dd74801..c5eeaaa 100644 --- a/src/Messaging/Models/Media.php +++ b/src/Messaging/Models/Media.php @@ -12,6 +12,12 @@ */ class Media implements \JsonSerializable { + /** + * @todo Write general description for this property + * @var object|null $inputStream public property + */ + public $inputStream; + /** * @todo Write general description for this property * @var string|null $content public property @@ -20,25 +26,68 @@ class Media implements \JsonSerializable /** * @todo Write general description for this property - * @var integer|null $contentLength public property + * @var string|null $url public property + */ + public $url; + + /** + * @todo Write general description for this property + * @var string|null $contentLength public property */ public $contentLength; + /** + * @todo Write general description for this property + * @var string|null $contentType public property + */ + public $contentType; + + /** + * @todo Write general description for this property + * @var \BandwidthLib\Messaging\Models\Tag[]|null $tags public property + */ + public $tags; + + /** + * User's account ID + * @var string|null $userId public property + */ + public $userId; + /** * @todo Write general description for this property * @var string|null $mediaName public property */ public $mediaName; + /** + * @todo Write general description for this property + * @var string|null $mediaId public property + */ + public $mediaId; + + /** + * @todo Write general description for this property + * @var string|null $cacheControl public property + */ + public $cacheControl; + /** * Constructor to set initial or default values of member properties */ public function __construct() { - if (3 == func_num_args()) { - $this->content = func_get_arg(0); - $this->contentLength = func_get_arg(1); - $this->mediaName = func_get_arg(2); + if (10 == func_num_args()) { + $this->inputStream = func_get_arg(0); + $this->content = func_get_arg(1); + $this->url = func_get_arg(2); + $this->contentLength = func_get_arg(3); + $this->contentType = func_get_arg(4); + $this->tags = func_get_arg(5); + $this->userId = func_get_arg(6); + $this->mediaName = func_get_arg(7); + $this->mediaId = func_get_arg(8); + $this->cacheControl = func_get_arg(9); } } @@ -48,9 +97,17 @@ public function __construct() public function jsonSerialize() { $json = array(); + $json['inputStream'] = $this->inputStream; $json['content'] = $this->content; + $json['url'] = $this->url; $json['contentLength'] = $this->contentLength; + $json['contentType'] = $this->contentType; + $json['tags'] = isset($this->tags) ? + array_values($this->tags) : null; + $json['userId'] = $this->userId; $json['mediaName'] = $this->mediaName; + $json['mediaId'] = $this->mediaId; + $json['cacheControl'] = $this->cacheControl; return array_filter($json); } diff --git a/src/Messaging/Models/MessagingException.php b/src/Messaging/Models/MessagingException.php deleted file mode 100644 index 8a8e760..0000000 --- a/src/Messaging/Models/MessagingException.php +++ /dev/null @@ -1,51 +0,0 @@ -type = func_get_arg(0); - $this->description = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['type'] = $this->type; - $json['description'] = $this->description; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/ErrorWithRequest.php b/src/MultiFactorAuth/Models/ErrorWithRequest.php deleted file mode 100644 index 5bcf1ba..0000000 --- a/src/MultiFactorAuth/Models/ErrorWithRequest.php +++ /dev/null @@ -1,49 +0,0 @@ -error = func_get_arg(0); - $this->requestId = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['error'] = $this->error; - $json['requestId'] = $this->requestId; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/ForbiddenRequest.php b/src/MultiFactorAuth/Models/ForbiddenRequest.php deleted file mode 100644 index 177139d..0000000 --- a/src/MultiFactorAuth/Models/ForbiddenRequest.php +++ /dev/null @@ -1,42 +0,0 @@ -message = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['Message'] = $this->message; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Models/UnauthorizedRequest.php b/src/MultiFactorAuth/Models/UnauthorizedRequest.php deleted file mode 100644 index 6092aab..0000000 --- a/src/MultiFactorAuth/Models/UnauthorizedRequest.php +++ /dev/null @@ -1,41 +0,0 @@ -message = func_get_arg(0); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['message'] = $this->message; - - return array_filter($json); - } -} diff --git a/src/MultiFactorAuth/Controllers/MFAController.php b/src/TwoFactorAuth/Controllers/MFAController.php similarity index 83% rename from src/MultiFactorAuth/Controllers/MFAController.php rename to src/TwoFactorAuth/Controllers/MFAController.php index ff16c2f..ff3136d 100644 --- a/src/MultiFactorAuth/Controllers/MFAController.php +++ b/src/TwoFactorAuth/Controllers/MFAController.php @@ -5,12 +5,12 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Controllers; +namespace BandwidthLib\TwoFactorAuth\Controllers; use BandwidthLib\APIException; use BandwidthLib\APIHelper; -use BandwidthLib\MultiFactorAuth\Exceptions; -use BandwidthLib\MultiFactorAuth\Models; +use BandwidthLib\TwoFactorAuth\Exceptions; +use BandwidthLib\TwoFactorAuth\Models; use BandwidthLib\Controllers\BaseController; use BandwidthLib\Http\ApiResponse; use BandwidthLib\Http\HttpRequest; @@ -52,7 +52,7 @@ public function createVoiceTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -65,7 +65,7 @@ public function createVoiceTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); + Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -89,28 +89,28 @@ public function createVoiceTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestErrorException( + throw new Exceptions\ErrorWithRequestException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestErrorException( + throw new Exceptions\UnauthorizedRequestException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestErrorException( + throw new Exceptions\ForbiddenRequestException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -118,7 +118,7 @@ public function createVoiceTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVoiceResponse' + 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorVoiceResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } @@ -145,7 +145,7 @@ public function createMessagingTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -158,7 +158,7 @@ public function createMessagingTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); + Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -182,28 +182,28 @@ public function createMessagingTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestErrorException( + throw new Exceptions\ErrorWithRequestException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestErrorException( + throw new Exceptions\UnauthorizedRequestException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestErrorException( + throw new Exceptions\ForbiddenRequestException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -211,7 +211,7 @@ public function createMessagingTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorMessagingResponse' + 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorMessagingResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } @@ -238,7 +238,7 @@ public function createVerifyTwoFactor( )); //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MULTIFACTORAUTHDEFAULT) . $_queryBuilder); + $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::TWOFACTORAUTHDEFAULT) . $_queryBuilder); //prepare headers $_headers = array ( @@ -251,7 +251,7 @@ public function createVerifyTwoFactor( $_bodyJson = Request\Body::Json($body); //set HTTP basic auth parameters - Request::auth($this->config->getMultiFactorAuthBasicAuthUserName(), $this->config->getMultiFactorAuthBasicAuthPassword()); + Request::auth($this->config->getTwoFactorAuthBasicAuthUserName(), $this->config->getTwoFactorAuthBasicAuthPassword()); $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); @@ -275,35 +275,35 @@ public function createVerifyTwoFactor( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ErrorWithRequestErrorException( + throw new Exceptions\ErrorWithRequestException( 'If there is any issue with values passed in by the user', $_httpContext ); } if ($response->code == 401) { - throw new Exceptions\UnauthorizedRequestErrorException( + throw new Exceptions\UnauthorizedRequestException( 'Authentication is either incorrect or not present', $_httpContext ); } if ($response->code == 403) { - throw new Exceptions\ForbiddenRequestErrorException( + throw new Exceptions\ForbiddenRequestException( 'The user is not authorized to access this resource', $_httpContext ); } if ($response->code == 429) { - throw new Exceptions\ErrorWithRequestErrorException( + throw new Exceptions\ErrorWithRequestException( 'The user has made too many bad requests and is temporarily locked out', $_httpContext ); } if ($response->code == 500) { - throw new Exceptions\ErrorWithRequestErrorException('An internal server error occurred', $_httpContext); + throw new Exceptions\ErrorWithRequestException('An internal server error occurred', $_httpContext); } //handle errors defined at the API level @@ -311,7 +311,7 @@ public function createVerifyTwoFactor( $mapper = $this->getJsonMapper(); $deserializedResponse = $mapper->mapClass( $response->body, - 'BandwidthLib\\MultiFactorAuth\\Models\\TwoFactorVerifyCodeResponse' + 'BandwidthLib\\TwoFactorAuth\\Models\\TwoFactorVerifyCodeResponse' ); return new ApiResponse($response->code, $response->headers, $deserializedResponse); } diff --git a/src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php b/src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php similarity index 87% rename from src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php rename to src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php index bb29098..cd59b2f 100644 --- a/src/MultiFactorAuth/Exceptions/ErrorWithRequestErrorException.php +++ b/src/TwoFactorAuth/Exceptions/ErrorWithRequestException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Exceptions; +namespace BandwidthLib\TwoFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class ErrorWithRequestErrorException extends \BandwidthLib\APIException +class ErrorWithRequestException extends \BandwidthLib\APIException { /** * An error message pertaining to what the issue could be diff --git a/src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php b/src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php similarity index 86% rename from src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php rename to src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php index 9b0353f..1027f57 100644 --- a/src/MultiFactorAuth/Exceptions/ForbiddenRequestErrorException.php +++ b/src/TwoFactorAuth/Exceptions/ForbiddenRequestException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Exceptions; +namespace BandwidthLib\TwoFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class ForbiddenRequestErrorException extends \BandwidthLib\APIException +class ForbiddenRequestException extends \BandwidthLib\APIException { /** * The message containing the reason behind the request being forbidden diff --git a/src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php b/src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php similarity index 85% rename from src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php rename to src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php index ecf6247..25ee2da 100644 --- a/src/MultiFactorAuth/Exceptions/UnauthorizedRequestErrorException.php +++ b/src/TwoFactorAuth/Exceptions/UnauthorizedRequestException.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Exceptions; +namespace BandwidthLib\TwoFactorAuth\Exceptions; use BandwidthLib\APIHelper; /** * @todo Write general description for this model */ -class UnauthorizedRequestErrorException extends \BandwidthLib\APIException +class UnauthorizedRequestException extends \BandwidthLib\APIException { /** * The message containing the reason behind the request being unauthorized diff --git a/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php b/src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php similarity index 98% rename from src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php rename to src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php index a4c6d6f..f4332b1 100644 --- a/src/MultiFactorAuth/Models/TwoFactorCodeRequestSchema.php +++ b/src/TwoFactorAuth/Models/TwoFactorCodeRequestSchema.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Models; +namespace BandwidthLib\TwoFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php b/src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php similarity index 94% rename from src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php rename to src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php index 1560a98..6c79721 100644 --- a/src/MultiFactorAuth/Models/TwoFactorMessagingResponse.php +++ b/src/TwoFactorAuth/Models/TwoFactorMessagingResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Models; +namespace BandwidthLib\TwoFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php b/src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php similarity index 94% rename from src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php rename to src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php index ef768c0..e2c5e2c 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyCodeResponse.php +++ b/src/TwoFactorAuth/Models/TwoFactorVerifyCodeResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Models; +namespace BandwidthLib\TwoFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php b/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php similarity index 97% rename from src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php rename to src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php index b1bf423..075ff3a 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVerifyRequestSchema.php +++ b/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Models; +namespace BandwidthLib\TwoFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php b/src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php similarity index 94% rename from src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php rename to src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php index 3cf2428..d45cbf6 100644 --- a/src/MultiFactorAuth/Models/TwoFactorVoiceResponse.php +++ b/src/TwoFactorAuth/Models/TwoFactorVoiceResponse.php @@ -5,7 +5,7 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth\Models; +namespace BandwidthLib\TwoFactorAuth\Models; /** * @todo Write general description for this model diff --git a/src/MultiFactorAuth/MultiFactorAuthClient.php b/src/TwoFactorAuth/TwoFactorAuthClient.php similarity index 83% rename from src/MultiFactorAuth/MultiFactorAuthClient.php rename to src/TwoFactorAuth/TwoFactorAuthClient.php index 93bab6e..48d4e0e 100644 --- a/src/MultiFactorAuth/MultiFactorAuthClient.php +++ b/src/TwoFactorAuth/TwoFactorAuthClient.php @@ -5,14 +5,14 @@ * This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ). */ -namespace BandwidthLib\MultiFactorAuth; +namespace BandwidthLib\TwoFactorAuth; -use BandwidthLib\MultiFactorAuth\Controllers; +use BandwidthLib\TwoFactorAuth\Controllers; /** * BandwidthLib client class */ -class MultiFactorAuthClient +class TwoFactorAuthClient { private $config; public function __construct($config) diff --git a/src/Voice/Controllers/APIController.php b/src/Voice/Controllers/APIController.php index f460d5b..6628b82 100644 --- a/src/Voice/Controllers/APIController.php +++ b/src/Voice/Controllers/APIController.php @@ -89,7 +89,7 @@ public function createCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -104,21 +104,18 @@ public function createCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -126,7 +123,7 @@ public function createCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -134,7 +131,7 @@ public function createCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -203,7 +200,7 @@ public function getCallState( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -218,21 +215,18 @@ public function getCallState( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -240,7 +234,7 @@ public function getCallState( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -248,7 +242,7 @@ public function getCallState( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -322,7 +316,7 @@ public function modifyCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -337,21 +331,18 @@ public function modifyCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -359,7 +350,7 @@ public function modifyCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -367,7 +358,7 @@ public function modifyCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -439,7 +430,7 @@ public function modifyCallRecordingState( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -454,21 +445,18 @@ public function modifyCallRecordingState( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -476,7 +464,7 @@ public function modifyCallRecordingState( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -484,7 +472,7 @@ public function modifyCallRecordingState( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -552,7 +540,7 @@ public function getQueryMetadataForAccountAndCall( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -567,21 +555,18 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -589,7 +574,7 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -597,7 +582,7 @@ public function getQueryMetadataForAccountAndCall( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -672,7 +657,7 @@ public function getMetadataForRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -687,21 +672,18 @@ public function getMetadataForRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -709,7 +691,7 @@ public function getMetadataForRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -717,7 +699,7 @@ public function getMetadataForRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -791,7 +773,7 @@ public function deleteRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -806,21 +788,18 @@ public function deleteRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -828,7 +807,7 @@ public function deleteRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -836,7 +815,7 @@ public function deleteRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -906,7 +885,7 @@ public function getStreamRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -921,21 +900,18 @@ public function getStreamRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -943,7 +919,7 @@ public function getStreamRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -951,7 +927,7 @@ public function getStreamRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1022,7 +998,7 @@ public function deleteRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1037,21 +1013,18 @@ public function deleteRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1059,7 +1032,7 @@ public function deleteRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1067,7 +1040,7 @@ public function deleteRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1138,7 +1111,7 @@ public function getRecordingTranscription( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1153,21 +1126,18 @@ public function getRecordingTranscription( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1175,7 +1145,7 @@ public function getRecordingTranscription( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1183,7 +1153,7 @@ public function getRecordingTranscription( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1264,7 +1234,7 @@ public function createTranscribeRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1279,28 +1249,25 @@ public function createTranscribeRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 410) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The media for this recording has been deleted, so we can\'t transcribe it', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1308,7 +1275,7 @@ public function createTranscribeRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1316,7 +1283,7 @@ public function createTranscribeRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1386,7 +1353,7 @@ public function deleteRecordingTranscription( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1401,21 +1368,18 @@ public function deleteRecordingTranscription( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1423,7 +1387,7 @@ public function deleteRecordingTranscription( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1431,7 +1395,7 @@ public function deleteRecordingTranscription( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1514,7 +1478,7 @@ public function getConferencesByAccount( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1529,21 +1493,18 @@ public function getConferencesByAccount( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1551,7 +1512,7 @@ public function getConferencesByAccount( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1559,7 +1520,7 @@ public function getConferencesByAccount( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1631,7 +1592,7 @@ public function getConferenceById( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1646,21 +1607,18 @@ public function getConferenceById( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1668,7 +1626,7 @@ public function getConferenceById( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1676,7 +1634,7 @@ public function getConferenceById( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1750,7 +1708,7 @@ public function modifyConference( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1765,21 +1723,18 @@ public function modifyConference( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1787,7 +1742,7 @@ public function modifyConference( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1795,7 +1750,7 @@ public function modifyConference( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1870,7 +1825,7 @@ public function modifyConferenceMember( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -1885,21 +1840,18 @@ public function modifyConferenceMember( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -1907,7 +1859,7 @@ public function modifyConferenceMember( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -1915,7 +1867,7 @@ public function modifyConferenceMember( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -1986,7 +1938,7 @@ public function getConferenceMember( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2001,21 +1953,18 @@ public function getConferenceMember( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2023,7 +1972,7 @@ public function getConferenceMember( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2031,7 +1980,7 @@ public function getConferenceMember( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2104,7 +2053,7 @@ public function getQueryMetadataForAccountAndConference( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2119,21 +2068,18 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2141,7 +2087,7 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2149,7 +2095,7 @@ public function getQueryMetadataForAccountAndConference( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2225,7 +2171,7 @@ public function getMetadataForConferenceRecording( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2240,21 +2186,18 @@ public function getMetadataForConferenceRecording( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2262,7 +2205,7 @@ public function getMetadataForConferenceRecording( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2270,7 +2213,7 @@ public function getMetadataForConferenceRecording( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2345,7 +2288,7 @@ public function getStreamConferenceRecordingMedia( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2360,21 +2303,18 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2382,7 +2322,7 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2390,7 +2330,7 @@ public function getStreamConferenceRecordingMedia( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); @@ -2473,7 +2413,7 @@ public function getQueryMetadataForAccount( //Error handling using HTTP status codes if ($response->code == 400) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something\'s not quite right... Your request is invalid. Please fix it before trying again.', $_httpContext ); @@ -2488,21 +2428,18 @@ public function getQueryMetadataForAccount( } if ($response->code == 403) { - throw new Exceptions\ApiErrorResponseErrorException( - 'User unauthorized to perform this action.', - $_httpContext - ); + throw new Exceptions\ApiErrorResponseException('User unauthorized to perform this action.', $_httpContext); } if ($response->code == 404) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'The resource specified cannot be found or does not belong to you.', $_httpContext ); } if ($response->code == 415) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'We don\'t support that media type. If a request body is required, please send it to us as ' . '`application/json`.', $_httpContext @@ -2510,7 +2447,7 @@ public function getQueryMetadataForAccount( } if ($response->code == 429) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'You\'re sending requests to this endpoint too frequently. Please slow your request rate down and ' . 'try again.', $_httpContext @@ -2518,7 +2455,7 @@ public function getQueryMetadataForAccount( } if ($response->code == 500) { - throw new Exceptions\ApiErrorResponseErrorException( + throw new Exceptions\ApiErrorResponseException( 'Something unexpected happened. Please try again.', $_httpContext ); diff --git a/src/Voice/Exceptions/ApiErrorResponseException.php b/src/Voice/Exceptions/ApiErrorResponseException.php new file mode 100644 index 0000000..19e48b0 --- /dev/null +++ b/src/Voice/Exceptions/ApiErrorResponseException.php @@ -0,0 +1,50 @@ +callId = func_get_arg(0); $this->parentCallId = func_get_arg(1); $this->applicationId = func_get_arg(2); @@ -134,15 +122,13 @@ public function __construct() $this->from = func_get_arg(5); $this->direction = func_get_arg(6); $this->state = func_get_arg(7); - $this->identity = func_get_arg(8); - $this->pai = func_get_arg(9); - $this->startTime = func_get_arg(10); - $this->answerTime = func_get_arg(11); - $this->endTime = func_get_arg(12); - $this->disconnectCause = func_get_arg(13); - $this->errorMessage = func_get_arg(14); - $this->errorId = func_get_arg(15); - $this->lastUpdate = func_get_arg(16); + $this->startTime = func_get_arg(8); + $this->answerTime = func_get_arg(9); + $this->endTime = func_get_arg(10); + $this->disconnectCause = func_get_arg(11); + $this->errorMessage = func_get_arg(12); + $this->errorId = func_get_arg(13); + $this->lastUpdate = func_get_arg(14); } } @@ -160,8 +146,6 @@ public function jsonSerialize() $json['from'] = $this->from; $json['direction'] = $this->direction; $json['state'] = $this->state; - $json['identity'] = $this->identity; - $json['pai'] = $this->pai; $json['startTime'] = isset($this->startTime) ? DateTimeHelper::toRfc3339DateTime($this->startTime) : null; diff --git a/src/WebRtc/Controllers/APIController.php b/src/WebRtc/Controllers/APIController.php index 43785ee..5aa97ee 100644 --- a/src/WebRtc/Controllers/APIController.php +++ b/src/WebRtc/Controllers/APIController.php @@ -104,7 +104,7 @@ public function createParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -185,7 +185,7 @@ public function getParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -262,7 +262,7 @@ public function deleteParticipant( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -344,7 +344,7 @@ public function createSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -422,7 +422,7 @@ public function getSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -499,7 +499,7 @@ public function deleteSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -575,7 +575,7 @@ public function listSessionParticipants( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -664,7 +664,7 @@ public function addParticipantToSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -745,7 +745,7 @@ public function removeParticipantFromSession( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -825,7 +825,7 @@ public function getParticipantSubscriptions( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level @@ -921,7 +921,7 @@ public function updateParticipantSubscriptions( } if (($response->code < 200) || ($response->code > 208)) { - throw new Exceptions\ErrorErrorException('Unexpected Error', $_httpContext); + throw new Exceptions\ErrorException('Unexpected Error', $_httpContext); } //handle errors defined at the API level diff --git a/src/WebRtc/Models/Error.php b/src/WebRtc/Models/Error.php deleted file mode 100644 index 91d2758..0000000 --- a/src/WebRtc/Models/Error.php +++ /dev/null @@ -1,51 +0,0 @@ -code = func_get_arg(0); - $this->message = func_get_arg(1); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['code'] = $this->code; - $json['message'] = $this->message; - - return array_filter($json); - } -} From 43f586fbb97d12d23cd31f7821bf9462f9349ef0 Mon Sep 17 00:00:00 2001 From: jmulford-bandwidth Date: Tue, 9 Mar 2021 14:33:12 -0500 Subject: [PATCH 3/4] reverted missing files --- src/Servers.php | 2 +- .../Exceptions/ApiErrorResponseException.php | 50 ---------------- src/Voice/Models/ApiErrorResponse.php | 57 ------------------- ...rErrorException.php => ErrorException.php} | 2 +- 4 files changed, 2 insertions(+), 109 deletions(-) delete mode 100644 src/Voice/Exceptions/ApiErrorResponseException.php delete mode 100644 src/Voice/Models/ApiErrorResponse.php rename src/WebRtc/Exceptions/{ErrorErrorException.php => ErrorException.php} (93%) diff --git a/src/Servers.php b/src/Servers.php index ec597ed..519ae0f 100644 --- a/src/Servers.php +++ b/src/Servers.php @@ -25,7 +25,7 @@ class Servers /** * TODO: Write general description for this element */ - const MULTIFACTORAUTHDEFAULT = "MultiFactorAuthDefault"; + const TWOFACTORAUTHDEFAULT = "TwoFactorAuthDefault"; /** * TODO: Write general description for this element diff --git a/src/Voice/Exceptions/ApiErrorResponseException.php b/src/Voice/Exceptions/ApiErrorResponseException.php deleted file mode 100644 index 19e48b0..0000000 --- a/src/Voice/Exceptions/ApiErrorResponseException.php +++ /dev/null @@ -1,50 +0,0 @@ -type = func_get_arg(0); - $this->description = func_get_arg(1); - $this->id = func_get_arg(2); - } - } - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['type'] = $this->type; - $json['description'] = $this->description; - $json['id'] = $this->id; - - return array_filter($json); - } -} diff --git a/src/WebRtc/Exceptions/ErrorErrorException.php b/src/WebRtc/Exceptions/ErrorException.php similarity index 93% rename from src/WebRtc/Exceptions/ErrorErrorException.php rename to src/WebRtc/Exceptions/ErrorException.php index 3b87f84..9a6023b 100644 --- a/src/WebRtc/Exceptions/ErrorErrorException.php +++ b/src/WebRtc/Exceptions/ErrorException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class ErrorErrorException extends \BandwidthLib\APIException +class ErrorException extends \BandwidthLib\APIException { /** * @todo Write general description for this property From b864e351199e0c5421c74ff8541f90842f6320ff Mon Sep 17 00:00:00 2001 From: jmulford-bandwidth Date: Tue, 9 Mar 2021 14:34:25 -0500 Subject: [PATCH 4/4] git is hard --- ...ResponseErrorException.php => ApiErrorResponseException.php} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename src/Voice/Exceptions/{ApiErrorResponseErrorException.php => ApiErrorResponseException.php} (93%) diff --git a/src/Voice/Exceptions/ApiErrorResponseErrorException.php b/src/Voice/Exceptions/ApiErrorResponseException.php similarity index 93% rename from src/Voice/Exceptions/ApiErrorResponseErrorException.php rename to src/Voice/Exceptions/ApiErrorResponseException.php index 3fd3299..19e48b0 100644 --- a/src/Voice/Exceptions/ApiErrorResponseErrorException.php +++ b/src/Voice/Exceptions/ApiErrorResponseException.php @@ -12,7 +12,7 @@ /** * @todo Write general description for this model */ -class ApiErrorResponseErrorException extends \BandwidthLib\APIException +class ApiErrorResponseException extends \BandwidthLib\APIException { /** * @todo Write general description for this property