From 23cbc8b77981f40b4bca6be7925853f1689f8273 Mon Sep 17 00:00:00 2001 From: Jacob Mulford <39915377+jmulford-bw@users.noreply.github.com> Date: Mon, 11 Jan 2021 13:22:19 -0500 Subject: [PATCH] Disabled media url encoding, mfa schema update (#16) * New deploy * Update APIController.php * Update APIController.php Co-authored-by: DX-Bandwidth --- LICENSE | 2 +- src/Controllers/BaseController.php | 2 +- src/Messaging/Controllers/APIController.php | 10 +- .../Models/TwoFactorVerifyRequestSchema.php | 28 +---- src/Voice/Controllers/APIController.php | 6 +- src/Voice/Models/ApiCreateCallRequest.php | 46 +++++--- .../Models/ApiModifyConferenceRequest.php | 105 ++++++++++++++++++ src/Voice/Models/ModifyCallRecordingState.php | 3 +- src/Voice/Models/StateEnum.php | 6 +- 9 files changed, 154 insertions(+), 54 deletions(-) create mode 100644 src/Voice/Models/ApiModifyConferenceRequest.php diff --git a/LICENSE b/LICENSE index a9acc25..749af7f 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ License: The MIT License (MIT) http://opensource.org/licenses/MIT -Copyright (c) 2014 - 2016 APIMATIC Limited +Copyright (c) 2014 - 2020 APIMATIC Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index 5897069..678fc36 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -22,7 +22,7 @@ class BaseController * User-agent to be sent with API calls * @var string */ - const USER_AGENT = 'php-sdk-refs/tags/phpold2.13.3'; + const USER_AGENT = 'php-sdk'; /** * HttpCallBack instance associated with this controller diff --git a/src/Messaging/Controllers/APIController.php b/src/Messaging/Controllers/APIController.php index 27afbf0..636ffd9 100644 --- a/src/Messaging/Controllers/APIController.php +++ b/src/Messaging/Controllers/APIController.php @@ -233,9 +233,10 @@ public function uploadMedia( //process optional query parameters $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'userId' => $userId, - 'mediaId' => $mediaId, - )); + 'userId' => $userId, + 'mediaId' => $mediaId, + ), false + ); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); @@ -327,7 +328,8 @@ public function deleteMedia( $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( 'userId' => $userId, 'mediaId' => $mediaId, - )); + ), false + ); //validate and preprocess url $_queryUrl = APIHelper::cleanUrl($this->config->getBaseUri(Servers::MESSAGINGDEFAULT) . $_queryBuilder); diff --git a/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php b/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php index fae8305..075ff3a 100644 --- a/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php +++ b/src/TwoFactorAuth/Models/TwoFactorVerifyRequestSchema.php @@ -19,13 +19,6 @@ class TwoFactorVerifyRequestSchema implements \JsonSerializable */ public $to; - /** - * The application phone number, the sender of the 2fa code. - * @required - * @var string $from public property - */ - public $from; - /** * The application unique ID, obtained from Bandwidth. * @required @@ -40,13 +33,6 @@ class TwoFactorVerifyRequestSchema implements \JsonSerializable */ public $scope; - /** - * The number of digits for your 2fa code. The valid number ranges from 2 to 8, inclusively. - * @required - * @var double $digits public property - */ - public $digits; - /** * The time period, in minutes, to validate the 2fa code. By setting this to 3 minutes, it will mean * any code generated within the last 3 minutes are still valid. The valid range for expiration time @@ -68,14 +54,12 @@ class TwoFactorVerifyRequestSchema implements \JsonSerializable */ public function __construct() { - if (7 == func_num_args()) { + if (5 == func_num_args()) { $this->to = func_get_arg(0); - $this->from = func_get_arg(1); - $this->applicationId = func_get_arg(2); - $this->scope = func_get_arg(3); - $this->digits = func_get_arg(4); - $this->expirationTimeInMinutes = func_get_arg(5); - $this->code = func_get_arg(6); + $this->applicationId = func_get_arg(1); + $this->scope = func_get_arg(2); + $this->expirationTimeInMinutes = func_get_arg(3); + $this->code = func_get_arg(4); } } @@ -86,10 +70,8 @@ public function jsonSerialize() { $json = array(); $json['to'] = $this->to; - $json['from'] = $this->from; $json['applicationId'] = $this->applicationId; $json['scope'] = $this->scope; - $json['digits'] = $this->digits; $json['expirationTimeInMinutes'] = $this->expirationTimeInMinutes; $json['code'] = $this->code; diff --git a/src/Voice/Controllers/APIController.php b/src/Voice/Controllers/APIController.php index a8a5ff9..6628b82 100644 --- a/src/Voice/Controllers/APIController.php +++ b/src/Voice/Controllers/APIController.php @@ -1650,9 +1650,9 @@ public function getConferenceById( /** * Modify the conference state * - * @param string $accountId TODO: type description here - * @param string $conferenceId TODO: type description here - * @param Models\CallEngineModifyConferenceRequest $body (optional) TODO: type description here + * @param string $accountId TODO: type description here + * @param string $conferenceId TODO: type description here + * @param Models\ApiModifyConferenceRequest $body (optional) TODO: type description here * @return ApiResponse response from the API call * @throws APIException Thrown if API call fails */ diff --git a/src/Voice/Models/ApiCreateCallRequest.php b/src/Voice/Models/ApiCreateCallRequest.php index 1b5dc26..351ebbb 100644 --- a/src/Voice/Models/ApiCreateCallRequest.php +++ b/src/Voice/Models/ApiCreateCallRequest.php @@ -20,12 +20,20 @@ class ApiCreateCallRequest implements \JsonSerializable public $from; /** - * Format is E164 + * Format is E164 or SIP URI * @required * @var string $to public property */ public $to; + /** + * When calling a SIP URI, this will be sent as the 'User-To-User' header within the initial INVITE. An + * 'encoding' parameter must be specified as described in https://tools.ietf.org/html/rfc7433. This + * header cannot exceed 256 characters, including the encoding parameter. + * @var string|null $uui public property + */ + public $uui; + /** * @todo Write general description for this property * @var double|null $callTimeout public property @@ -129,25 +137,26 @@ class ApiCreateCallRequest implements \JsonSerializable */ public function __construct() { - if (18 == func_num_args()) { + if (19 == func_num_args()) { $this->from = func_get_arg(0); $this->to = func_get_arg(1); - $this->callTimeout = func_get_arg(2); - $this->callbackTimeout = func_get_arg(3); - $this->answerUrl = func_get_arg(4); - $this->answerFallbackUrl = func_get_arg(5); - $this->username = func_get_arg(6); - $this->password = func_get_arg(7); - $this->fallbackUsername = func_get_arg(8); - $this->fallbackPassword = func_get_arg(9); - $this->answerMethod = func_get_arg(10); - $this->answerFallbackMethod = func_get_arg(11); - $this->disconnectUrl = func_get_arg(12); - $this->disconnectMethod = func_get_arg(13); - $this->tag = func_get_arg(14); - $this->applicationId = func_get_arg(15); - $this->obfuscatedTo = func_get_arg(16); - $this->obfuscatedFrom = func_get_arg(17); + $this->uui = func_get_arg(2); + $this->callTimeout = func_get_arg(3); + $this->callbackTimeout = func_get_arg(4); + $this->answerUrl = func_get_arg(5); + $this->answerFallbackUrl = func_get_arg(6); + $this->username = func_get_arg(7); + $this->password = func_get_arg(8); + $this->fallbackUsername = func_get_arg(9); + $this->fallbackPassword = func_get_arg(10); + $this->answerMethod = func_get_arg(11); + $this->answerFallbackMethod = func_get_arg(12); + $this->disconnectUrl = func_get_arg(13); + $this->disconnectMethod = func_get_arg(14); + $this->tag = func_get_arg(15); + $this->applicationId = func_get_arg(16); + $this->obfuscatedTo = func_get_arg(17); + $this->obfuscatedFrom = func_get_arg(18); } } @@ -159,6 +168,7 @@ public function jsonSerialize() $json = array(); $json['from'] = $this->from; $json['to'] = $this->to; + $json['uui'] = $this->uui; $json['callTimeout'] = $this->callTimeout; $json['callbackTimeout'] = $this->callbackTimeout; $json['answerUrl'] = $this->answerUrl; diff --git a/src/Voice/Models/ApiModifyConferenceRequest.php b/src/Voice/Models/ApiModifyConferenceRequest.php new file mode 100644 index 0000000..18beba6 --- /dev/null +++ b/src/Voice/Models/ApiModifyConferenceRequest.php @@ -0,0 +1,105 @@ +status = func_get_arg(0); + $this->redirectUrl = func_get_arg(1); + $this->redirectFallbackUrl = func_get_arg(2); + $this->redirectMethod = func_get_arg(3); + $this->redirectFallbackMethod = func_get_arg(4); + $this->username = func_get_arg(5); + $this->password = func_get_arg(6); + $this->fallbackUsername = func_get_arg(7); + $this->fallbackPassword = func_get_arg(8); + } + } + + /** + * Encode this object to JSON + */ + public function jsonSerialize() + { + $json = array(); + $json['status'] = $this->status; + $json['redirectUrl'] = $this->redirectUrl; + $json['redirectFallbackUrl'] = $this->redirectFallbackUrl; + $json['redirectMethod'] = $this->redirectMethod; + $json['redirectFallbackMethod'] = $this->redirectFallbackMethod; + $json['username'] = $this->username; + $json['password'] = $this->password; + $json['fallbackUsername'] = $this->fallbackUsername; + $json['fallbackPassword'] = $this->fallbackPassword; + + return array_filter($json); + } +} diff --git a/src/Voice/Models/ModifyCallRecordingState.php b/src/Voice/Models/ModifyCallRecordingState.php index be4e782..8d3d58c 100644 --- a/src/Voice/Models/ModifyCallRecordingState.php +++ b/src/Voice/Models/ModifyCallRecordingState.php @@ -14,7 +14,8 @@ class ModifyCallRecordingState implements \JsonSerializable { /** * @todo Write general description for this property - * @var string|null $state public property + * @required + * @var string $state public property */ public $state; diff --git a/src/Voice/Models/StateEnum.php b/src/Voice/Models/StateEnum.php index 50c29e3..bf6ae75 100644 --- a/src/Voice/Models/StateEnum.php +++ b/src/Voice/Models/StateEnum.php @@ -15,15 +15,15 @@ class StateEnum /** * TODO: Write general description for this element */ - const DISCONNECTED = "disconnected"; + const DISCONNECTED = "DISCONNECTED"; /** * TODO: Write general description for this element */ - const ANSWERED = "answered"; + const ANSWERED = "ANSWERED"; /** * TODO: Write general description for this element */ - const INITIATED = "initiated"; + const INITIATED = "INITIATED"; }