From 7161f0b37375280a06ec33a1f552afea3d960c39 Mon Sep 17 00:00:00 2001 From: api-librarian Date: Mon, 24 Jun 2024 17:30:04 +0000 Subject: [PATCH 1/9] Travis update: Jun 2024 (Build 738) [skip ci] --- .openapi-generator/FILES | 24 ++-- docs/Model/WhatsApp.md | 5 +- ...atsAppDocument.md => WhatsAppComponent.md} | 6 +- .../{WhatsAppImage.md => WhatsAppLanguage.md} | 6 +- ...{WhatsAppAudio.md => WhatsAppParameter.md} | 5 +- docs/Model/WhatsAppTemplate.md | 11 ++ docs/Model/WhatsAppText.md | 10 -- lib/Model/WhatsApp.php | 118 +++--------------- ...WhatsAppText.php => WhatsAppComponent.php} | 70 +++++------ ...tsAppDocument.php => WhatsAppLanguage.php} | 70 +++++------ ...hatsAppImage.php => WhatsAppParameter.php} | 70 +++++------ ...WhatsAppAudio.php => WhatsAppTemplate.php} | 103 ++++++++++++--- ...TextTest.php => WhatsAppComponentTest.php} | 20 +-- ...umentTest.php => WhatsAppLanguageTest.php} | 20 +-- ...mageTest.php => WhatsAppParameterTest.php} | 20 +-- ...AudioTest.php => WhatsAppTemplateTest.php} | 34 +++-- test/Model/WhatsAppTest.php | 31 +---- 17 files changed, 293 insertions(+), 330 deletions(-) rename docs/Model/{WhatsAppDocument.md => WhatsAppComponent.md} (54%) rename docs/Model/{WhatsAppImage.md => WhatsAppLanguage.md} (64%) rename docs/Model/{WhatsAppAudio.md => WhatsAppParameter.md} (68%) create mode 100644 docs/Model/WhatsAppTemplate.md delete mode 100644 docs/Model/WhatsAppText.md rename lib/Model/{WhatsAppText.php => WhatsAppComponent.php} (82%) rename lib/Model/{WhatsAppDocument.php => WhatsAppLanguage.php} (84%) rename lib/Model/{WhatsAppImage.php => WhatsAppParameter.php} (83%) rename lib/Model/{WhatsAppAudio.php => WhatsAppTemplate.php} (73%) rename test/Model/{WhatsAppTextTest.php => WhatsAppComponentTest.php} (84%) rename test/Model/{WhatsAppDocumentTest.php => WhatsAppLanguageTest.php} (84%) rename test/Model/{WhatsAppImageTest.php => WhatsAppParameterTest.php} (84%) rename test/Model/{WhatsAppAudioTest.php => WhatsAppTemplateTest.php} (74%) diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 274bcd7..7710712 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -57,10 +57,10 @@ docs/Model/Telegram.md docs/Model/TextStore.md docs/Model/Viber.md docs/Model/WhatsApp.md -docs/Model/WhatsAppAudio.md -docs/Model/WhatsAppDocument.md -docs/Model/WhatsAppImage.md -docs/Model/WhatsAppText.md +docs/Model/WhatsAppComponent.md +docs/Model/WhatsAppLanguage.md +docs/Model/WhatsAppParameter.md +docs/Model/WhatsAppTemplate.md git_push.sh lib/Api/BlacklistApi.php lib/Api/ContactsApi.php @@ -119,10 +119,10 @@ lib/Model/Telegram.php lib/Model/TextStore.php lib/Model/Viber.php lib/Model/WhatsApp.php -lib/Model/WhatsAppAudio.php -lib/Model/WhatsAppDocument.php -lib/Model/WhatsAppImage.php -lib/Model/WhatsAppText.php +lib/Model/WhatsAppComponent.php +lib/Model/WhatsAppLanguage.php +lib/Model/WhatsAppParameter.php +lib/Model/WhatsAppTemplate.php lib/ObjectSerializer.php phpunit.xml.dist test/Api/BlacklistApiTest.php @@ -177,8 +177,8 @@ test/Model/SyncNumberLookupSuccessTest.php test/Model/TelegramTest.php test/Model/TextStoreTest.php test/Model/ViberTest.php -test/Model/WhatsAppAudioTest.php -test/Model/WhatsAppDocumentTest.php -test/Model/WhatsAppImageTest.php +test/Model/WhatsAppComponentTest.php +test/Model/WhatsAppLanguageTest.php +test/Model/WhatsAppParameterTest.php +test/Model/WhatsAppTemplateTest.php test/Model/WhatsAppTest.php -test/Model/WhatsAppTextTest.php diff --git a/docs/Model/WhatsApp.md b/docs/Model/WhatsApp.md index 95aab88..ae5bbdd 100644 --- a/docs/Model/WhatsApp.md +++ b/docs/Model/WhatsApp.md @@ -7,10 +7,7 @@ Name | Type | Description | Notes **sender** | **string** | Phone number or alphanumeric sender name | [optional] **validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] **ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**text** | [**\Messente\Api\Model\WhatsAppText**](WhatsAppText.md) | | [optional] -**image** | [**\Messente\Api\Model\WhatsAppImage**](WhatsAppImage.md) | | [optional] -**document** | [**\Messente\Api\Model\WhatsAppDocument**](WhatsAppDocument.md) | | [optional] -**audio** | [**\Messente\Api\Model\WhatsAppAudio**](WhatsAppAudio.md) | | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] **channel** | **string** | The channel used to deliver the message | [optional] [default to 'whatsapp'] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppDocument.md b/docs/Model/WhatsAppComponent.md similarity index 54% rename from docs/Model/WhatsAppDocument.md rename to docs/Model/WhatsAppComponent.md index 1183cd3..2a99c2d 100644 --- a/docs/Model/WhatsAppDocument.md +++ b/docs/Model/WhatsAppComponent.md @@ -1,10 +1,10 @@ -# # WhatsAppDocument +# # WhatsAppComponent ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**caption** | **string** | Description for the document | [optional] -**content** | **string** | Base64-encoded image | +**type** | **string** | Type of the component | +**parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppImage.md b/docs/Model/WhatsAppLanguage.md similarity index 64% rename from docs/Model/WhatsAppImage.md rename to docs/Model/WhatsAppLanguage.md index fff678f..d202598 100644 --- a/docs/Model/WhatsAppImage.md +++ b/docs/Model/WhatsAppLanguage.md @@ -1,10 +1,10 @@ -# # WhatsAppImage +# # WhatsAppLanguage ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**caption** | **string** | Description for the image | [optional] -**content** | **string** | Base64-encoded image | +**code** | **string** | Language code | +**policy** | **string** | Language policy | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppAudio.md b/docs/Model/WhatsAppParameter.md similarity index 68% rename from docs/Model/WhatsAppAudio.md rename to docs/Model/WhatsAppParameter.md index ff0e201..f8334a9 100644 --- a/docs/Model/WhatsAppAudio.md +++ b/docs/Model/WhatsAppParameter.md @@ -1,9 +1,10 @@ -# # WhatsAppAudio +# # WhatsAppParameter ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | **string** | Base64-encoded audio | +**type** | **string** | Type of the parameter | +**text** | **string** | A text | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppTemplate.md b/docs/Model/WhatsAppTemplate.md new file mode 100644 index 0000000..a63f2a3 --- /dev/null +++ b/docs/Model/WhatsAppTemplate.md @@ -0,0 +1,11 @@ +# # WhatsAppTemplate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the template | +**language** | [**\Messente\Api\Model\WhatsAppLanguage**](WhatsAppLanguage.md) | | +**components** | [**\Messente\Api\Model\WhatsAppComponent[]**](WhatsAppComponent.md) | List of template components | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppText.md b/docs/Model/WhatsAppText.md deleted file mode 100644 index 5a801c0..0000000 --- a/docs/Model/WhatsAppText.md +++ /dev/null @@ -1,10 +0,0 @@ -# # WhatsAppText - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**previewUrl** | **bool** | Whether to display link preview if the message contains a hyperlink | [optional] [default to true] -**body** | **string** | Plaintext content for WhatsApp, can contain URLs, emojis and formatting | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php index d55da7a..7524052 100644 --- a/lib/Model/WhatsApp.php +++ b/lib/Model/WhatsApp.php @@ -64,10 +64,7 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => 'string', 'validity' => 'int', 'ttl' => 'int', - 'text' => '\Messente\Api\Model\WhatsAppText', - 'image' => '\Messente\Api\Model\WhatsAppImage', - 'document' => '\Messente\Api\Model\WhatsAppDocument', - 'audio' => '\Messente\Api\Model\WhatsAppAudio', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', 'channel' => 'string' ]; @@ -82,10 +79,7 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null, 'validity' => null, 'ttl' => null, - 'text' => null, - 'image' => null, - 'document' => null, - 'audio' => null, + 'template' => null, 'channel' => null ]; @@ -119,10 +113,7 @@ public static function openAPIFormats() 'sender' => 'sender', 'validity' => 'validity', 'ttl' => 'ttl', - 'text' => 'text', - 'image' => 'image', - 'document' => 'document', - 'audio' => 'audio', + 'template' => 'template', 'channel' => 'channel' ]; @@ -135,10 +126,7 @@ public static function openAPIFormats() 'sender' => 'setSender', 'validity' => 'setValidity', 'ttl' => 'setTtl', - 'text' => 'setText', - 'image' => 'setImage', - 'document' => 'setDocument', - 'audio' => 'setAudio', + 'template' => 'setTemplate', 'channel' => 'setChannel' ]; @@ -151,10 +139,7 @@ public static function openAPIFormats() 'sender' => 'getSender', 'validity' => 'getValidity', 'ttl' => 'getTtl', - 'text' => 'getText', - 'image' => 'getImage', - 'document' => 'getDocument', - 'audio' => 'getAudio', + 'template' => 'getTemplate', 'channel' => 'getChannel' ]; @@ -231,10 +216,7 @@ public function __construct(array $data = null) $this->container['sender'] = $data['sender'] ?? null; $this->container['validity'] = $data['validity'] ?? null; $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['image'] = $data['image'] ?? null; - $this->container['document'] = $data['document'] ?? null; - $this->container['audio'] = $data['audio'] ?? null; + $this->container['template'] = $data['template'] ?? null; $this->container['channel'] = $data['channel'] ?? 'whatsapp'; } @@ -344,97 +326,25 @@ public function setTtl($ttl) } /** - * Gets text + * Gets template * - * @return \Messente\Api\Model\WhatsAppText|null + * @return \Messente\Api\Model\WhatsAppTemplate|null */ - public function getText() + public function getTemplate() { - return $this->container['text']; + return $this->container['template']; } /** - * Sets text + * Sets template * - * @param \Messente\Api\Model\WhatsAppText|null $text text + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template * * @return self */ - public function setText($text) + public function setTemplate($template) { - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets image - * - * @return \Messente\Api\Model\WhatsAppImage|null - */ - public function getImage() - { - return $this->container['image']; - } - - /** - * Sets image - * - * @param \Messente\Api\Model\WhatsAppImage|null $image image - * - * @return self - */ - public function setImage($image) - { - $this->container['image'] = $image; - - return $this; - } - - /** - * Gets document - * - * @return \Messente\Api\Model\WhatsAppDocument|null - */ - public function getDocument() - { - return $this->container['document']; - } - - /** - * Sets document - * - * @param \Messente\Api\Model\WhatsAppDocument|null $document document - * - * @return self - */ - public function setDocument($document) - { - $this->container['document'] = $document; - - return $this; - } - - /** - * Gets audio - * - * @return \Messente\Api\Model\WhatsAppAudio|null - */ - public function getAudio() - { - return $this->container['audio']; - } - - /** - * Sets audio - * - * @param \Messente\Api\Model\WhatsAppAudio|null $audio audio - * - * @return self - */ - public function setAudio($audio) - { - $this->container['audio'] = $audio; + $this->container['template'] = $template; return $this; } diff --git a/lib/Model/WhatsAppText.php b/lib/Model/WhatsAppComponent.php similarity index 82% rename from lib/Model/WhatsAppText.php rename to lib/Model/WhatsAppComponent.php index c3f257b..2a3b702 100644 --- a/lib/Model/WhatsAppText.php +++ b/lib/Model/WhatsAppComponent.php @@ -1,6 +1,6 @@ 'bool', - 'body' => 'string' + 'type' => 'string', + 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' ]; /** @@ -73,8 +73,8 @@ class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'previewUrl' => null, - 'body' => null + 'type' => null, + 'parameters' => null ]; /** @@ -104,8 +104,8 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'previewUrl' => 'preview_url', - 'body' => 'body' + 'type' => 'type', + 'parameters' => 'parameters' ]; /** @@ -114,8 +114,8 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'previewUrl' => 'setPreviewUrl', - 'body' => 'setBody' + 'type' => 'setType', + 'parameters' => 'setParameters' ]; /** @@ -124,8 +124,8 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'previewUrl' => 'getPreviewUrl', - 'body' => 'getBody' + 'type' => 'getType', + 'parameters' => 'getParameters' ]; /** @@ -185,8 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['previewUrl'] = $data['previewUrl'] ?? true; - $this->container['body'] = $data['body'] ?? null; + $this->container['type'] = $data['type'] ?? null; + $this->container['parameters'] = $data['parameters'] ?? null; } /** @@ -198,8 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['body'] === null) { - $invalidProperties[] = "'body' can't be null"; + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; } return $invalidProperties; } @@ -217,49 +217,49 @@ public function valid() /** - * Gets previewUrl + * Gets type * - * @return bool|null + * @return string */ - public function getPreviewUrl() + public function getType() { - return $this->container['previewUrl']; + return $this->container['type']; } /** - * Sets previewUrl + * Sets type * - * @param bool|null $previewUrl Whether to display link preview if the message contains a hyperlink + * @param string $type Type of the component * * @return self */ - public function setPreviewUrl($previewUrl) + public function setType($type) { - $this->container['previewUrl'] = $previewUrl; + $this->container['type'] = $type; return $this; } /** - * Gets body + * Gets parameters * - * @return string + * @return \Messente\Api\Model\WhatsAppParameter[]|null */ - public function getBody() + public function getParameters() { - return $this->container['body']; + return $this->container['parameters']; } /** - * Sets body + * Sets parameters * - * @param string $body Plaintext content for WhatsApp, can contain URLs, emojis and formatting + * @param \Messente\Api\Model\WhatsAppParameter[]|null $parameters List of parameters for the component * * @return self */ - public function setBody($body) + public function setParameters($parameters) { - $this->container['body'] = $body; + $this->container['parameters'] = $parameters; return $this; } diff --git a/lib/Model/WhatsAppDocument.php b/lib/Model/WhatsAppLanguage.php similarity index 84% rename from lib/Model/WhatsAppDocument.php rename to lib/Model/WhatsAppLanguage.php index fe15f48..1ab9b7b 100644 --- a/lib/Model/WhatsAppDocument.php +++ b/lib/Model/WhatsAppLanguage.php @@ -1,6 +1,6 @@ 'string', - 'content' => 'string' + 'code' => 'string', + 'policy' => 'string' ]; /** @@ -73,8 +73,8 @@ class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'caption' => null, - 'content' => null + 'code' => null, + 'policy' => null ]; /** @@ -104,8 +104,8 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'caption' => 'caption', - 'content' => 'content' + 'code' => 'code', + 'policy' => 'policy' ]; /** @@ -114,8 +114,8 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'caption' => 'setCaption', - 'content' => 'setContent' + 'code' => 'setCode', + 'policy' => 'setPolicy' ]; /** @@ -124,8 +124,8 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'caption' => 'getCaption', - 'content' => 'getContent' + 'code' => 'getCode', + 'policy' => 'getPolicy' ]; /** @@ -185,8 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['caption'] = $data['caption'] ?? null; - $this->container['content'] = $data['content'] ?? null; + $this->container['code'] = $data['code'] ?? null; + $this->container['policy'] = $data['policy'] ?? null; } /** @@ -198,8 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; } return $invalidProperties; } @@ -217,49 +217,49 @@ public function valid() /** - * Gets caption + * Gets code * - * @return string|null + * @return string */ - public function getCaption() + public function getCode() { - return $this->container['caption']; + return $this->container['code']; } /** - * Sets caption + * Sets code * - * @param string|null $caption Description for the document + * @param string $code Language code * * @return self */ - public function setCaption($caption) + public function setCode($code) { - $this->container['caption'] = $caption; + $this->container['code'] = $code; return $this; } /** - * Gets content + * Gets policy * - * @return string + * @return string|null */ - public function getContent() + public function getPolicy() { - return $this->container['content']; + return $this->container['policy']; } /** - * Sets content + * Sets policy * - * @param string $content Base64-encoded image + * @param string|null $policy Language policy * * @return self */ - public function setContent($content) + public function setPolicy($policy) { - $this->container['content'] = $content; + $this->container['policy'] = $policy; return $this; } diff --git a/lib/Model/WhatsAppImage.php b/lib/Model/WhatsAppParameter.php similarity index 83% rename from lib/Model/WhatsAppImage.php rename to lib/Model/WhatsAppParameter.php index 3e6545b..5aa6695 100644 --- a/lib/Model/WhatsAppImage.php +++ b/lib/Model/WhatsAppParameter.php @@ -1,6 +1,6 @@ 'string', - 'content' => 'string' + 'type' => 'string', + 'text' => 'string' ]; /** @@ -73,8 +73,8 @@ class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'caption' => null, - 'content' => null + 'type' => null, + 'text' => null ]; /** @@ -104,8 +104,8 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'caption' => 'caption', - 'content' => 'content' + 'type' => 'type', + 'text' => 'text' ]; /** @@ -114,8 +114,8 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'caption' => 'setCaption', - 'content' => 'setContent' + 'type' => 'setType', + 'text' => 'setText' ]; /** @@ -124,8 +124,8 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'caption' => 'getCaption', - 'content' => 'getContent' + 'type' => 'getType', + 'text' => 'getText' ]; /** @@ -185,8 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['caption'] = $data['caption'] ?? null; - $this->container['content'] = $data['content'] ?? null; + $this->container['type'] = $data['type'] ?? null; + $this->container['text'] = $data['text'] ?? null; } /** @@ -198,8 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; } return $invalidProperties; } @@ -217,49 +217,49 @@ public function valid() /** - * Gets caption + * Gets type * - * @return string|null + * @return string */ - public function getCaption() + public function getType() { - return $this->container['caption']; + return $this->container['type']; } /** - * Sets caption + * Sets type * - * @param string|null $caption Description for the image + * @param string $type Type of the parameter * * @return self */ - public function setCaption($caption) + public function setType($type) { - $this->container['caption'] = $caption; + $this->container['type'] = $type; return $this; } /** - * Gets content + * Gets text * - * @return string + * @return string|null */ - public function getContent() + public function getText() { - return $this->container['content']; + return $this->container['text']; } /** - * Sets content + * Sets text * - * @param string $content Base64-encoded image + * @param string|null $text A text * * @return self */ - public function setContent($content) + public function setText($text) { - $this->container['content'] = $content; + $this->container['text'] = $text; return $this; } diff --git a/lib/Model/WhatsAppAudio.php b/lib/Model/WhatsAppTemplate.php similarity index 73% rename from lib/Model/WhatsAppAudio.php rename to lib/Model/WhatsAppTemplate.php index eb67bc9..1fc96e0 100644 --- a/lib/Model/WhatsAppAudio.php +++ b/lib/Model/WhatsAppTemplate.php @@ -1,6 +1,6 @@ 'string' + 'name' => 'string', + 'language' => '\Messente\Api\Model\WhatsAppLanguage', + 'components' => '\Messente\Api\Model\WhatsAppComponent[]' ]; /** @@ -72,7 +74,9 @@ class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'content' => null + 'name' => null, + 'language' => null, + 'components' => null ]; /** @@ -102,7 +106,9 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'content' => 'content' + 'name' => 'name', + 'language' => 'language', + 'components' => 'components' ]; /** @@ -111,7 +117,9 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'content' => 'setContent' + 'name' => 'setName', + 'language' => 'setLanguage', + 'components' => 'setComponents' ]; /** @@ -120,7 +128,9 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'content' => 'getContent' + 'name' => 'getName', + 'language' => 'getLanguage', + 'components' => 'getComponents' ]; /** @@ -180,7 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['content'] = $data['content'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['language'] = $data['language'] ?? null; + $this->container['components'] = $data['components'] ?? null; } /** @@ -192,8 +204,11 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; } return $invalidProperties; } @@ -211,25 +226,73 @@ public function valid() /** - * Gets content + * Gets name * * @return string */ - public function getContent() + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the template + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets language + * + * @return \Messente\Api\Model\WhatsAppLanguage + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Messente\Api\Model\WhatsAppLanguage $language language + * + * @return self + */ + public function setLanguage($language) + { + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets components + * + * @return \Messente\Api\Model\WhatsAppComponent[]|null + */ + public function getComponents() { - return $this->container['content']; + return $this->container['components']; } /** - * Sets content + * Sets components * - * @param string $content Base64-encoded audio + * @param \Messente\Api\Model\WhatsAppComponent[]|null $components List of template components * * @return self */ - public function setContent($content) + public function setComponents($components) { - $this->container['content'] = $content; + $this->container['components'] = $components; return $this; } diff --git a/test/Model/WhatsAppTextTest.php b/test/Model/WhatsAppComponentTest.php similarity index 84% rename from test/Model/WhatsAppTextTest.php rename to test/Model/WhatsAppComponentTest.php index a3b7035..6edcac6 100644 --- a/test/Model/WhatsAppTextTest.php +++ b/test/Model/WhatsAppComponentTest.php @@ -1,6 +1,6 @@ markTestIncomplete('Not implemented'); } /** - * Test attribute "previewUrl" + * Test attribute "type" */ - public function testPropertyPreviewUrl() + public function testPropertyType() { // TODO: implement $this->markTestIncomplete('Not implemented'); } /** - * Test attribute "body" + * Test attribute "parameters" */ - public function testPropertyBody() + public function testPropertyParameters() { // TODO: implement $this->markTestIncomplete('Not implemented'); diff --git a/test/Model/WhatsAppDocumentTest.php b/test/Model/WhatsAppLanguageTest.php similarity index 84% rename from test/Model/WhatsAppDocumentTest.php rename to test/Model/WhatsAppLanguageTest.php index 022c0fa..d3836c5 100644 --- a/test/Model/WhatsAppDocumentTest.php +++ b/test/Model/WhatsAppLanguageTest.php @@ -1,6 +1,6 @@ markTestIncomplete('Not implemented'); } /** - * Test attribute "caption" + * Test attribute "code" */ - public function testPropertyCaption() + public function testPropertyCode() { // TODO: implement $this->markTestIncomplete('Not implemented'); } /** - * Test attribute "content" + * Test attribute "policy" */ - public function testPropertyContent() + public function testPropertyPolicy() { // TODO: implement $this->markTestIncomplete('Not implemented'); diff --git a/test/Model/WhatsAppImageTest.php b/test/Model/WhatsAppParameterTest.php similarity index 84% rename from test/Model/WhatsAppImageTest.php rename to test/Model/WhatsAppParameterTest.php index e9d384f..5cf2857 100644 --- a/test/Model/WhatsAppImageTest.php +++ b/test/Model/WhatsAppParameterTest.php @@ -1,6 +1,6 @@ markTestIncomplete('Not implemented'); } /** - * Test attribute "caption" + * Test attribute "type" */ - public function testPropertyCaption() + public function testPropertyType() { // TODO: implement $this->markTestIncomplete('Not implemented'); } /** - * Test attribute "content" + * Test attribute "text" */ - public function testPropertyContent() + public function testPropertyText() { // TODO: implement $this->markTestIncomplete('Not implemented'); diff --git a/test/Model/WhatsAppAudioTest.php b/test/Model/WhatsAppTemplateTest.php similarity index 74% rename from test/Model/WhatsAppAudioTest.php rename to test/Model/WhatsAppTemplateTest.php index 9d4fec7..6ecae7f 100644 --- a/test/Model/WhatsAppAudioTest.php +++ b/test/Model/WhatsAppTemplateTest.php @@ -1,6 +1,6 @@ markTestIncomplete('Not implemented'); } /** - * Test attribute "content" + * Test attribute "name" */ - public function testPropertyContent() + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "language" + */ + public function testPropertyLanguage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "components" + */ + public function testPropertyComponents() { // TODO: implement $this->markTestIncomplete('Not implemented'); diff --git a/test/Model/WhatsAppTest.php b/test/Model/WhatsAppTest.php index 115ec5c..4913f76 100644 --- a/test/Model/WhatsAppTest.php +++ b/test/Model/WhatsAppTest.php @@ -108,36 +108,9 @@ public function testPropertyTtl() } /** - * Test attribute "text" + * Test attribute "template" */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "image" - */ - public function testPropertyImage() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "document" - */ - public function testPropertyDocument() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "audio" - */ - public function testPropertyAudio() + public function testPropertyTemplate() { // TODO: implement $this->markTestIncomplete('Not implemented'); From a27589556e52858bff0547e00af6e9e2054311bb Mon Sep 17 00:00:00 2001 From: api-librarian Date: Fri, 28 Jun 2024 17:30:58 +0000 Subject: [PATCH 2/9] Travis update: Jun 2024 (Build 744) [skip ci] --- .gitignore | 1 + .openapi-generator/FILES | 61 +- .openapi-generator/VERSION | 2 +- .php-cs-fixer.dist.php | 29 + .php_cs | 23 - .travis.yml | 1 - README.md | 34 +- composer.json | 6 +- docs/Api/BlacklistApi.md | 32 +- docs/Api/ContactsApi.md | 76 +- docs/Api/DeliveryReportApi.md | 14 +- docs/Api/GroupsApi.md | 42 +- docs/Api/NumberLookupApi.md | 14 +- docs/Api/OmnimessageApi.md | 22 +- docs/Api/StatisticsApi.md | 14 +- docs/Model/Omnimessage.md | 2 +- docs/Model/OmnimessageMessagesInner.md | 21 + docs/Model/WhatsAppComponent.md | 2 + docs/Model/WhatsAppParameter.md | 5 + lib/Api/BlacklistApi.php | 317 +++-- lib/Api/ContactsApi.php | 1049 +++++++++++++---- lib/Api/DeliveryReportApi.php | 133 ++- lib/Api/GroupsApi.php | 617 +++++++--- lib/Api/NumberLookupApi.php | 153 ++- lib/Api/OmnimessageApi.php | 261 +++- lib/Api/StatisticsApi.php | 168 ++- lib/ApiException.php | 5 +- lib/Configuration.php | 81 +- lib/HeaderSelector.php | 209 +++- lib/Model/Channel.php | 12 +- lib/Model/ContactEnvelope.php | 107 +- lib/Model/ContactFields.php | 224 +++- lib/Model/ContactListEnvelope.php | 107 +- lib/Model/ContactResponseFields.php | 237 +++- lib/Model/ContactUpdateFields.php | 218 +++- lib/Model/DeliveryReportResponse.php | 119 +- lib/Model/DeliveryResult.php | 144 ++- lib/Model/ErrorCodeOmnichannel.php | 18 +- lib/Model/ErrorCodeOmnichannelMachine.php | 28 +- lib/Model/ErrorCodePhonebook.php | 16 +- lib/Model/ErrorCodeStatistics.php | 12 +- lib/Model/ErrorItemNumberLookup.php | 107 +- lib/Model/ErrorItemNumberLookupError.php | 113 +- lib/Model/ErrorItemOmnichannel.php | 132 ++- lib/Model/ErrorItemPhonebook.php | 119 +- lib/Model/ErrorItemStatistics.php | 119 +- lib/Model/ErrorNumberLookup.php | 107 +- lib/Model/ErrorOmnichannel.php | 107 +- lib/Model/ErrorPhonebook.php | 107 +- lib/Model/ErrorStatistics.php | 107 +- lib/Model/ErrorTitleOmnichannel.php | 18 +- lib/Model/ErrorTitlePhonebook.php | 16 +- lib/Model/FetchBlacklistSuccess.php | 107 +- lib/Model/GroupEnvelope.php | 107 +- lib/Model/GroupListEnvelope.php | 107 +- lib/Model/GroupName.php | 107 +- lib/Model/GroupResponseFields.php | 132 ++- lib/Model/MessageResult.php | 119 +- lib/Model/MobileNetwork.php | 131 +- lib/Model/ModelInterface.php | 20 +- lib/Model/NumberToBlacklist.php | 107 +- lib/Model/NumbersToInvestigate.php | 107 +- .../OmniMessageCreateSuccessResponse.php | 119 +- lib/Model/Omnimessage.php | 143 ++- lib/Model/OmnimessageMessagesInner.php | 889 ++++++++++++++ lib/Model/Priority.php | 10 +- lib/Model/SMS.php | 155 ++- lib/Model/StatisticsReport.php | 119 +- lib/Model/StatisticsReportSettings.php | 119 +- lib/Model/StatisticsReportSuccess.php | 107 +- lib/Model/Status.php | 26 +- lib/Model/SyncNumberLookupResult.php | 214 +++- lib/Model/SyncNumberLookupSuccess.php | 113 +- lib/Model/Telegram.php | 147 ++- lib/Model/TextStore.php | 10 +- lib/Model/Viber.php | 153 ++- lib/Model/WhatsApp.php | 135 ++- lib/Model/WhatsAppComponent.php | 181 ++- lib/Model/WhatsAppLanguage.php | 113 +- lib/Model/WhatsAppParameter.php | 293 ++++- lib/Model/WhatsAppTemplate.php | 119 +- lib/ObjectSerializer.php | 285 ++++- test/Api/BlacklistApiTest.php | 122 -- test/Api/ContactsApiTest.php | 170 --- test/Api/DeliveryReportApiTest.php | 86 -- test/Api/GroupsApiTest.php | 134 --- test/Api/NumberLookupApiTest.php | 86 -- test/Api/OmnimessageApiTest.php | 98 -- test/Api/StatisticsApiTest.php | 86 -- test/Model/ChannelTest.php | 82 -- test/Model/ContactEnvelopeTest.php | 91 -- test/Model/ContactFieldsTest.php | 172 --- test/Model/ContactListEnvelopeTest.php | 91 -- test/Model/ContactResponseFieldsTest.php | 181 --- test/Model/ContactUpdateFieldsTest.php | 163 --- test/Model/DeliveryReportResponseTest.php | 109 -- test/Model/DeliveryResultTest.php | 136 --- .../Model/ErrorCodeOmnichannelMachineTest.php | 82 -- test/Model/ErrorCodeOmnichannelTest.php | 82 -- test/Model/ErrorCodePhonebookTest.php | 82 -- test/Model/ErrorCodeStatisticsTest.php | 82 -- test/Model/ErrorItemNumberLookupErrorTest.php | 100 -- test/Model/ErrorItemNumberLookupTest.php | 91 -- test/Model/ErrorItemOmnichannelTest.php | 118 -- test/Model/ErrorItemPhonebookTest.php | 109 -- test/Model/ErrorItemStatisticsTest.php | 109 -- test/Model/ErrorNumberLookupTest.php | 91 -- test/Model/ErrorOmnichannelTest.php | 91 -- test/Model/ErrorPhonebookTest.php | 91 -- test/Model/ErrorStatisticsTest.php | 91 -- test/Model/ErrorTitleOmnichannelTest.php | 82 -- test/Model/ErrorTitlePhonebookTest.php | 82 -- test/Model/FetchBlacklistSuccessTest.php | 91 -- test/Model/GroupEnvelopeTest.php | 91 -- test/Model/GroupListEnvelopeTest.php | 91 -- test/Model/GroupNameTest.php | 91 -- test/Model/GroupResponseFieldsTest.php | 118 -- test/Model/MessageResultTest.php | 109 -- test/Model/MobileNetworkTest.php | 127 -- test/Model/NumberToBlacklistTest.php | 91 -- test/Model/NumbersToInvestigateTest.php | 91 -- .../OmniMessageCreateSuccessResponseTest.php | 109 -- test/Model/OmnimessageTest.php | 136 --- test/Model/PriorityTest.php | 82 -- test/Model/SMSTest.php | 145 --- test/Model/StatisticsReportSettingsTest.php | 109 -- test/Model/StatisticsReportSuccessTest.php | 91 -- test/Model/StatisticsReportTest.php | 109 -- test/Model/StatusTest.php | 82 -- test/Model/SyncNumberLookupResultTest.php | 163 --- test/Model/SyncNumberLookupSuccessTest.php | 100 -- test/Model/TelegramTest.php | 145 --- test/Model/TextStoreTest.php | 82 -- test/Model/ViberTest.php | 154 --- test/Model/WhatsAppComponentTest.php | 100 -- test/Model/WhatsAppLanguageTest.php | 100 -- test/Model/WhatsAppParameterTest.php | 100 -- test/Model/WhatsAppTemplateTest.php | 109 -- test/Model/WhatsAppTest.php | 127 -- 139 files changed, 8673 insertions(+), 7642 deletions(-) create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .php_cs create mode 100644 docs/Model/OmnimessageMessagesInner.md create mode 100644 lib/Model/OmnimessageMessagesInner.php delete mode 100644 test/Api/BlacklistApiTest.php delete mode 100644 test/Api/ContactsApiTest.php delete mode 100644 test/Api/DeliveryReportApiTest.php delete mode 100644 test/Api/GroupsApiTest.php delete mode 100644 test/Api/NumberLookupApiTest.php delete mode 100644 test/Api/OmnimessageApiTest.php delete mode 100644 test/Api/StatisticsApiTest.php delete mode 100644 test/Model/ChannelTest.php delete mode 100644 test/Model/ContactEnvelopeTest.php delete mode 100644 test/Model/ContactFieldsTest.php delete mode 100644 test/Model/ContactListEnvelopeTest.php delete mode 100644 test/Model/ContactResponseFieldsTest.php delete mode 100644 test/Model/ContactUpdateFieldsTest.php delete mode 100644 test/Model/DeliveryReportResponseTest.php delete mode 100644 test/Model/DeliveryResultTest.php delete mode 100644 test/Model/ErrorCodeOmnichannelMachineTest.php delete mode 100644 test/Model/ErrorCodeOmnichannelTest.php delete mode 100644 test/Model/ErrorCodePhonebookTest.php delete mode 100644 test/Model/ErrorCodeStatisticsTest.php delete mode 100644 test/Model/ErrorItemNumberLookupErrorTest.php delete mode 100644 test/Model/ErrorItemNumberLookupTest.php delete mode 100644 test/Model/ErrorItemOmnichannelTest.php delete mode 100644 test/Model/ErrorItemPhonebookTest.php delete mode 100644 test/Model/ErrorItemStatisticsTest.php delete mode 100644 test/Model/ErrorNumberLookupTest.php delete mode 100644 test/Model/ErrorOmnichannelTest.php delete mode 100644 test/Model/ErrorPhonebookTest.php delete mode 100644 test/Model/ErrorStatisticsTest.php delete mode 100644 test/Model/ErrorTitleOmnichannelTest.php delete mode 100644 test/Model/ErrorTitlePhonebookTest.php delete mode 100644 test/Model/FetchBlacklistSuccessTest.php delete mode 100644 test/Model/GroupEnvelopeTest.php delete mode 100644 test/Model/GroupListEnvelopeTest.php delete mode 100644 test/Model/GroupNameTest.php delete mode 100644 test/Model/GroupResponseFieldsTest.php delete mode 100644 test/Model/MessageResultTest.php delete mode 100644 test/Model/MobileNetworkTest.php delete mode 100644 test/Model/NumberToBlacklistTest.php delete mode 100644 test/Model/NumbersToInvestigateTest.php delete mode 100644 test/Model/OmniMessageCreateSuccessResponseTest.php delete mode 100644 test/Model/OmnimessageTest.php delete mode 100644 test/Model/PriorityTest.php delete mode 100644 test/Model/SMSTest.php delete mode 100644 test/Model/StatisticsReportSettingsTest.php delete mode 100644 test/Model/StatisticsReportSuccessTest.php delete mode 100644 test/Model/StatisticsReportTest.php delete mode 100644 test/Model/StatusTest.php delete mode 100644 test/Model/SyncNumberLookupResultTest.php delete mode 100644 test/Model/SyncNumberLookupSuccessTest.php delete mode 100644 test/Model/TelegramTest.php delete mode 100644 test/Model/TextStoreTest.php delete mode 100644 test/Model/ViberTest.php delete mode 100644 test/Model/WhatsAppComponentTest.php delete mode 100644 test/Model/WhatsAppLanguageTest.php delete mode 100644 test/Model/WhatsAppParameterTest.php delete mode 100644 test/Model/WhatsAppTemplateTest.php delete mode 100644 test/Model/WhatsAppTest.php diff --git a/.gitignore b/.gitignore index 92f7fde..9f1681c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ composer.phar # php-cs-fixer cache .php_cs.cache +.php-cs-fixer.cache # PHPUnit cache .phpunit.result.cache diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 7710712..7105b0d 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,6 @@ .gitignore .openapi-generator-ignore -.php_cs +.php-cs-fixer.dist.php .travis.yml README.md composer.json @@ -45,6 +45,7 @@ docs/Model/NumberToBlacklist.md docs/Model/NumbersToInvestigate.md docs/Model/OmniMessageCreateSuccessResponse.md docs/Model/Omnimessage.md +docs/Model/OmnimessageMessagesInner.md docs/Model/Priority.md docs/Model/SMS.md docs/Model/StatisticsReport.md @@ -107,6 +108,7 @@ lib/Model/NumberToBlacklist.php lib/Model/NumbersToInvestigate.php lib/Model/OmniMessageCreateSuccessResponse.php lib/Model/Omnimessage.php +lib/Model/OmnimessageMessagesInner.php lib/Model/Priority.php lib/Model/SMS.php lib/Model/StatisticsReport.php @@ -125,60 +127,3 @@ lib/Model/WhatsAppParameter.php lib/Model/WhatsAppTemplate.php lib/ObjectSerializer.php phpunit.xml.dist -test/Api/BlacklistApiTest.php -test/Api/ContactsApiTest.php -test/Api/DeliveryReportApiTest.php -test/Api/GroupsApiTest.php -test/Api/NumberLookupApiTest.php -test/Api/OmnimessageApiTest.php -test/Api/StatisticsApiTest.php -test/Model/ChannelTest.php -test/Model/ContactEnvelopeTest.php -test/Model/ContactFieldsTest.php -test/Model/ContactListEnvelopeTest.php -test/Model/ContactResponseFieldsTest.php -test/Model/ContactUpdateFieldsTest.php -test/Model/DeliveryReportResponseTest.php -test/Model/DeliveryResultTest.php -test/Model/ErrorCodeOmnichannelMachineTest.php -test/Model/ErrorCodeOmnichannelTest.php -test/Model/ErrorCodePhonebookTest.php -test/Model/ErrorCodeStatisticsTest.php -test/Model/ErrorItemNumberLookupErrorTest.php -test/Model/ErrorItemNumberLookupTest.php -test/Model/ErrorItemOmnichannelTest.php -test/Model/ErrorItemPhonebookTest.php -test/Model/ErrorItemStatisticsTest.php -test/Model/ErrorNumberLookupTest.php -test/Model/ErrorOmnichannelTest.php -test/Model/ErrorPhonebookTest.php -test/Model/ErrorStatisticsTest.php -test/Model/ErrorTitleOmnichannelTest.php -test/Model/ErrorTitlePhonebookTest.php -test/Model/FetchBlacklistSuccessTest.php -test/Model/GroupEnvelopeTest.php -test/Model/GroupListEnvelopeTest.php -test/Model/GroupNameTest.php -test/Model/GroupResponseFieldsTest.php -test/Model/MessageResultTest.php -test/Model/MobileNetworkTest.php -test/Model/NumberToBlacklistTest.php -test/Model/NumbersToInvestigateTest.php -test/Model/OmniMessageCreateSuccessResponseTest.php -test/Model/OmnimessageTest.php -test/Model/PriorityTest.php -test/Model/SMSTest.php -test/Model/StatisticsReportSettingsTest.php -test/Model/StatisticsReportSuccessTest.php -test/Model/StatisticsReportTest.php -test/Model/StatusTest.php -test/Model/SyncNumberLookupResultTest.php -test/Model/SyncNumberLookupSuccessTest.php -test/Model/TelegramTest.php -test/Model/TextStoreTest.php -test/Model/ViberTest.php -test/Model/WhatsAppComponentTest.php -test/Model/WhatsAppLanguageTest.php -test/Model/WhatsAppParameterTest.php -test/Model/WhatsAppTemplateTest.php -test/Model/WhatsAppTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index e230c83..93c8dda 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -5.3.0 \ No newline at end of file +7.6.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 4fbe53e..0000000 --- a/.php_cs +++ /dev/null @@ -1,23 +0,0 @@ -setUsingCache(true) - ->setRules([ - '@PSR2' => true, - 'ordered_imports' => true, - 'phpdoc_order' => true, - 'array_syntax' => [ 'syntax' => 'short' ], - 'strict_comparison' => true, - 'strict_param' => true, - 'no_trailing_whitespace' => false, - 'no_trailing_whitespace_in_comment' => false, - 'braces' => false, - 'single_blank_line_at_eof' => false, - 'blank_line_after_namespace' => false, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude('test') - ->exclude('tests') - ->in(__DIR__) - ); diff --git a/.travis.yml b/.travis.yml index 714772e..667b815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: php # https://docs.travis-ci.com/user/reference/bionic/#php-support dist: bionic php: - - 7.3 - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/README.md b/README.md index 9611f74..3ad019b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Messente API Library - Messente API version: 2.0.0 -- PHP artifact version: 2.1.0 +- PHP artifact version: 3.0.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. @@ -73,13 +73,14 @@ Read the [external getting-started article](https://messente.com/documentation/g "Hello SMS!", "sender" => "MySmsSender"] ); - -$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]); +$whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; +$whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); +$whatsAppLanguage = new WhatsAppLanguage(['code' => '']); +$whatsAppTemplate = new WhatsAppTemplate( + [ + 'name'=> '', + 'language'=> $whatsAppLanguage, + 'components' => [$whatsAppComponent] + ] +); $whatsapp = new WhatsApp( - ['text' => $whatsAppText, "sender" => "MyWhatsAppSender"] + [ + 'sender' => '', + 'template' => $whatsAppTemplate, + ] ); $omnimessage->setMessages([$whatsapp, $viber, $sms]); diff --git a/composer.json b/composer.json index 5c1fe20..9985e13 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "messente/messente-api-php", - "version": "2.1.0", + "version": "3.0.0", "description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.", "keywords": ["viber", "telegram", "sms", "whatsapp", "phonebook", "openapitools", "openapi-generator", @@ -26,10 +26,6 @@ "guzzlehttp/guzzle": "^6.2 || ^7.0", "guzzlehttp/psr7": "^1.8" }, - "require-dev": { - "phpunit/phpunit": "^7.4", - "friendsofphp/php-cs-fixer": "^2.12" - }, "autoload": { "psr-4": { "Messente\\Api\\" : "lib/" } }, diff --git a/docs/Api/BlacklistApi.md b/docs/Api/BlacklistApi.md index 7bd8656..26c6414 100644 --- a/docs/Api/BlacklistApi.md +++ b/docs/Api/BlacklistApi.md @@ -1,13 +1,13 @@ # Messente\Api\BlacklistApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist -[**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist -[**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers -[**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist | +| [**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist | +| [**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers | +| [**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted | ## `addToBlacklist()` @@ -48,9 +48,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -223,9 +223,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md index 970e008..a99a3ad 100644 --- a/docs/Api/ContactsApi.md +++ b/docs/Api/ContactsApi.md @@ -1,17 +1,17 @@ # Messente\Api\ContactsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group -[**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact -[**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact -[**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact -[**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact -[**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts -[**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group -[**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group | +| [**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact | +| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact | +| [**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact | +| [**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact | +| [**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts | +| [**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group | +| [**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact | ## `addContactToGroup()` @@ -54,10 +54,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | ### Return type @@ -115,9 +115,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | | ### Return type @@ -174,9 +174,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -234,9 +234,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -294,9 +294,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -354,9 +354,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] | ### Return type @@ -414,10 +414,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | ### Return type @@ -476,10 +476,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | - **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | +| **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | | ### Return type diff --git a/docs/Api/DeliveryReportApi.md b/docs/Api/DeliveryReportApi.md index ef62c6f..622fe6f 100644 --- a/docs/Api/DeliveryReportApi.md +++ b/docs/Api/DeliveryReportApi.md @@ -1,10 +1,10 @@ # Messente\Api\DeliveryReportApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage | ## `retrieveDeliveryReport()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | | ### Return type diff --git a/docs/Api/GroupsApi.md b/docs/Api/GroupsApi.md index f511a0e..8ad8bb9 100644 --- a/docs/Api/GroupsApi.md +++ b/docs/Api/GroupsApi.md @@ -1,14 +1,14 @@ # Messente\Api\GroupsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name -[**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group -[**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group -[**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups -[**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name | +| [**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group | +| [**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group | +| [**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups | +| [**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name | ## `createGroup()` @@ -50,9 +50,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | ### Return type @@ -109,9 +109,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | ### Return type @@ -169,9 +169,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | ### Return type @@ -287,10 +287,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | ### Return type diff --git a/docs/Api/NumberLookupApi.md b/docs/Api/NumberLookupApi.md index c671dfe..01fa35c 100644 --- a/docs/Api/NumberLookupApi.md +++ b/docs/Api/NumberLookupApi.md @@ -1,10 +1,10 @@ # Messente\Api\NumberLookupApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers | ## `fetchInfo()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | | ### Return type diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md index c07dc9b..b4317da 100644 --- a/docs/Api/OmnimessageApi.md +++ b/docs/Api/OmnimessageApi.md @@ -1,11 +1,11 @@ # Messente\Api\OmnimessageApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage -[**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | +| [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | ## `cancelScheduledMessage()` @@ -47,9 +47,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | | ### Return type diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md index 4cfe438..be19360 100644 --- a/docs/Api/StatisticsApi.md +++ b/docs/Api/StatisticsApi.md @@ -1,10 +1,10 @@ # Messente\Api\StatisticsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country | ## `createStatisticsReport()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | | ### Return type diff --git a/docs/Model/Omnimessage.md b/docs/Model/Omnimessage.md index 9f218f0..b5d8079 100644 --- a/docs/Model/Omnimessage.md +++ b/docs/Model/Omnimessage.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **to** | **string** | Phone number in e.164 format | -**messages** | [**OneOfViberSMSWhatsAppTelegram[]**](OneOfViberSMSWhatsAppTelegram.md) | An array of messages | +**messages** | [**\Messente\Api\Model\OmnimessageMessagesInner[]**](OmnimessageMessagesInner.md) | An array of messages | **dlrUrl** | **string** | URL where the delivery report will be sent | [optional] **textStore** | [**\Messente\Api\Model\TextStore**](TextStore.md) | | [optional] **timeToSend** | **\DateTime** | Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) | [optional] diff --git a/docs/Model/OmnimessageMessagesInner.md b/docs/Model/OmnimessageMessagesInner.md new file mode 100644 index 0000000..fa0bdf7 --- /dev/null +++ b/docs/Model/OmnimessageMessagesInner.md @@ -0,0 +1,21 @@ +# # OmnimessageMessagesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**text** | **string** | Plaintext content for Telegram | +**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] +**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] +**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] +**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] +**udh** | **string** | hex-encoded string containing SMS UDH | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] +**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppComponent.md b/docs/Model/WhatsAppComponent.md index 2a99c2d..8e0104c 100644 --- a/docs/Model/WhatsAppComponent.md +++ b/docs/Model/WhatsAppComponent.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **string** | Type of the component | +**subType** | **string** | Sub-type of the component | [optional] +**index** | **int** | index used to position buttons | [optional] **parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppParameter.md b/docs/Model/WhatsAppParameter.md index f8334a9..a7b9a68 100644 --- a/docs/Model/WhatsAppParameter.md +++ b/docs/Model/WhatsAppParameter.md @@ -6,5 +6,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **string** | Type of the parameter | **text** | **string** | A text | [optional] +**currency** | **object** | A currency object | [optional] +**dateTime** | **object** | A date_time object | [optional] +**image** | **object** | A media object of type image | [optional] +**document** | **object** | A media object of type document | [optional] +**video** | **object** | A media object of type video | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/BlacklistApi.php b/lib/Api/BlacklistApi.php index dfa0ecd..bec68a5 100644 --- a/lib/Api/BlacklistApi.php +++ b/lib/Api/BlacklistApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'deleteFromBlacklist' => [ + 'application/json', + ], + 'fetchBlacklist' => [ + 'application/json', + ], + 'isBlacklisted' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +138,15 @@ public function getConfig() * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function addToBlacklist($numberToBlacklist) + public function addToBlacklist($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - $this->addToBlacklistWithHttpInfo($numberToBlacklist); + $this->addToBlacklistWithHttpInfo($numberToBlacklist, $contentType); } /** @@ -138,14 +155,15 @@ public function addToBlacklist($numberToBlacklist) * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function addToBlacklistWithHttpInfo($numberToBlacklist) + public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - $request = $this->addToBlacklistRequest($numberToBlacklist); + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); try { $options = $this->createHttpClientOption(); @@ -229,13 +247,14 @@ public function addToBlacklistWithHttpInfo($numberToBlacklist) * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsync($numberToBlacklist) + public function addToBlacklistAsync($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist) + return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist, $contentType) ->then( function ($response) { return $response[0]; @@ -249,14 +268,15 @@ function ($response) { * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist) + public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { $returnType = ''; - $request = $this->addToBlacklistRequest($numberToBlacklist); + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -285,12 +305,14 @@ function ($exception) { * Create request for operation 'addToBlacklist' * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addToBlacklistRequest($numberToBlacklist) + public function addToBlacklistRequest($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { + // verify the required parameter 'numberToBlacklist' is set if ($numberToBlacklist === null || (is_array($numberToBlacklist) && count($numberToBlacklist) === 0)) { throw new \InvalidArgumentException( @@ -298,6 +320,7 @@ public function addToBlacklistRequest($numberToBlacklist) ); } + $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -309,21 +332,17 @@ public function addToBlacklistRequest($numberToBlacklist) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($numberToBlacklist)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); } else { $httpBody = $numberToBlacklist; } @@ -342,12 +361,12 @@ public function addToBlacklistRequest($numberToBlacklist) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -367,10 +386,11 @@ public function addToBlacklistRequest($numberToBlacklist) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -382,14 +402,15 @@ public function addToBlacklistRequest($numberToBlacklist) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteFromBlacklist($phone) + public function deleteFromBlacklist($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - $this->deleteFromBlacklistWithHttpInfo($phone); + $this->deleteFromBlacklistWithHttpInfo($phone, $contentType); } /** @@ -398,14 +419,15 @@ public function deleteFromBlacklist($phone) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteFromBlacklistWithHttpInfo($phone) + public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - $request = $this->deleteFromBlacklistRequest($phone); + $request = $this->deleteFromBlacklistRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -489,13 +511,14 @@ public function deleteFromBlacklistWithHttpInfo($phone) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsync($phone) + public function deleteFromBlacklistAsync($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - return $this->deleteFromBlacklistAsyncWithHttpInfo($phone) + return $this->deleteFromBlacklistAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -509,14 +532,15 @@ function ($response) { * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsyncWithHttpInfo($phone) + public function deleteFromBlacklistAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { $returnType = ''; - $request = $this->deleteFromBlacklistRequest($phone); + $request = $this->deleteFromBlacklistRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -545,12 +569,14 @@ function ($exception) { * Create request for operation 'deleteFromBlacklist' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteFromBlacklistRequest($phone) + public function deleteFromBlacklistRequest($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -558,6 +584,7 @@ public function deleteFromBlacklistRequest($phone) ); } + $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -577,16 +604,11 @@ public function deleteFromBlacklistRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -604,12 +626,12 @@ public function deleteFromBlacklistRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -629,10 +651,11 @@ public function deleteFromBlacklistRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -643,14 +666,15 @@ public function deleteFromBlacklistRequest($phone) * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchBlacklist() + public function fetchBlacklist(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - list($response) = $this->fetchBlacklistWithHttpInfo(); + list($response) = $this->fetchBlacklistWithHttpInfo($contentType); return $response; } @@ -659,14 +683,15 @@ public function fetchBlacklist() * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchBlacklistWithHttpInfo() + public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - $request = $this->fetchBlacklistRequest(); + $request = $this->fetchBlacklistRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -709,6 +734,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\FetchBlacklistSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -721,6 +761,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -733,6 +788,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -747,6 +817,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -791,13 +876,14 @@ public function fetchBlacklistWithHttpInfo() * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsync() + public function fetchBlacklistAsync(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - return $this->fetchBlacklistAsyncWithHttpInfo() + return $this->fetchBlacklistAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -810,14 +896,15 @@ function ($response) { * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsyncWithHttpInfo() + public function fetchBlacklistAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) { $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; - $request = $this->fetchBlacklistRequest(); + $request = $this->fetchBlacklistRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -827,6 +914,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -855,13 +945,15 @@ function ($exception) { /** * Create request for operation 'fetchBlacklist' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchBlacklistRequest() + public function fetchBlacklistRequest(string $contentType = self::contentTypes['fetchBlacklist'][0]) { + $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -873,16 +965,11 @@ public function fetchBlacklistRequest() - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -900,12 +987,12 @@ public function fetchBlacklistRequest() // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -925,10 +1012,11 @@ public function fetchBlacklistRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -940,14 +1028,15 @@ public function fetchBlacklistRequest() * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function isBlacklisted($phone) + public function isBlacklisted($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - $this->isBlacklistedWithHttpInfo($phone); + $this->isBlacklistedWithHttpInfo($phone, $contentType); } /** @@ -956,14 +1045,15 @@ public function isBlacklisted($phone) * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function isBlacklistedWithHttpInfo($phone) + public function isBlacklistedWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - $request = $this->isBlacklistedRequest($phone); + $request = $this->isBlacklistedRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1039,13 +1129,14 @@ public function isBlacklistedWithHttpInfo($phone) * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsync($phone) + public function isBlacklistedAsync($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - return $this->isBlacklistedAsyncWithHttpInfo($phone) + return $this->isBlacklistedAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1059,14 +1150,15 @@ function ($response) { * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsyncWithHttpInfo($phone) + public function isBlacklistedAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { $returnType = ''; - $request = $this->isBlacklistedRequest($phone); + $request = $this->isBlacklistedRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1095,12 +1187,14 @@ function ($exception) { * Create request for operation 'isBlacklisted' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function isBlacklistedRequest($phone) + public function isBlacklistedRequest($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1108,6 +1202,7 @@ public function isBlacklistedRequest($phone) ); } + $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -1127,16 +1222,11 @@ public function isBlacklistedRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1154,12 +1244,12 @@ public function isBlacklistedRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1179,10 +1269,11 @@ public function isBlacklistedRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php index 73fc90b..4b8ca37 100644 --- a/lib/Api/ContactsApi.php +++ b/lib/Api/ContactsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'createContact' => [ + 'application/json', + ], + 'deleteContact' => [ + 'application/json', + ], + 'fetchContact' => [ + 'application/json', + ], + 'fetchContactGroups' => [ + 'application/json', + ], + 'fetchContacts' => [ + 'application/json', + ], + 'removeContactFromGroup' => [ + 'application/json', + ], + 'updateContact' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -123,14 +151,15 @@ public function getConfig() * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function addContactToGroup($groupId, $phone) + public function addContactToGroup($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone); + list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone, $contentType); return $response; } @@ -141,14 +170,15 @@ public function addContactToGroup($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function addContactToGroupWithHttpInfo($groupId, $phone) + public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - $request = $this->addContactToGroupRequest($groupId, $phone); + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -191,6 +221,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -203,6 +248,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -215,6 +275,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +302,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +329,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -251,6 +356,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -265,6 +385,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -335,13 +470,14 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsync($groupId, $phone) + public function addContactToGroupAsync($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone) + return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone, $contentType) ->then( function ($response) { return $response[0]; @@ -356,14 +492,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsyncWithHttpInfo($groupId, $phone) + public function addContactToGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { $returnType = 'object'; - $request = $this->addContactToGroupRequest($groupId, $phone); + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -373,6 +510,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -403,18 +543,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addContactToGroupRequest($groupId, $phone) + public function addContactToGroupRequest($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling addContactToGroup' ); } + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -422,6 +565,7 @@ public function addContactToGroupRequest($groupId, $phone) ); } + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -449,16 +593,11 @@ public function addContactToGroupRequest($groupId, $phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -476,12 +615,12 @@ public function addContactToGroupRequest($groupId, $phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -501,10 +640,11 @@ public function addContactToGroupRequest($groupId, $phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -516,14 +656,15 @@ public function addContactToGroupRequest($groupId, $phone) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createContact($contactFields) + public function createContact($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - list($response) = $this->createContactWithHttpInfo($contactFields); + list($response) = $this->createContactWithHttpInfo($contactFields, $contentType); return $response; } @@ -533,14 +674,15 @@ public function createContact($contactFields) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createContactWithHttpInfo($contactFields) + public function createContactWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - $request = $this->createContactRequest($contactFields); + $request = $this->createContactRequest($contactFields, $contentType); try { $options = $this->createHttpClientOption(); @@ -583,6 +725,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -595,6 +752,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -607,6 +779,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -619,6 +806,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -631,6 +833,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -645,6 +862,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -706,13 +938,14 @@ public function createContactWithHttpInfo($contactFields) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsync($contactFields) + public function createContactAsync($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - return $this->createContactAsyncWithHttpInfo($contactFields) + return $this->createContactAsyncWithHttpInfo($contactFields, $contentType) ->then( function ($response) { return $response[0]; @@ -726,14 +959,15 @@ function ($response) { * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsyncWithHttpInfo($contactFields) + public function createContactAsyncWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->createContactRequest($contactFields); + $request = $this->createContactRequest($contactFields, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -743,6 +977,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -772,12 +1009,14 @@ function ($exception) { * Create request for operation 'createContact' * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createContactRequest($contactFields) + public function createContactRequest($contactFields, string $contentType = self::contentTypes['createContact'][0]) { + // verify the required parameter 'contactFields' is set if ($contactFields === null || (is_array($contactFields) && count($contactFields) === 0)) { throw new \InvalidArgumentException( @@ -785,6 +1024,7 @@ public function createContactRequest($contactFields) ); } + $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -796,21 +1036,17 @@ public function createContactRequest($contactFields) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($contactFields)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactFields)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactFields)); } else { $httpBody = $contactFields; } @@ -829,12 +1065,12 @@ public function createContactRequest($contactFields) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -854,10 +1090,11 @@ public function createContactRequest($contactFields) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -869,14 +1106,15 @@ public function createContactRequest($contactFields) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteContact($phone) + public function deleteContact($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - $this->deleteContactWithHttpInfo($phone); + $this->deleteContactWithHttpInfo($phone, $contentType); } /** @@ -885,14 +1123,15 @@ public function deleteContact($phone) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteContactWithHttpInfo($phone) + public function deleteContactWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - $request = $this->deleteContactRequest($phone); + $request = $this->deleteContactRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -976,13 +1215,14 @@ public function deleteContactWithHttpInfo($phone) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsync($phone) + public function deleteContactAsync($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - return $this->deleteContactAsyncWithHttpInfo($phone) + return $this->deleteContactAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -996,14 +1236,15 @@ function ($response) { * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsyncWithHttpInfo($phone) + public function deleteContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) { $returnType = ''; - $request = $this->deleteContactRequest($phone); + $request = $this->deleteContactRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1032,12 +1273,14 @@ function ($exception) { * Create request for operation 'deleteContact' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteContactRequest($phone) + public function deleteContactRequest($phone, string $contentType = self::contentTypes['deleteContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1045,6 +1288,7 @@ public function deleteContactRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1064,16 +1308,11 @@ public function deleteContactRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1091,12 +1330,12 @@ public function deleteContactRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1116,10 +1355,11 @@ public function deleteContactRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1131,14 +1371,15 @@ public function deleteContactRequest($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContact($phone) + public function fetchContact($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - list($response) = $this->fetchContactWithHttpInfo($phone); + list($response) = $this->fetchContactWithHttpInfo($phone, $contentType); return $response; } @@ -1148,14 +1389,15 @@ public function fetchContact($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactWithHttpInfo($phone) + public function fetchContactWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - $request = $this->fetchContactRequest($phone); + $request = $this->fetchContactRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1198,6 +1440,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1210,6 +1467,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1222,6 +1494,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1234,6 +1521,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1248,6 +1550,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1301,13 +1618,14 @@ public function fetchContactWithHttpInfo($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsync($phone) + public function fetchContactAsync($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - return $this->fetchContactAsyncWithHttpInfo($phone) + return $this->fetchContactAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1321,14 +1639,15 @@ function ($response) { * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsyncWithHttpInfo($phone) + public function fetchContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->fetchContactRequest($phone); + $request = $this->fetchContactRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1338,6 +1657,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1367,12 +1689,14 @@ function ($exception) { * Create request for operation 'fetchContact' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactRequest($phone) + public function fetchContactRequest($phone, string $contentType = self::contentTypes['fetchContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1380,6 +1704,7 @@ public function fetchContactRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1399,16 +1724,11 @@ public function fetchContactRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1426,12 +1746,12 @@ public function fetchContactRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1451,10 +1771,11 @@ public function fetchContactRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1466,14 +1787,15 @@ public function fetchContactRequest($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContactGroups($phone) + public function fetchContactGroups($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - list($response) = $this->fetchContactGroupsWithHttpInfo($phone); + list($response) = $this->fetchContactGroupsWithHttpInfo($phone, $contentType); return $response; } @@ -1483,14 +1805,15 @@ public function fetchContactGroups($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactGroupsWithHttpInfo($phone) + public function fetchContactGroupsWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - $request = $this->fetchContactGroupsRequest($phone); + $request = $this->fetchContactGroupsRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1533,6 +1856,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1545,6 +1883,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1557,6 +1910,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1569,6 +1937,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1583,6 +1966,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1636,13 +2034,14 @@ public function fetchContactGroupsWithHttpInfo($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsync($phone) + public function fetchContactGroupsAsync($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - return $this->fetchContactGroupsAsyncWithHttpInfo($phone) + return $this->fetchContactGroupsAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1656,14 +2055,15 @@ function ($response) { * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsyncWithHttpInfo($phone) + public function fetchContactGroupsAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchContactGroupsRequest($phone); + $request = $this->fetchContactGroupsRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1673,6 +2073,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1702,12 +2105,14 @@ function ($exception) { * Create request for operation 'fetchContactGroups' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactGroupsRequest($phone) + public function fetchContactGroupsRequest($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1715,6 +2120,7 @@ public function fetchContactGroupsRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}/groups'; $formParams = []; $queryParams = []; @@ -1734,16 +2140,11 @@ public function fetchContactGroupsRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1761,12 +2162,12 @@ public function fetchContactGroupsRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1786,10 +2187,11 @@ public function fetchContactGroupsRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1801,14 +2203,15 @@ public function fetchContactGroupsRequest($phone) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContacts($groupIds = null) + public function fetchContacts($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - list($response) = $this->fetchContactsWithHttpInfo($groupIds); + list($response) = $this->fetchContactsWithHttpInfo($groupIds, $contentType); return $response; } @@ -1818,14 +2221,15 @@ public function fetchContacts($groupIds = null) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactsWithHttpInfo($groupIds = null) + public function fetchContactsWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - $request = $this->fetchContactsRequest($groupIds); + $request = $this->fetchContactsRequest($groupIds, $contentType); try { $options = $this->createHttpClientOption(); @@ -1868,6 +2272,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1880,6 +2299,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1892,6 +2326,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1904,6 +2353,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1918,6 +2382,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1971,13 +2450,14 @@ public function fetchContactsWithHttpInfo($groupIds = null) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsync($groupIds = null) + public function fetchContactsAsync($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - return $this->fetchContactsAsyncWithHttpInfo($groupIds) + return $this->fetchContactsAsyncWithHttpInfo($groupIds, $contentType) ->then( function ($response) { return $response[0]; @@ -1991,14 +2471,15 @@ function ($response) { * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsyncWithHttpInfo($groupIds = null) + public function fetchContactsAsyncWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { $returnType = '\Messente\Api\Model\ContactListEnvelope'; - $request = $this->fetchContactsRequest($groupIds); + $request = $this->fetchContactsRequest($groupIds, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2008,6 +2489,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2037,13 +2521,16 @@ function ($exception) { * Create request for operation 'fetchContacts' * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactsRequest($groupIds = null) + public function fetchContactsRequest($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { + + $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -2052,30 +2539,23 @@ public function fetchContactsRequest($groupIds = null) $multipart = false; // query params - if ($groupIds !== null) { - if('form' === 'form' && is_array($groupIds)) { - foreach($groupIds as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['groupIds'] = $groupIds; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $groupIds, + 'groupIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2093,12 +2573,12 @@ public function fetchContactsRequest($groupIds = null) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2118,10 +2598,11 @@ public function fetchContactsRequest($groupIds = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2134,14 +2615,15 @@ public function fetchContactsRequest($groupIds = null) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function removeContactFromGroup($groupId, $phone) + public function removeContactFromGroup($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - $this->removeContactFromGroupWithHttpInfo($groupId, $phone); + $this->removeContactFromGroupWithHttpInfo($groupId, $phone, $contentType); } /** @@ -2151,14 +2633,15 @@ public function removeContactFromGroup($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function removeContactFromGroupWithHttpInfo($groupId, $phone) + public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - $request = $this->removeContactFromGroupRequest($groupId, $phone); + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -2243,13 +2726,14 @@ public function removeContactFromGroupWithHttpInfo($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsync($groupId, $phone) + public function removeContactFromGroupAsync($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) + return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, $contentType) ->then( function ($response) { return $response[0]; @@ -2264,14 +2748,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) + public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { $returnType = ''; - $request = $this->removeContactFromGroupRequest($groupId, $phone); + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2301,18 +2786,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function removeContactFromGroupRequest($groupId, $phone) + public function removeContactFromGroupRequest($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling removeContactFromGroup' ); } + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -2320,6 +2808,7 @@ public function removeContactFromGroupRequest($groupId, $phone) ); } + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -2347,16 +2836,11 @@ public function removeContactFromGroupRequest($groupId, $phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2374,12 +2858,12 @@ public function removeContactFromGroupRequest($groupId, $phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2399,10 +2883,11 @@ public function removeContactFromGroupRequest($groupId, $phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2415,14 +2900,15 @@ public function removeContactFromGroupRequest($groupId, $phone) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateContact($phone, $contactUpdateFields) + public function updateContact($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields); + list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields, $contentType); return $response; } @@ -2433,14 +2919,15 @@ public function updateContact($phone, $contactUpdateFields) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateContactWithHttpInfo($phone, $contactUpdateFields) + public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - $request = $this->updateContactRequest($phone, $contactUpdateFields); + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); try { $options = $this->createHttpClientOption(); @@ -2483,6 +2970,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2495,6 +2997,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2507,6 +3024,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2519,6 +3051,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2531,6 +3078,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2545,6 +3107,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2607,13 +3184,14 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsync($phone, $contactUpdateFields) + public function updateContactAsync($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) + return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, $contentType) ->then( function ($response) { return $response[0]; @@ -2628,14 +3206,15 @@ function ($response) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) + public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->updateContactRequest($phone, $contactUpdateFields); + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2645,6 +3224,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2675,18 +3257,21 @@ function ($exception) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateContactRequest($phone, $contactUpdateFields) + public function updateContactRequest($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $phone when calling updateContact' ); } + // verify the required parameter 'contactUpdateFields' is set if ($contactUpdateFields === null || (is_array($contactUpdateFields) && count($contactUpdateFields) === 0)) { throw new \InvalidArgumentException( @@ -2694,6 +3279,7 @@ public function updateContactRequest($phone, $contactUpdateFields) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -2713,21 +3299,17 @@ public function updateContactRequest($phone, $contactUpdateFields) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($contactUpdateFields)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); } else { $httpBody = $contactUpdateFields; } @@ -2746,12 +3328,12 @@ public function updateContactRequest($phone, $contactUpdateFields) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2771,10 +3353,11 @@ public function updateContactRequest($phone, $contactUpdateFields) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/DeliveryReportApi.php b/lib/Api/DeliveryReportApi.php index dec10da..037e7ff 100644 --- a/lib/Api/DeliveryReportApi.php +++ b/lib/Api/DeliveryReportApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function retrieveDeliveryReport($omnimessageId) + public function retrieveDeliveryReport($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId); + list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId, $contentType); return $response; } @@ -139,14 +147,15 @@ public function retrieveDeliveryReport($omnimessageId) * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function retrieveDeliveryReportWithHttpInfo($omnimessageId) + public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - $request = $this->retrieveDeliveryReportRequest($omnimessageId); + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\DeliveryReportResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +281,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -272,13 +341,14 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsync($omnimessageId) + public function retrieveDeliveryReportAsync($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) + return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, $contentType) ->then( function ($response) { return $response[0]; @@ -292,14 +362,15 @@ function ($response) { * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) + public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { $returnType = '\Messente\Api\Model\DeliveryReportResponse'; - $request = $this->retrieveDeliveryReportRequest($omnimessageId); + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -309,6 +380,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -338,12 +412,14 @@ function ($exception) { * Create request for operation 'retrieveDeliveryReport' * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function retrieveDeliveryReportRequest($omnimessageId) + public function retrieveDeliveryReportRequest($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { + // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -351,6 +427,7 @@ public function retrieveDeliveryReportRequest($omnimessageId) ); } + $resourcePath = '/omnimessage/{omnimessageId}/status'; $formParams = []; $queryParams = []; @@ -370,16 +447,11 @@ public function retrieveDeliveryReportRequest($omnimessageId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -397,12 +469,12 @@ public function retrieveDeliveryReportRequest($omnimessageId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -422,10 +494,11 @@ public function retrieveDeliveryReportRequest($omnimessageId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/GroupsApi.php b/lib/Api/GroupsApi.php index 8bfaca6..0b4c8e5 100644 --- a/lib/Api/GroupsApi.php +++ b/lib/Api/GroupsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'deleteGroup' => [ + 'application/json', + ], + 'fetchGroup' => [ + 'application/json', + ], + 'fetchGroups' => [ + 'application/json', + ], + 'updateGroup' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +141,15 @@ public function getConfig() * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createGroup($groupName) + public function createGroup($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - list($response) = $this->createGroupWithHttpInfo($groupName); + list($response) = $this->createGroupWithHttpInfo($groupName, $contentType); return $response; } @@ -139,14 +159,15 @@ public function createGroup($groupName) * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createGroupWithHttpInfo($groupName) + public function createGroupWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - $request = $this->createGroupRequest($groupName); + $request = $this->createGroupRequest($groupName, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +210,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +237,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +264,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +291,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +320,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -292,13 +388,14 @@ public function createGroupWithHttpInfo($groupName) * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsync($groupName) + public function createGroupAsync($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - return $this->createGroupAsyncWithHttpInfo($groupName) + return $this->createGroupAsyncWithHttpInfo($groupName, $contentType) ->then( function ($response) { return $response[0]; @@ -312,14 +409,15 @@ function ($response) { * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsyncWithHttpInfo($groupName) + public function createGroupAsyncWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->createGroupRequest($groupName); + $request = $this->createGroupRequest($groupName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,6 +427,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -358,12 +459,14 @@ function ($exception) { * Create request for operation 'createGroup' * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createGroupRequest($groupName) + public function createGroupRequest($groupName, string $contentType = self::contentTypes['createGroup'][0]) { + // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -371,6 +474,7 @@ public function createGroupRequest($groupName) ); } + $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -382,21 +486,17 @@ public function createGroupRequest($groupName) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($groupName)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -415,12 +515,12 @@ public function createGroupRequest($groupName) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -440,10 +540,11 @@ public function createGroupRequest($groupName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -455,14 +556,15 @@ public function createGroupRequest($groupName) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteGroup($groupId) + public function deleteGroup($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - $this->deleteGroupWithHttpInfo($groupId); + $this->deleteGroupWithHttpInfo($groupId, $contentType); } /** @@ -471,14 +573,15 @@ public function deleteGroup($groupId) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteGroupWithHttpInfo($groupId) + public function deleteGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - $request = $this->deleteGroupRequest($groupId); + $request = $this->deleteGroupRequest($groupId, $contentType); try { $options = $this->createHttpClientOption(); @@ -554,13 +657,14 @@ public function deleteGroupWithHttpInfo($groupId) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsync($groupId) + public function deleteGroupAsync($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - return $this->deleteGroupAsyncWithHttpInfo($groupId) + return $this->deleteGroupAsyncWithHttpInfo($groupId, $contentType) ->then( function ($response) { return $response[0]; @@ -574,14 +678,15 @@ function ($response) { * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsyncWithHttpInfo($groupId) + public function deleteGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { $returnType = ''; - $request = $this->deleteGroupRequest($groupId); + $request = $this->deleteGroupRequest($groupId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -610,12 +715,14 @@ function ($exception) { * Create request for operation 'deleteGroup' * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteGroupRequest($groupId) + public function deleteGroupRequest($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -623,6 +730,7 @@ public function deleteGroupRequest($groupId) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -642,16 +750,11 @@ public function deleteGroupRequest($groupId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -669,12 +772,12 @@ public function deleteGroupRequest($groupId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -694,10 +797,11 @@ public function deleteGroupRequest($groupId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -709,14 +813,15 @@ public function deleteGroupRequest($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroup($groupId) + public function fetchGroup($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - list($response) = $this->fetchGroupWithHttpInfo($groupId); + list($response) = $this->fetchGroupWithHttpInfo($groupId, $contentType); return $response; } @@ -726,14 +831,15 @@ public function fetchGroup($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupWithHttpInfo($groupId) + public function fetchGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - $request = $this->fetchGroupRequest($groupId); + $request = $this->fetchGroupRequest($groupId, $contentType); try { $options = $this->createHttpClientOption(); @@ -776,6 +882,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -788,6 +909,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -800,6 +936,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -814,6 +965,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -859,13 +1025,14 @@ public function fetchGroupWithHttpInfo($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsync($groupId) + public function fetchGroupAsync($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - return $this->fetchGroupAsyncWithHttpInfo($groupId) + return $this->fetchGroupAsyncWithHttpInfo($groupId, $contentType) ->then( function ($response) { return $response[0]; @@ -879,14 +1046,15 @@ function ($response) { * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsyncWithHttpInfo($groupId) + public function fetchGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->fetchGroupRequest($groupId); + $request = $this->fetchGroupRequest($groupId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -896,6 +1064,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -925,12 +1096,14 @@ function ($exception) { * Create request for operation 'fetchGroup' * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupRequest($groupId) + public function fetchGroupRequest($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -938,6 +1111,7 @@ public function fetchGroupRequest($groupId) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -957,16 +1131,11 @@ public function fetchGroupRequest($groupId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -984,12 +1153,12 @@ public function fetchGroupRequest($groupId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1009,10 +1178,11 @@ public function fetchGroupRequest($groupId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1023,14 +1193,15 @@ public function fetchGroupRequest($groupId) * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroups() + public function fetchGroups(string $contentType = self::contentTypes['fetchGroups'][0]) { - list($response) = $this->fetchGroupsWithHttpInfo(); + list($response) = $this->fetchGroupsWithHttpInfo($contentType); return $response; } @@ -1039,14 +1210,15 @@ public function fetchGroups() * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupsWithHttpInfo() + public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) { - $request = $this->fetchGroupsRequest(); + $request = $this->fetchGroupsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1089,6 +1261,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1101,6 +1288,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1113,6 +1315,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1127,6 +1344,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1171,13 +1403,14 @@ public function fetchGroupsWithHttpInfo() * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsync() + public function fetchGroupsAsync(string $contentType = self::contentTypes['fetchGroups'][0]) { - return $this->fetchGroupsAsyncWithHttpInfo() + return $this->fetchGroupsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1190,14 +1423,15 @@ function ($response) { * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsyncWithHttpInfo() + public function fetchGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchGroupsRequest(); + $request = $this->fetchGroupsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1207,6 +1441,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1235,13 +1472,15 @@ function ($exception) { /** * Create request for operation 'fetchGroups' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupsRequest() + public function fetchGroupsRequest(string $contentType = self::contentTypes['fetchGroups'][0]) { + $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -1253,16 +1492,11 @@ public function fetchGroupsRequest() - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1280,12 +1514,12 @@ public function fetchGroupsRequest() // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1305,10 +1539,11 @@ public function fetchGroupsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1321,14 +1556,15 @@ public function fetchGroupsRequest() * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateGroup($groupId, $groupName) + public function updateGroup($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName); + list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName, $contentType); return $response; } @@ -1339,14 +1575,15 @@ public function updateGroup($groupId, $groupName) * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateGroupWithHttpInfo($groupId, $groupName) + public function updateGroupWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - $request = $this->updateGroupRequest($groupId, $groupName); + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); try { $options = $this->createHttpClientOption(); @@ -1389,6 +1626,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1401,6 +1653,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1413,6 +1680,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1425,6 +1707,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1437,6 +1734,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1451,6 +1763,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1513,13 +1840,14 @@ public function updateGroupWithHttpInfo($groupId, $groupName) * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsync($groupId, $groupName) + public function updateGroupAsync($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName) + return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName, $contentType) ->then( function ($response) { return $response[0]; @@ -1534,14 +1862,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsyncWithHttpInfo($groupId, $groupName) + public function updateGroupAsyncWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->updateGroupRequest($groupId, $groupName); + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1551,6 +1880,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1581,18 +1913,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateGroupRequest($groupId, $groupName) + public function updateGroupRequest($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling updateGroup' ); } + // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -1600,6 +1935,7 @@ public function updateGroupRequest($groupId, $groupName) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -1619,21 +1955,17 @@ public function updateGroupRequest($groupId, $groupName) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($groupName)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -1652,12 +1984,12 @@ public function updateGroupRequest($groupId, $groupName) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1677,10 +2009,11 @@ public function updateGroupRequest($groupId, $groupName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/NumberLookupApi.php b/lib/Api/NumberLookupApi.php index 54abbe4..4bea0f0 100644 --- a/lib/Api/NumberLookupApi.php +++ b/lib/Api/NumberLookupApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup */ - public function fetchInfo($numbersToInvestigate) + public function fetchInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate); + list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate, $contentType); return $response; } @@ -139,14 +147,15 @@ public function fetchInfo($numbersToInvestigate) * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup, HTTP status code, HTTP response headers (array of strings) */ - public function fetchInfoWithHttpInfo($numbersToInvestigate) + public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - $request = $this->fetchInfoRequest($numbersToInvestigate); + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\SyncNumberLookupSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +279,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +308,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -292,13 +376,14 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsync($numbersToInvestigate) + public function fetchInfoAsync($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate) + return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate, $contentType) ->then( function ($response) { return $response[0]; @@ -312,14 +397,15 @@ function ($response) { * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate) + public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; - $request = $this->fetchInfoRequest($numbersToInvestigate); + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,6 +415,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -358,12 +447,14 @@ function ($exception) { * Create request for operation 'fetchInfo' * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchInfoRequest($numbersToInvestigate) + public function fetchInfoRequest($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { + // verify the required parameter 'numbersToInvestigate' is set if ($numbersToInvestigate === null || (is_array($numbersToInvestigate) && count($numbersToInvestigate) === 0)) { throw new \InvalidArgumentException( @@ -371,6 +462,7 @@ public function fetchInfoRequest($numbersToInvestigate) ); } + $resourcePath = '/hlr/sync'; $formParams = []; $queryParams = []; @@ -382,21 +474,17 @@ public function fetchInfoRequest($numbersToInvestigate) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($numbersToInvestigate)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); } else { $httpBody = $numbersToInvestigate; } @@ -415,12 +503,12 @@ public function fetchInfoRequest($numbersToInvestigate) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -440,10 +528,11 @@ public function fetchInfoRequest($numbersToInvestigate) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php index bcda4cb..1cc0442 100644 --- a/lib/Api/OmnimessageApi.php +++ b/lib/Api/OmnimessageApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'sendOmnimessage' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +132,15 @@ public function getConfig() * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function cancelScheduledMessage($omnimessageId) + public function cancelScheduledMessage($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId); + list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId, $contentType); return $response; } @@ -139,14 +150,15 @@ public function cancelScheduledMessage($omnimessageId) * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function cancelScheduledMessageWithHttpInfo($omnimessageId) + public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - $request = $this->cancelScheduledMessageRequest($omnimessageId); + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +201,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +228,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +255,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +284,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -272,13 +344,14 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsync($omnimessageId) + public function cancelScheduledMessageAsync($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) + return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, $contentType) ->then( function ($response) { return $response[0]; @@ -292,14 +365,15 @@ function ($response) { * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) + public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { $returnType = 'object'; - $request = $this->cancelScheduledMessageRequest($omnimessageId); + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -309,6 +383,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -338,12 +415,14 @@ function ($exception) { * Create request for operation 'cancelScheduledMessage' * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function cancelScheduledMessageRequest($omnimessageId) + public function cancelScheduledMessageRequest($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { + // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -351,6 +430,7 @@ public function cancelScheduledMessageRequest($omnimessageId) ); } + $resourcePath = '/omnimessage/{omnimessageId}'; $formParams = []; $queryParams = []; @@ -370,16 +450,11 @@ public function cancelScheduledMessageRequest($omnimessageId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -397,12 +472,12 @@ public function cancelScheduledMessageRequest($omnimessageId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -422,10 +497,11 @@ public function cancelScheduledMessageRequest($omnimessageId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -437,14 +513,15 @@ public function cancelScheduledMessageRequest($omnimessageId) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function sendOmnimessage($omnimessage) + public function sendOmnimessage($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage); + list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage, $contentType); return $response; } @@ -454,14 +531,15 @@ public function sendOmnimessage($omnimessage) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function sendOmnimessageWithHttpInfo($omnimessage) + public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - $request = $this->sendOmnimessageRequest($omnimessage); + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); try { $options = $this->createHttpClientOption(); @@ -504,6 +582,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -516,6 +609,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -528,6 +636,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -542,6 +665,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -587,13 +725,14 @@ public function sendOmnimessageWithHttpInfo($omnimessage) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsync($omnimessage) + public function sendOmnimessageAsync($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage) + return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage, $contentType) ->then( function ($response) { return $response[0]; @@ -607,14 +746,15 @@ function ($response) { * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsyncWithHttpInfo($omnimessage) + public function sendOmnimessageAsyncWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; - $request = $this->sendOmnimessageRequest($omnimessage); + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -624,6 +764,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -653,12 +796,14 @@ function ($exception) { * Create request for operation 'sendOmnimessage' * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function sendOmnimessageRequest($omnimessage) + public function sendOmnimessageRequest($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { + // verify the required parameter 'omnimessage' is set if ($omnimessage === null || (is_array($omnimessage) && count($omnimessage) === 0)) { throw new \InvalidArgumentException( @@ -666,6 +811,7 @@ public function sendOmnimessageRequest($omnimessage) ); } + $resourcePath = '/omnimessage'; $formParams = []; $queryParams = []; @@ -677,21 +823,17 @@ public function sendOmnimessageRequest($omnimessage) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($omnimessage)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($omnimessage)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omnimessage)); } else { $httpBody = $omnimessage; } @@ -710,12 +852,12 @@ public function sendOmnimessageRequest($omnimessage) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -735,10 +877,11 @@ public function sendOmnimessageRequest($omnimessage) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/StatisticsApi.php b/lib/Api/StatisticsApi.php index a5b109f..0d70d5a 100644 --- a/lib/Api/StatisticsApi.php +++ b/lib/Api/StatisticsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics */ - public function createStatisticsReport($statisticsReportSettings) + public function createStatisticsReport($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings); + list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings, $contentType); return $response; } @@ -139,14 +147,15 @@ public function createStatisticsReport($statisticsReportSettings) * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics, HTTP status code, HTTP response headers (array of strings) */ - public function createStatisticsReportWithHttpInfo($statisticsReportSettings) + public function createStatisticsReportWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - $request = $this->createStatisticsReportRequest($statisticsReportSettings); + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\StatisticsReportSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +279,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -237,6 +306,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -251,6 +335,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -312,13 +411,14 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsync($statisticsReportSettings) + public function createStatisticsReportAsync($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) + return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, $contentType) ->then( function ($response) { return $response[0]; @@ -332,14 +432,15 @@ function ($response) { * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) + public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; - $request = $this->createStatisticsReportRequest($statisticsReportSettings); + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -349,6 +450,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -378,12 +482,14 @@ function ($exception) { * Create request for operation 'createStatisticsReport' * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createStatisticsReportRequest($statisticsReportSettings) + public function createStatisticsReportRequest($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { + // verify the required parameter 'statisticsReportSettings' is set if ($statisticsReportSettings === null || (is_array($statisticsReportSettings) && count($statisticsReportSettings) === 0)) { throw new \InvalidArgumentException( @@ -391,6 +497,7 @@ public function createStatisticsReportRequest($statisticsReportSettings) ); } + $resourcePath = '/statistics/reports'; $formParams = []; $queryParams = []; @@ -402,21 +509,17 @@ public function createStatisticsReportRequest($statisticsReportSettings) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($statisticsReportSettings)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); } else { $httpBody = $statisticsReportSettings; } @@ -435,12 +538,12 @@ public function createStatisticsReportRequest($statisticsReportSettings) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -460,10 +563,11 @@ public function createStatisticsReportRequest($statisticsReportSettings) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/ApiException.php b/lib/ApiException.php index 5e918bc..a61f0f5 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -1,7 +1,7 @@ accessToken; } + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + /** * Sets the username for HTTP basic authentication * @@ -400,7 +434,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 2.1.0' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -447,32 +481,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -485,4 +518,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index a149e1d..d28cb40 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -1,7 +1,7 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } /** - * Return the content type based on an array of content-type provided + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php index e9c9a37..e48e7d4 100644 --- a/lib/Model/Channel.php +++ b/lib/Model/Channel.php @@ -2,7 +2,7 @@ /** * Channel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,13 +44,13 @@ class Channel /** * Possible values of this enum */ - const SMS = 'sms'; + public const SMS = 'sms'; - const VIBER = 'viber'; + public const VIBER = 'viber'; - const WHATSAPP = 'whatsapp'; + public const WHATSAPP = 'whatsapp'; - const TELEGRAM = 'telegram'; + public const TELEGRAM = 'telegram'; /** * Gets allowable values of the enum diff --git a/lib/Model/ContactEnvelope.php b/lib/Model/ContactEnvelope.php index f1e0dd9..1c1bb3c 100644 --- a/lib/Model/ContactEnvelope.php +++ b/lib/Model/ContactEnvelope.php @@ -2,7 +2,7 @@ /** * ContactEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'contact' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contact' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['contact'] = $data['contact'] ?? null; + $this->setIfExists('contact', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getContact() */ public function setContact($contact) { + if (is_null($contact)) { + throw new \InvalidArgumentException('non-nullable contact cannot be null'); + } $this->container['contact'] = $contact; return $this; @@ -237,7 +324,7 @@ public function setContact($contact) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -249,6 +336,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -262,7 +350,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -278,7 +366,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -290,6 +378,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactFields.php b/lib/Model/ContactFields.php index 7fc55a0..971bc81 100644 --- a/lib/Model/ContactFields.php +++ b/lib/Model/ContactFields.php @@ -2,7 +2,7 @@ /** * ContactFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -93,6 +91,31 @@ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable 'custom4' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -113,6 +136,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -225,16 +300,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -283,6 +376,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -307,6 +403,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -331,6 +437,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -355,6 +471,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -379,6 +505,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -403,6 +539,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -427,6 +573,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -451,6 +607,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -475,6 +641,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -499,6 +675,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -510,7 +696,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -522,6 +708,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -535,7 +722,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -551,7 +738,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -563,6 +750,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactListEnvelope.php b/lib/Model/ContactListEnvelope.php index b225830..81b91ea 100644 --- a/lib/Model/ContactListEnvelope.php +++ b/lib/Model/ContactListEnvelope.php @@ -2,7 +2,7 @@ /** * ContactListEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializa 'contacts' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contacts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['contacts'] = $data['contacts'] ?? null; + $this->setIfExists('contacts', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getContacts() */ public function setContacts($contacts) { + if (is_null($contacts)) { + throw new \InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; @@ -239,7 +326,7 @@ public function setContacts($contacts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactResponseFields.php b/lib/Model/ContactResponseFields.php index 1b44998..06a560d 100644 --- a/lib/Model/ContactResponseFields.php +++ b/lib/Model/ContactResponseFields.php @@ -2,7 +2,7 @@ /** * ContactResponseFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -95,6 +93,32 @@ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSeriali 'scheduledDeletionDate' => 'date' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true, + 'scheduledDeletionDate' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -115,6 +139,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,17 +306,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; - $this->container['scheduledDeletionDate'] = $data['scheduledDeletionDate'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + $this->setIfExists('scheduledDeletionDate', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -286,6 +380,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -310,6 +407,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -334,6 +441,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -358,6 +475,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -382,6 +509,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -406,6 +543,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -430,6 +577,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -454,6 +611,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -478,6 +645,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -502,6 +679,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -526,6 +713,16 @@ public function getScheduledDeletionDate() */ public function setScheduledDeletionDate($scheduledDeletionDate) { + if (is_null($scheduledDeletionDate)) { + array_push($this->openAPINullablesSetToNull, 'scheduledDeletionDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scheduledDeletionDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['scheduledDeletionDate'] = $scheduledDeletionDate; return $this; @@ -537,7 +734,7 @@ public function setScheduledDeletionDate($scheduledDeletionDate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -549,6 +746,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -562,7 +760,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -578,7 +776,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -590,6 +788,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactUpdateFields.php b/lib/Model/ContactUpdateFields.php index 1f4c757..8f2b5a5 100644 --- a/lib/Model/ContactUpdateFields.php +++ b/lib/Model/ContactUpdateFields.php @@ -2,7 +2,7 @@ /** * ContactUpdateFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -91,6 +89,30 @@ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializa 'custom4' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -111,6 +133,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,15 +294,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -274,6 +366,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -298,6 +400,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -322,6 +434,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -346,6 +468,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -370,6 +502,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -394,6 +536,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -418,6 +570,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -442,6 +604,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -466,6 +638,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -477,7 +659,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -489,6 +671,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -502,7 +685,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -518,7 +701,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -530,6 +713,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryReportResponse.php b/lib/Model/DeliveryReportResponse.php index 0ac1bdb..39c14ed 100644 --- a/lib/Model/DeliveryReportResponse.php +++ b/lib/Model/DeliveryReportResponse.php @@ -2,7 +2,7 @@ /** * DeliveryReportResponse * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerial 'omnimessageId' => 'UUID' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'statuses' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['statuses'] = $data['statuses'] ?? null; - $this->container['to'] = $data['to'] ?? null; - $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; + $this->setIfExists('statuses', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getStatuses() */ public function setStatuses($statuses) { + if (is_null($statuses)) { + throw new \InvalidArgumentException('non-nullable statuses cannot be null'); + } $this->container['statuses'] = $statuses; return $this; @@ -271,6 +360,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -295,6 +387,9 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -306,7 +401,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryResult.php b/lib/Model/DeliveryResult.php index 049d5e3..09858a8 100644 --- a/lib/Model/DeliveryResult.php +++ b/lib/Model/DeliveryResult.php @@ -2,7 +2,7 @@ /** * DeliveryResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -85,6 +83,27 @@ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'channel' => false, + 'messageId' => false, + 'error' => true, + 'err' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +124,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -205,12 +276,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['status'] = $data['status'] ?? null; - $this->container['channel'] = $data['channel'] ?? null; - $this->container['messageId'] = $data['messageId'] ?? null; - $this->container['error'] = $data['error'] ?? null; - $this->container['err'] = $data['err'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('err', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -256,6 +345,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -280,6 +372,9 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $this->container['channel'] = $channel; return $this; @@ -304,6 +399,9 @@ public function getMessageId() */ public function setMessageId($messageId) { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -328,6 +426,16 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['error'] = $error; return $this; @@ -352,6 +460,9 @@ public function getErr() */ public function setErr($err) { + if (is_null($err)) { + throw new \InvalidArgumentException('non-nullable err cannot be null'); + } $this->container['err'] = $err; return $this; @@ -376,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; @@ -387,7 +501,7 @@ public function setTimestamp($timestamp) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -399,6 +513,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -412,7 +527,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -428,7 +543,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -440,6 +555,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorCodeOmnichannel.php b/lib/Model/ErrorCodeOmnichannel.php index 5f88cd2..51e6e9c 100644 --- a/lib/Model/ErrorCodeOmnichannel.php +++ b/lib/Model/ErrorCodeOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,19 +44,19 @@ class ErrorCodeOmnichannel /** * Possible values of this enum */ - const _101 = '101'; + public const _101 = '101'; - const _102 = '102'; + public const _102 = '102'; - const _103 = '103'; + public const _103 = '103'; - const _104 = '104'; + public const _104 = '104'; - const _105 = '105'; + public const _105 = '105'; - const _106 = '106'; + public const _106 = '106'; - const _107 = '107'; + public const _107 = '107'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeOmnichannelMachine.php b/lib/Model/ErrorCodeOmnichannelMachine.php index 50b2f5f..8dd9e02 100644 --- a/lib/Model/ErrorCodeOmnichannelMachine.php +++ b/lib/Model/ErrorCodeOmnichannelMachine.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannelMachine * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,29 +44,29 @@ class ErrorCodeOmnichannelMachine /** * Possible values of this enum */ - const NUMBER_0 = 0; + public const NUMBER_0 = 0; - const NUMBER_1 = 1; + public const NUMBER_1 = 1; - const NUMBER_2 = 2; + public const NUMBER_2 = 2; - const NUMBER_3 = 3; + public const NUMBER_3 = 3; - const NUMBER_4 = 4; + public const NUMBER_4 = 4; - const NUMBER_5 = 5; + public const NUMBER_5 = 5; - const NUMBER_6 = 6; + public const NUMBER_6 = 6; - const NUMBER_7 = 7; + public const NUMBER_7 = 7; - const NUMBER_8 = 8; + public const NUMBER_8 = 8; - const NUMBER_9 = 9; + public const NUMBER_9 = 9; - const NUMBER_10 = 10; + public const NUMBER_10 = 10; - const NUMBER_999 = 999; + public const NUMBER_999 = 999; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodePhonebook.php b/lib/Model/ErrorCodePhonebook.php index 37fdb89..1d455bd 100644 --- a/lib/Model/ErrorCodePhonebook.php +++ b/lib/Model/ErrorCodePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorCodePhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,17 +44,17 @@ class ErrorCodePhonebook /** * Possible values of this enum */ - const _201 = '201'; + public const _201 = '201'; - const _202 = '202'; + public const _202 = '202'; - const _203 = '203'; + public const _203 = '203'; - const _204 = '204'; + public const _204 = '204'; - const _244 = '244'; + public const _244 = '244'; - const _205 = '205'; + public const _205 = '205'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeStatistics.php b/lib/Model/ErrorCodeStatistics.php index 6b082f7..aa373bf 100644 --- a/lib/Model/ErrorCodeStatistics.php +++ b/lib/Model/ErrorCodeStatistics.php @@ -2,7 +2,7 @@ /** * ErrorCodeStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,13 +44,13 @@ class ErrorCodeStatistics /** * Possible values of this enum */ - const _100 = '100'; + public const _100 = '100'; - const _103 = '103'; + public const _103 = '103'; - const _104 = '104'; + public const _104 = '104'; - const _105 = '105'; + public const _105 = '105'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorItemNumberLookup.php b/lib/Model/ErrorItemNumberLookup.php index 1173426..1fe0fe4 100644 --- a/lib/Model/ErrorItemNumberLookup.php +++ b/lib/Model/ErrorItemNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookup * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSeriali 'error' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['error'] = $data['error'] ?? null; + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } $this->container['error'] = $error; return $this; @@ -240,7 +327,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemNumberLookupError.php b/lib/Model/ErrorItemNumberLookupError.php index b8f6254..54436a2 100644 --- a/lib/Model/ErrorItemNumberLookupError.php +++ b/lib/Model/ErrorItemNumberLookupError.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookupError * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,6 +75,23 @@ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSe 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'description' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['description'] = $data['description'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -246,6 +331,9 @@ public function getDescription() */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -270,6 +358,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } if (($code > 106)) { throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be smaller than or equal to 106.'); @@ -289,7 +380,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -301,6 +392,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -314,7 +406,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -330,7 +422,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -342,6 +434,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemOmnichannel.php b/lib/Model/ErrorItemOmnichannel.php index dd1cad6..afd0fc5 100644 --- a/lib/Model/ErrorItemOmnichannel.php +++ b/lib/Model/ErrorItemOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorItemOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -81,6 +79,25 @@ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializ 'source' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false, + 'source' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -195,10 +264,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['detail'] = $data['detail'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['source'] = $data['source'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -256,6 +343,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -280,6 +370,9 @@ public function getDetail() */ public function setDetail($detail) { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } $this->container['detail'] = $detail; return $this; @@ -304,6 +397,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -328,6 +424,16 @@ public function getSource() */ public function setSource($source) { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['source'] = $source; return $this; @@ -339,7 +445,7 @@ public function setSource($source) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -351,6 +457,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -364,7 +471,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -380,7 +487,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -392,6 +499,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemPhonebook.php b/lib/Model/ErrorItemPhonebook.php index 8e0cb54..2a3b976 100644 --- a/lib/Model/ErrorItemPhonebook.php +++ b/lib/Model/ErrorItemPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorItemPhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializab 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['detail'] = $data['detail'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -271,6 +360,9 @@ public function getDetail() */ public function setDetail($detail) { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } $this->container['detail'] = $detail; return $this; @@ -295,6 +387,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -306,7 +401,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemStatistics.php b/lib/Model/ErrorItemStatistics.php index 1c794d4..d01b438 100644 --- a/lib/Model/ErrorItemStatistics.php +++ b/lib/Model/ErrorItemStatistics.php @@ -2,7 +2,7 @@ /** * ErrorItemStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializa 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'details' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['details'] = $data['details'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -271,6 +360,9 @@ public function getDetails() */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -295,6 +387,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -306,7 +401,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorNumberLookup.php b/lib/Model/ErrorNumberLookup.php index 1e4d769..fce5576 100644 --- a/lib/Model/ErrorNumberLookup.php +++ b/lib/Model/ErrorNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorNumberLookup * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializabl 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorOmnichannel.php b/lib/Model/ErrorOmnichannel.php index ff18c12..d613256 100644 --- a/lib/Model/ErrorOmnichannel.php +++ b/lib/Model/ErrorOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorPhonebook.php b/lib/Model/ErrorPhonebook.php index 6f5f502..4a42fb3 100644 --- a/lib/Model/ErrorPhonebook.php +++ b/lib/Model/ErrorPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorPhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorStatistics.php b/lib/Model/ErrorStatistics.php index dec3d64..1c49519 100644 --- a/lib/Model/ErrorStatistics.php +++ b/lib/Model/ErrorStatistics.php @@ -2,7 +2,7 @@ /** * ErrorStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorTitleOmnichannel.php b/lib/Model/ErrorTitleOmnichannel.php index e5a0b6b..2538506 100644 --- a/lib/Model/ErrorTitleOmnichannel.php +++ b/lib/Model/ErrorTitleOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorTitleOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,19 +44,19 @@ class ErrorTitleOmnichannel /** * Possible values of this enum */ - const NOT_FOUND = 'Not found'; + public const NOT_FOUND = 'Not found'; - const FORBIDDEN = 'Forbidden'; + public const FORBIDDEN = 'Forbidden'; - const UNAUTHORIZED = 'Unauthorized'; + public const UNAUTHORIZED = 'Unauthorized'; - const INVALID_DATA = 'Invalid data'; + public const INVALID_DATA = 'Invalid data'; - const INTERNAL_SERVER_ERROR = 'Internal Server Error'; + public const INTERNAL_SERVER_ERROR = 'Internal Server Error'; - const MISSING_DATA = 'Missing data'; + public const MISSING_DATA = 'Missing data'; - const METHOD_NOT_ALLOWED = 'Method not allowed'; + public const METHOD_NOT_ALLOWED = 'Method not allowed'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorTitlePhonebook.php b/lib/Model/ErrorTitlePhonebook.php index 5fe8354..e7c0305 100644 --- a/lib/Model/ErrorTitlePhonebook.php +++ b/lib/Model/ErrorTitlePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorTitlePhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,17 +44,17 @@ class ErrorTitlePhonebook /** * Possible values of this enum */ - const INVALID_DATA = 'Invalid data'; + public const INVALID_DATA = 'Invalid data'; - const UNAUTHORIZED = 'Unauthorized'; + public const UNAUTHORIZED = 'Unauthorized'; - const MISSING_RESOURCE = 'Missing resource'; + public const MISSING_RESOURCE = 'Missing resource'; - const CONFLICT = 'Conflict'; + public const CONFLICT = 'Conflict'; - const CLIENT_ERROR = 'Client error'; + public const CLIENT_ERROR = 'Client error'; - const GENERAL_ERROR = 'General error'; + public const GENERAL_ERROR = 'General error'; /** * Gets allowable values of the enum diff --git a/lib/Model/FetchBlacklistSuccess.php b/lib/Model/FetchBlacklistSuccess.php index 55fe1a5..12fd322 100644 --- a/lib/Model/FetchBlacklistSuccess.php +++ b/lib/Model/FetchBlacklistSuccess.php @@ -2,7 +2,7 @@ /** * FetchBlacklistSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSeriali 'phoneNumbers' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumbers'] = $data['phoneNumbers'] ?? null; + $this->setIfExists('phoneNumbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getPhoneNumbers() */ public function setPhoneNumbers($phoneNumbers) { + if (is_null($phoneNumbers)) { + throw new \InvalidArgumentException('non-nullable phoneNumbers cannot be null'); + } $this->container['phoneNumbers'] = $phoneNumbers; @@ -239,7 +326,7 @@ public function setPhoneNumbers($phoneNumbers) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupEnvelope.php b/lib/Model/GroupEnvelope.php index d2fd51c..60a9d7b 100644 --- a/lib/Model/GroupEnvelope.php +++ b/lib/Model/GroupEnvelope.php @@ -2,7 +2,7 @@ /** * GroupEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'group' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('group', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getGroup() */ public function setGroup($group) { + if (is_null($group)) { + throw new \InvalidArgumentException('non-nullable group cannot be null'); + } $this->container['group'] = $group; return $this; @@ -237,7 +324,7 @@ public function setGroup($group) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -249,6 +336,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -262,7 +350,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -278,7 +366,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -290,6 +378,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupListEnvelope.php b/lib/Model/GroupListEnvelope.php index da5982b..b0fc28c 100644 --- a/lib/Model/GroupListEnvelope.php +++ b/lib/Model/GroupListEnvelope.php @@ -2,7 +2,7 @@ /** * GroupListEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializabl 'groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['groups'] = $data['groups'] ?? null; + $this->setIfExists('groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getGroups() */ public function setGroups($groups) { + if (is_null($groups)) { + throw new \InvalidArgumentException('non-nullable groups cannot be null'); + } $this->container['groups'] = $groups; @@ -239,7 +326,7 @@ public function setGroups($groups) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupName.php b/lib/Model/GroupName.php index 5d6f31b..17725d9 100644 --- a/lib/Model/GroupName.php +++ b/lib/Model/GroupName.php @@ -2,7 +2,7 @@ /** * GroupName * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -233,6 +317,9 @@ public function getName() */ public function setName($name) { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } if ((mb_strlen($name) < 1)) { throw new \InvalidArgumentException('invalid length for $name when calling GroupName., must be bigger than or equal to 1.'); @@ -249,7 +336,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -261,6 +348,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -274,7 +362,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -290,7 +378,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -302,6 +390,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupResponseFields.php b/lib/Model/GroupResponseFields.php index 8da8935..e2632ba 100644 --- a/lib/Model/GroupResponseFields.php +++ b/lib/Model/GroupResponseFields.php @@ -2,7 +2,7 @@ /** * GroupResponseFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -81,6 +79,25 @@ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializa 'contactsCount' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'createdOn' => true, + 'contactsCount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -195,10 +264,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['createdOn'] = $data['createdOn'] ?? null; - $this->container['contactsCount'] = $data['contactsCount'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdOn', $data ?? [], null); + $this->setIfExists('contactsCount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -253,6 +340,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -277,6 +367,9 @@ public function getName() */ public function setName($name) { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -301,6 +394,16 @@ public function getCreatedOn() */ public function setCreatedOn($createdOn) { + if (is_null($createdOn)) { + array_push($this->openAPINullablesSetToNull, 'createdOn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdOn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['createdOn'] = $createdOn; return $this; @@ -325,6 +428,9 @@ public function getContactsCount() */ public function setContactsCount($contactsCount) { + if (is_null($contactsCount)) { + throw new \InvalidArgumentException('non-nullable contactsCount cannot be null'); + } $this->container['contactsCount'] = $contactsCount; return $this; @@ -336,7 +442,7 @@ public function setContactsCount($contactsCount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -348,6 +454,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -361,7 +468,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -377,7 +484,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -389,6 +496,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MessageResult.php b/lib/Model/MessageResult.php index 5955d04..1aa0a00 100644 --- a/lib/Model/MessageResult.php +++ b/lib/Model/MessageResult.php @@ -2,7 +2,7 @@ /** * MessageResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messageId' => false, + 'channel' => false, + 'sender' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['messageId'] = $data['messageId'] ?? null; - $this->container['channel'] = $data['channel'] ?? null; - $this->container['sender'] = $data['sender'] ?? null; + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getMessageId() */ public function setMessageId($messageId) { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -271,6 +360,9 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $this->container['channel'] = $channel; return $this; @@ -295,6 +387,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -306,7 +401,7 @@ public function setSender($sender) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MobileNetwork.php b/lib/Model/MobileNetwork.php index 8309511..009d7f5 100644 --- a/lib/Model/MobileNetwork.php +++ b/lib/Model/MobileNetwork.php @@ -2,7 +2,7 @@ /** * MobileNetwork * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -83,6 +81,26 @@ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable 'countryCode' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mccmnc' => false, + 'networkName' => false, + 'countryName' => false, + 'countryPrefix' => false, + 'countryCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +121,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -200,11 +270,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['mccmnc'] = $data['mccmnc'] ?? null; - $this->container['networkName'] = $data['networkName'] ?? null; - $this->container['countryName'] = $data['countryName'] ?? null; - $this->container['countryPrefix'] = $data['countryPrefix'] ?? null; - $this->container['countryCode'] = $data['countryCode'] ?? null; + $this->setIfExists('mccmnc', $data ?? [], null); + $this->setIfExists('networkName', $data ?? [], null); + $this->setIfExists('countryName', $data ?? [], null); + $this->setIfExists('countryPrefix', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -250,6 +338,9 @@ public function getMccmnc() */ public function setMccmnc($mccmnc) { + if (is_null($mccmnc)) { + throw new \InvalidArgumentException('non-nullable mccmnc cannot be null'); + } $this->container['mccmnc'] = $mccmnc; return $this; @@ -274,6 +365,9 @@ public function getNetworkName() */ public function setNetworkName($networkName) { + if (is_null($networkName)) { + throw new \InvalidArgumentException('non-nullable networkName cannot be null'); + } $this->container['networkName'] = $networkName; return $this; @@ -298,6 +392,9 @@ public function getCountryName() */ public function setCountryName($countryName) { + if (is_null($countryName)) { + throw new \InvalidArgumentException('non-nullable countryName cannot be null'); + } $this->container['countryName'] = $countryName; return $this; @@ -322,6 +419,9 @@ public function getCountryPrefix() */ public function setCountryPrefix($countryPrefix) { + if (is_null($countryPrefix)) { + throw new \InvalidArgumentException('non-nullable countryPrefix cannot be null'); + } $this->container['countryPrefix'] = $countryPrefix; return $this; @@ -346,6 +446,9 @@ public function getCountryCode() */ public function setCountryCode($countryCode) { + if (is_null($countryCode)) { + throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); + } $this->container['countryCode'] = $countryCode; return $this; @@ -357,7 +460,7 @@ public function setCountryCode($countryCode) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -369,6 +472,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -382,7 +486,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -398,7 +502,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -410,6 +514,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php index 672465c..da1a39e 100644 --- a/lib/Model/ModelInterface.php +++ b/lib/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api\Model @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -93,4 +93,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/lib/Model/NumberToBlacklist.php b/lib/Model/NumberToBlacklist.php index 59d996c..0c647b5 100644 --- a/lib/Model/NumberToBlacklist.php +++ b/lib/Model/NumberToBlacklist.php @@ -2,7 +2,7 @@ /** * NumberToBlacklist * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializabl 'phoneNumber' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -240,7 +327,7 @@ public function setPhoneNumber($phoneNumber) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/NumbersToInvestigate.php b/lib/Model/NumbersToInvestigate.php index 5f5b95c..fcdb632 100644 --- a/lib/Model/NumbersToInvestigate.php +++ b/lib/Model/NumbersToInvestigate.php @@ -2,7 +2,7 @@ /** * NumbersToInvestigate * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializ 'numbers' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'numbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['numbers'] = $data['numbers'] ?? null; + $this->setIfExists('numbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -237,6 +321,9 @@ public function getNumbers() */ public function setNumbers($numbers) { + if (is_null($numbers)) { + throw new \InvalidArgumentException('non-nullable numbers cannot be null'); + } if ((count($numbers) > 10)) { throw new \InvalidArgumentException('invalid value for $numbers when calling NumbersToInvestigate., number of items must be less than or equal to 10.'); @@ -255,7 +342,7 @@ public function setNumbers($numbers) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -267,6 +354,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -280,7 +368,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -296,7 +384,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,6 +396,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmniMessageCreateSuccessResponse.php b/lib/Model/OmniMessageCreateSuccessResponse.php index 387711d..51f9bf1 100644 --- a/lib/Model/OmniMessageCreateSuccessResponse.php +++ b/lib/Model/OmniMessageCreateSuccessResponse.php @@ -2,7 +2,7 @@ /** * OmniMessageCreateSuccessResponse * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \ 'omnimessageId' => 'UUID' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['messages'] = $data['messages'] ?? null; - $this->container['to'] = $data['to'] ?? null; - $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getMessages() */ public function setMessages($messages) { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } $this->container['messages'] = $messages; return $this; @@ -271,6 +360,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -295,6 +387,9 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -306,7 +401,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Omnimessage.php b/lib/Model/Omnimessage.php index f312944..873874f 100644 --- a/lib/Model/Omnimessage.php +++ b/lib/Model/Omnimessage.php @@ -2,7 +2,7 @@ /** * Omnimessage * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -62,7 +60,7 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'to' => 'string', - 'messages' => 'OneOfViberSMSWhatsAppTelegram[]', + 'messages' => '\Messente\Api\Model\OmnimessageMessagesInner[]', 'dlrUrl' => 'string', 'textStore' => '\Messente\Api\Model\TextStore', 'timeToSend' => '\DateTime', @@ -85,6 +83,27 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable 'priority' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to' => false, + 'messages' => false, + 'dlrUrl' => false, + 'textStore' => false, + 'timeToSend' => false, + 'priority' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +124,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -205,12 +276,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['to'] = $data['to'] ?? null; - $this->container['messages'] = $data['messages'] ?? null; - $this->container['dlrUrl'] = $data['dlrUrl'] ?? null; - $this->container['textStore'] = $data['textStore'] ?? null; - $this->container['timeToSend'] = $data['timeToSend'] ?? null; - $this->container['priority'] = $data['priority'] ?? null; + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('dlrUrl', $data ?? [], null); + $this->setIfExists('textStore', $data ?? [], null); + $this->setIfExists('timeToSend', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -262,6 +351,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -270,7 +362,7 @@ public function setTo($to) /** * Gets messages * - * @return OneOfViberSMSWhatsAppTelegram[] + * @return \Messente\Api\Model\OmnimessageMessagesInner[] */ public function getMessages() { @@ -280,12 +372,15 @@ public function getMessages() /** * Sets messages * - * @param OneOfViberSMSWhatsAppTelegram[] $messages An array of messages + * @param \Messente\Api\Model\OmnimessageMessagesInner[] $messages An array of messages * * @return self */ public function setMessages($messages) { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } $this->container['messages'] = $messages; return $this; @@ -310,6 +405,9 @@ public function getDlrUrl() */ public function setDlrUrl($dlrUrl) { + if (is_null($dlrUrl)) { + throw new \InvalidArgumentException('non-nullable dlrUrl cannot be null'); + } $this->container['dlrUrl'] = $dlrUrl; return $this; @@ -334,6 +432,9 @@ public function getTextStore() */ public function setTextStore($textStore) { + if (is_null($textStore)) { + throw new \InvalidArgumentException('non-nullable textStore cannot be null'); + } $this->container['textStore'] = $textStore; return $this; @@ -358,6 +459,9 @@ public function getTimeToSend() */ public function setTimeToSend($timeToSend) { + if (is_null($timeToSend)) { + throw new \InvalidArgumentException('non-nullable timeToSend cannot be null'); + } $this->container['timeToSend'] = $timeToSend; return $this; @@ -382,6 +486,9 @@ public function getPriority() */ public function setPriority($priority) { + if (is_null($priority)) { + throw new \InvalidArgumentException('non-nullable priority cannot be null'); + } $this->container['priority'] = $priority; return $this; @@ -393,7 +500,7 @@ public function setPriority($priority) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -405,6 +512,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -418,7 +526,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -434,7 +542,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -446,6 +554,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmnimessageMessagesInner.php b/lib/Model/OmnimessageMessagesInner.php new file mode 100644 index 0000000..efdac3d --- /dev/null +++ b/lib/Model/OmnimessageMessagesInner.php @@ -0,0 +1,889 @@ + + */ +class OmnimessageMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Omnimessage_messages_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'text' => 'string', + 'imageUrl' => 'string', + 'buttonUrl' => 'string', + 'buttonText' => 'string', + 'channel' => 'string', + 'autoconvert' => 'string', + 'udh' => 'string', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', + 'documentUrl' => 'string', + 'audioUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'text' => null, + 'imageUrl' => null, + 'buttonUrl' => null, + 'buttonText' => null, + 'channel' => null, + 'autoconvert' => null, + 'udh' => null, + 'template' => null, + 'documentUrl' => null, + 'audioUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false, + 'autoconvert' => false, + 'udh' => false, + 'template' => false, + 'documentUrl' => false, + 'audioUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'text' => 'text', + 'imageUrl' => 'image_url', + 'buttonUrl' => 'button_url', + 'buttonText' => 'button_text', + 'channel' => 'channel', + 'autoconvert' => 'autoconvert', + 'udh' => 'udh', + 'template' => 'template', + 'documentUrl' => 'document_url', + 'audioUrl' => 'audio_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'text' => 'setText', + 'imageUrl' => 'setImageUrl', + 'buttonUrl' => 'setButtonUrl', + 'buttonText' => 'setButtonText', + 'channel' => 'setChannel', + 'autoconvert' => 'setAutoconvert', + 'udh' => 'setUdh', + 'template' => 'setTemplate', + 'documentUrl' => 'setDocumentUrl', + 'audioUrl' => 'setAudioUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'text' => 'getText', + 'imageUrl' => 'getImageUrl', + 'buttonUrl' => 'getButtonUrl', + 'buttonText' => 'getButtonText', + 'channel' => 'getChannel', + 'autoconvert' => 'getAutoconvert', + 'udh' => 'getUdh', + 'template' => 'getTemplate', + 'documentUrl' => 'getDocumentUrl', + 'audioUrl' => 'getAudioUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_TELEGRAM = 'telegram'; + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_TELEGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoconvertAllowableValues() + { + return [ + self::AUTOCONVERT_FULL, + self::AUTOCONVERT_ON, + self::AUTOCONVERT_OFF, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'autoconvert', must be one of '%s'", + $this->container['autoconvert'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Plaintext content for Telegram + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets buttonUrl + * + * @return string|null + */ + public function getButtonUrl() + { + return $this->container['buttonUrl']; + } + + /** + * Sets buttonUrl + * + * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) + * + * @return self + */ + public function setButtonUrl($buttonUrl) + { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } + $this->container['buttonUrl'] = $buttonUrl; + + return $this; + } + + /** + * Gets buttonText + * + * @return string|null + */ + public function getButtonText() + { + return $this->container['buttonText']; + } + + /** + * Sets buttonText + * + * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) + * + * @return self + */ + public function setButtonText($buttonText) + { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } + $this->container['buttonText'] = $buttonText; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets autoconvert + * + * @return string|null + */ + public function getAutoconvert() + { + return $this->container['autoconvert']; + } + + /** + * Sets autoconvert + * + * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way + * + * @return self + */ + public function setAutoconvert($autoconvert) + { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!in_array($autoconvert, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'autoconvert', must be one of '%s'", + $autoconvert, + implode("', '", $allowedValues) + ) + ); + } + $this->container['autoconvert'] = $autoconvert; + + return $this; + } + + /** + * Gets udh + * + * @return string|null + */ + public function getUdh() + { + return $this->container['udh']; + } + + /** + * Sets udh + * + * @param string|null $udh hex-encoded string containing SMS UDH + * + * @return self + */ + public function setUdh($udh) + { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } + $this->container['udh'] = $udh; + + return $this; + } + + /** + * Gets template + * + * @return \Messente\Api\Model\WhatsAppTemplate|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template + * + * @return self + */ + public function setTemplate($template) + { + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets documentUrl + * + * @return string|null + */ + public function getDocumentUrl() + { + return $this->container['documentUrl']; + } + + /** + * Sets documentUrl + * + * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" + * + * @return self + */ + public function setDocumentUrl($documentUrl) + { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } + $this->container['documentUrl'] = $documentUrl; + + return $this; + } + + /** + * Gets audioUrl + * + * @return string|null + */ + public function getAudioUrl() + { + return $this->container['audioUrl']; + } + + /** + * Sets audioUrl + * + * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" + * + * @return self + */ + public function setAudioUrl($audioUrl) + { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } + $this->container['audioUrl'] = $audioUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Priority.php b/lib/Model/Priority.php index 609f6b5..716c782 100644 --- a/lib/Model/Priority.php +++ b/lib/Model/Priority.php @@ -2,7 +2,7 @@ /** * Priority * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,11 +44,11 @@ class Priority /** * Possible values of this enum */ - const LOW = 'low'; + public const LOW = 'low'; - const REGULAR = 'regular'; + public const REGULAR = 'regular'; - const HIGH = 'high'; + public const HIGH = 'high'; /** * Gets allowable values of the enum diff --git a/lib/Model/SMS.php b/lib/Model/SMS.php index 44acc1c..20c3614 100644 --- a/lib/Model/SMS.php +++ b/lib/Model/SMS.php @@ -2,7 +2,7 @@ /** * SMS * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -87,6 +85,28 @@ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'text' => false, + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'autoconvert' => false, + 'udh' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -107,6 +127,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -194,10 +266,10 @@ public function getModelName() return self::$openAPIModelName; } - const AUTOCONVERT_FULL = 'full'; - const AUTOCONVERT_ON = 'on'; - const AUTOCONVERT_OFF = 'off'; - const CHANNEL_SMS = 'sms'; + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + public const CHANNEL_SMS = 'sms'; /** * Gets allowable values of the enum @@ -240,13 +312,31 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['text'] = $data['text'] ?? null; - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['autoconvert'] = $data['autoconvert'] ?? null; - $this->container['udh'] = $data['udh'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'sms'; + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'sms'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -313,6 +403,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -337,6 +430,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -361,6 +457,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -385,6 +484,9 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; @@ -409,8 +511,11 @@ public function getAutoconvert() */ public function setAutoconvert($autoconvert) { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } $allowedValues = $this->getAutoconvertAllowableValues(); - if (!is_null($autoconvert) && !in_array($autoconvert, $allowedValues, true)) { + if (!in_array($autoconvert, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'autoconvert', must be one of '%s'", @@ -443,6 +548,9 @@ public function getUdh() */ public function setUdh($udh) { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } $this->container['udh'] = $udh; return $this; @@ -467,8 +575,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -488,7 +599,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -500,6 +611,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -513,7 +625,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -529,7 +641,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -541,6 +653,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReport.php b/lib/Model/StatisticsReport.php index 3e7d658..92e1647 100644 --- a/lib/Model/StatisticsReport.php +++ b/lib/Model/StatisticsReport.php @@ -2,7 +2,7 @@ /** * StatisticsReport * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable 'country' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalMessages' => false, + 'totalPrice' => false, + 'country' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['totalMessages'] = $data['totalMessages'] ?? null; - $this->container['totalPrice'] = $data['totalPrice'] ?? null; - $this->container['country'] = $data['country'] ?? null; + $this->setIfExists('totalMessages', $data ?? [], null); + $this->setIfExists('totalPrice', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTotalMessages() */ public function setTotalMessages($totalMessages) { + if (is_null($totalMessages)) { + throw new \InvalidArgumentException('non-nullable totalMessages cannot be null'); + } $this->container['totalMessages'] = $totalMessages; return $this; @@ -271,6 +360,9 @@ public function getTotalPrice() */ public function setTotalPrice($totalPrice) { + if (is_null($totalPrice)) { + throw new \InvalidArgumentException('non-nullable totalPrice cannot be null'); + } $this->container['totalPrice'] = $totalPrice; return $this; @@ -295,6 +387,9 @@ public function getCountry() */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -306,7 +401,7 @@ public function setCountry($country) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSettings.php b/lib/Model/StatisticsReportSettings.php index 74991c1..3d6ab50 100644 --- a/lib/Model/StatisticsReportSettings.php +++ b/lib/Model/StatisticsReportSettings.php @@ -2,7 +2,7 @@ /** * StatisticsReportSettings * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSeri 'messageTypes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startDate' => false, + 'endDate' => false, + 'messageTypes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['startDate'] = $data['startDate'] ?? null; - $this->container['endDate'] = $data['endDate'] ?? null; - $this->container['messageTypes'] = $data['messageTypes'] ?? null; + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('messageTypes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -244,6 +330,9 @@ public function getStartDate() */ public function setStartDate($startDate) { + if (is_null($startDate)) { + throw new \InvalidArgumentException('non-nullable startDate cannot be null'); + } $this->container['startDate'] = $startDate; return $this; @@ -268,6 +357,9 @@ public function getEndDate() */ public function setEndDate($endDate) { + if (is_null($endDate)) { + throw new \InvalidArgumentException('non-nullable endDate cannot be null'); + } $this->container['endDate'] = $endDate; return $this; @@ -292,6 +384,9 @@ public function getMessageTypes() */ public function setMessageTypes($messageTypes) { + if (is_null($messageTypes)) { + throw new \InvalidArgumentException('non-nullable messageTypes cannot be null'); + } $this->container['messageTypes'] = $messageTypes; return $this; @@ -303,7 +398,7 @@ public function setMessageTypes($messageTypes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -315,6 +410,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -328,7 +424,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -344,7 +440,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -356,6 +452,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSuccess.php b/lib/Model/StatisticsReportSuccess.php index 0178992..9fd94d0 100644 --- a/lib/Model/StatisticsReportSuccess.php +++ b/lib/Model/StatisticsReportSuccess.php @@ -2,7 +2,7 @@ /** * StatisticsReportSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'reports' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reports' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reports'] = $data['reports'] ?? null; + $this->setIfExists('reports', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getReports() */ public function setReports($reports) { + if (is_null($reports)) { + throw new \InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; @@ -240,7 +327,7 @@ public function setReports($reports) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Status.php b/lib/Model/Status.php index dcfbfeb..1fd018f 100644 --- a/lib/Model/Status.php +++ b/lib/Model/Status.php @@ -2,7 +2,7 @@ /** * Status * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,27 +44,27 @@ class Status /** * Possible values of this enum */ - const ACK = 'ACK'; + public const ACK = 'ACK'; - const DELIVRD = 'DELIVRD'; + public const DELIVRD = 'DELIVRD'; - const UNDELIV = 'UNDELIV'; + public const UNDELIV = 'UNDELIV'; - const FAILED = 'FAILED'; + public const FAILED = 'FAILED'; - const UNKNOWN = 'UNKNOWN'; + public const UNKNOWN = 'UNKNOWN'; - const ACCEPTD = 'ACCEPTD'; + public const ACCEPTD = 'ACCEPTD'; - const REJECTD = 'REJECTD'; + public const REJECTD = 'REJECTD'; - const DELETED = 'DELETED'; + public const DELETED = 'DELETED'; - const EXPIRED = 'EXPIRED'; + public const EXPIRED = 'EXPIRED'; - const NACK = 'NACK'; + public const NACK = 'NACK'; - const SEEN = 'SEEN'; + public const SEEN = 'SEEN'; /** * Gets allowable values of the enum diff --git a/lib/Model/SyncNumberLookupResult.php b/lib/Model/SyncNumberLookupResult.php index 15f25c9..a291c18 100644 --- a/lib/Model/SyncNumberLookupResult.php +++ b/lib/Model/SyncNumberLookupResult.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -91,6 +89,30 @@ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerial 'error' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'roaming' => true, + 'ported' => true, + 'roamingNetwork' => true, + 'currentNetwork' => true, + 'originalNetwork' => true, + 'portedNetwork' => true, + 'status' => false, + 'error' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -111,6 +133,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -204,10 +278,10 @@ public function getModelName() return self::$openAPIModelName; } - const STATUS_ON = 'ON'; - const STATUS_OFF = 'OFF'; - const STATUS_INVALID = 'INVALID'; - const STATUS_UNKNOWN = 'UNKNOWN'; + public const STATUS_ON = 'ON'; + public const STATUS_OFF = 'OFF'; + public const STATUS_INVALID = 'INVALID'; + public const STATUS_UNKNOWN = 'UNKNOWN'; /** * Gets allowable values of the enum @@ -239,15 +313,33 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; - $this->container['roaming'] = $data['roaming'] ?? null; - $this->container['ported'] = $data['ported'] ?? null; - $this->container['roamingNetwork'] = $data['roamingNetwork'] ?? null; - $this->container['currentNetwork'] = $data['currentNetwork'] ?? null; - $this->container['originalNetwork'] = $data['originalNetwork'] ?? null; - $this->container['portedNetwork'] = $data['portedNetwork'] ?? null; - $this->container['status'] = $data['status'] ?? null; - $this->container['error'] = $data['error'] ?? null; + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('roaming', $data ?? [], null); + $this->setIfExists('ported', $data ?? [], null); + $this->setIfExists('roamingNetwork', $data ?? [], null); + $this->setIfExists('currentNetwork', $data ?? [], null); + $this->setIfExists('originalNetwork', $data ?? [], null); + $this->setIfExists('portedNetwork', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -305,6 +397,9 @@ public function getNumber() */ public function setNumber($number) { + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -329,6 +424,16 @@ public function getRoaming() */ public function setRoaming($roaming) { + if (is_null($roaming)) { + array_push($this->openAPINullablesSetToNull, 'roaming'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roaming', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['roaming'] = $roaming; return $this; @@ -353,6 +458,16 @@ public function getPorted() */ public function setPorted($ported) { + if (is_null($ported)) { + array_push($this->openAPINullablesSetToNull, 'ported'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ported', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['ported'] = $ported; return $this; @@ -377,6 +492,16 @@ public function getRoamingNetwork() */ public function setRoamingNetwork($roamingNetwork) { + if (is_null($roamingNetwork)) { + array_push($this->openAPINullablesSetToNull, 'roamingNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roamingNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['roamingNetwork'] = $roamingNetwork; return $this; @@ -401,6 +526,16 @@ public function getCurrentNetwork() */ public function setCurrentNetwork($currentNetwork) { + if (is_null($currentNetwork)) { + array_push($this->openAPINullablesSetToNull, 'currentNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currentNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['currentNetwork'] = $currentNetwork; return $this; @@ -425,6 +560,16 @@ public function getOriginalNetwork() */ public function setOriginalNetwork($originalNetwork) { + if (is_null($originalNetwork)) { + array_push($this->openAPINullablesSetToNull, 'originalNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('originalNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['originalNetwork'] = $originalNetwork; return $this; @@ -449,6 +594,16 @@ public function getPortedNetwork() */ public function setPortedNetwork($portedNetwork) { + if (is_null($portedNetwork)) { + array_push($this->openAPINullablesSetToNull, 'portedNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('portedNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['portedNetwork'] = $portedNetwork; return $this; @@ -473,8 +628,11 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'status', must be one of '%s'", @@ -507,6 +665,16 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['error'] = $error; return $this; @@ -518,7 +686,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -530,6 +698,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -543,7 +712,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -559,7 +728,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -571,6 +740,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/SyncNumberLookupSuccess.php b/lib/Model/SyncNumberLookupSuccess.php index c00b889..95b8e82 100644 --- a/lib/Model/SyncNumberLookupSuccess.php +++ b/lib/Model/SyncNumberLookupSuccess.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,6 +75,23 @@ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'requestId' => false, + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['requestId'] = $data['requestId'] ?? null; - $this->container['result'] = $data['result'] ?? null; + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -238,6 +323,9 @@ public function getRequestId() */ public function setRequestId($requestId) { + if (is_null($requestId)) { + throw new \InvalidArgumentException('non-nullable requestId cannot be null'); + } $this->container['requestId'] = $requestId; return $this; @@ -262,6 +350,9 @@ public function getResult() */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -273,7 +364,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,6 +376,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -298,7 +390,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -314,7 +406,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -326,6 +418,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Telegram.php b/lib/Model/Telegram.php index f033906..438ca6f 100644 --- a/lib/Model/Telegram.php +++ b/lib/Model/Telegram.php @@ -2,7 +2,7 @@ /** * Telegram * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -87,6 +85,28 @@ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'text' => false, + 'imageUrl' => false, + 'documentUrl' => false, + 'audioUrl' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -107,6 +127,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -194,7 +266,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_TELEGRAM = 'telegram'; + public const CHANNEL_TELEGRAM = 'telegram'; /** * Gets allowable values of the enum @@ -223,13 +295,31 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['imageUrl'] = $data['imageUrl'] ?? null; - $this->container['documentUrl'] = $data['documentUrl'] ?? null; - $this->container['audioUrl'] = $data['audioUrl'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'telegram'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -284,6 +374,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -308,6 +401,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -332,6 +428,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -356,6 +455,9 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -380,6 +482,9 @@ public function getDocumentUrl() */ public function setDocumentUrl($documentUrl) { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } $this->container['documentUrl'] = $documentUrl; return $this; @@ -404,6 +509,9 @@ public function getAudioUrl() */ public function setAudioUrl($audioUrl) { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } $this->container['audioUrl'] = $audioUrl; return $this; @@ -428,8 +536,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -449,7 +560,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -461,6 +572,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -474,7 +586,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -490,7 +602,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -502,6 +614,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/TextStore.php b/lib/Model/TextStore.php index e06dd53..ad7e107 100644 --- a/lib/Model/TextStore.php +++ b/lib/Model/TextStore.php @@ -2,7 +2,7 @@ /** * TextStore * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,11 +44,11 @@ class TextStore /** * Possible values of this enum */ - const NOSTORE = 'nostore'; + public const NOSTORE = 'nostore'; - const PLAINTEXT = 'plaintext'; + public const PLAINTEXT = 'plaintext'; - const SHA256 = 'sha256'; + public const SHA256 = 'sha256'; /** * Gets allowable values of the enum diff --git a/lib/Model/Viber.php b/lib/Model/Viber.php index 0447d57..af4db61 100644 --- a/lib/Model/Viber.php +++ b/lib/Model/Viber.php @@ -2,7 +2,7 @@ /** * Viber * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -89,6 +87,29 @@ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -109,6 +130,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -199,7 +272,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_VIBER = 'viber'; + public const CHANNEL_VIBER = 'viber'; /** * Gets allowable values of the enum @@ -228,14 +301,32 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['imageUrl'] = $data['imageUrl'] ?? null; - $this->container['buttonUrl'] = $data['buttonUrl'] ?? null; - $this->container['buttonText'] = $data['buttonText'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'viber'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'viber'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -290,6 +381,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -314,6 +408,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -338,6 +435,9 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; @@ -362,6 +462,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -386,6 +489,9 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -410,6 +516,9 @@ public function getButtonUrl() */ public function setButtonUrl($buttonUrl) { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } $this->container['buttonUrl'] = $buttonUrl; return $this; @@ -434,6 +543,9 @@ public function getButtonText() */ public function setButtonText($buttonText) { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } $this->container['buttonText'] = $buttonText; return $this; @@ -458,8 +570,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -479,7 +594,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -491,6 +606,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -504,7 +620,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -520,7 +636,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -532,6 +648,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php index 7524052..ae2ef73 100644 --- a/lib/Model/WhatsApp.php +++ b/lib/Model/WhatsApp.php @@ -2,7 +2,7 @@ /** * WhatsApp * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -83,6 +81,26 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'template' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +121,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -184,7 +254,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_WHATSAPP = 'whatsapp'; + public const CHANNEL_WHATSAPP = 'whatsapp'; /** * Gets allowable values of the enum @@ -213,11 +283,29 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['template'] = $data['template'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'whatsapp'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'whatsapp'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -272,6 +360,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -296,6 +387,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -320,6 +414,9 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; @@ -344,6 +441,9 @@ public function getTemplate() */ public function setTemplate($template) { + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -368,8 +468,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -389,7 +492,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -401,6 +504,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -414,7 +518,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -430,7 +534,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -442,6 +546,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppComponent.php b/lib/Model/WhatsAppComponent.php index 2a3b702..630b72b 100644 --- a/lib/Model/WhatsAppComponent.php +++ b/lib/Model/WhatsAppComponent.php @@ -2,7 +2,7 @@ /** * WhatsAppComponent * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -62,6 +60,8 @@ class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPITypes = [ 'type' => 'string', + 'subType' => 'string', + 'index' => 'int', 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' ]; @@ -74,9 +74,30 @@ class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPIFormats = [ 'type' => null, + 'subType' => null, + 'index' => null, 'parameters' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'subType' => false, + 'index' => false, + 'parameters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +118,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -105,6 +178,8 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'type' => 'type', + 'subType' => 'sub_type', + 'index' => 'index', 'parameters' => 'parameters' ]; @@ -115,6 +190,8 @@ public static function openAPIFormats() */ protected static $setters = [ 'type' => 'setType', + 'subType' => 'setSubType', + 'index' => 'setIndex', 'parameters' => 'setParameters' ]; @@ -125,6 +202,8 @@ public static function openAPIFormats() */ protected static $getters = [ 'type' => 'getType', + 'subType' => 'getSubType', + 'index' => 'getIndex', 'parameters' => 'getParameters' ]; @@ -185,8 +264,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['parameters'] = $data['parameters'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('subType', $data ?? [], null); + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -235,11 +334,68 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; } + /** + * Gets subType + * + * @return string|null + */ + public function getSubType() + { + return $this->container['subType']; + } + + /** + * Sets subType + * + * @param string|null $subType Sub-type of the component + * + * @return self + */ + public function setSubType($subType) + { + if (is_null($subType)) { + throw new \InvalidArgumentException('non-nullable subType cannot be null'); + } + $this->container['subType'] = $subType; + + return $this; + } + + /** + * Gets index + * + * @return int|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int|null $index index used to position buttons + * + * @return self + */ + public function setIndex($index) + { + if (is_null($index)) { + throw new \InvalidArgumentException('non-nullable index cannot be null'); + } + $this->container['index'] = $index; + + return $this; + } + /** * Gets parameters * @@ -259,6 +415,9 @@ public function getParameters() */ public function setParameters($parameters) { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } $this->container['parameters'] = $parameters; return $this; @@ -270,7 +429,7 @@ public function setParameters($parameters) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +441,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +455,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +471,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +483,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppLanguage.php b/lib/Model/WhatsAppLanguage.php index 1ab9b7b..96e31e8 100644 --- a/lib/Model/WhatsAppLanguage.php +++ b/lib/Model/WhatsAppLanguage.php @@ -2,7 +2,7 @@ /** * WhatsAppLanguage * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,6 +75,23 @@ class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable 'policy' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => false, + 'policy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['code'] = $data['code'] ?? null; - $this->container['policy'] = $data['policy'] ?? null; + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('policy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -235,6 +320,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -259,6 +347,9 @@ public function getPolicy() */ public function setPolicy($policy) { + if (is_null($policy)) { + throw new \InvalidArgumentException('non-nullable policy cannot be null'); + } $this->container['policy'] = $policy; return $this; @@ -270,7 +361,7 @@ public function setPolicy($policy) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +373,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +387,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +403,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +415,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppParameter.php b/lib/Model/WhatsAppParameter.php index 5aa6695..68f7fe0 100644 --- a/lib/Model/WhatsAppParameter.php +++ b/lib/Model/WhatsAppParameter.php @@ -2,7 +2,7 @@ /** * WhatsAppParameter * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -62,7 +60,12 @@ class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPITypes = [ 'type' => 'string', - 'text' => 'string' + 'text' => 'string', + 'currency' => 'object', + 'dateTime' => 'object', + 'image' => 'object', + 'document' => 'object', + 'video' => 'object' ]; /** @@ -74,9 +77,36 @@ class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializabl */ protected static $openAPIFormats = [ 'type' => null, - 'text' => null + 'text' => null, + 'currency' => null, + 'dateTime' => null, + 'image' => null, + 'document' => null, + 'video' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'currency' => false, + 'dateTime' => false, + 'image' => false, + 'document' => false, + 'video' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +127,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -105,7 +187,12 @@ public static function openAPIFormats() */ protected static $attributeMap = [ 'type' => 'type', - 'text' => 'text' + 'text' => 'text', + 'currency' => 'currency', + 'dateTime' => 'date_time', + 'image' => 'image', + 'document' => 'document', + 'video' => 'video' ]; /** @@ -115,7 +202,12 @@ public static function openAPIFormats() */ protected static $setters = [ 'type' => 'setType', - 'text' => 'setText' + 'text' => 'setText', + 'currency' => 'setCurrency', + 'dateTime' => 'setDateTime', + 'image' => 'setImage', + 'document' => 'setDocument', + 'video' => 'setVideo' ]; /** @@ -125,7 +217,12 @@ public static function openAPIFormats() */ protected static $getters = [ 'type' => 'getType', - 'text' => 'getText' + 'text' => 'getText', + 'currency' => 'getCurrency', + 'dateTime' => 'getDateTime', + 'image' => 'getImage', + 'document' => 'getDocument', + 'video' => 'getVideo' ]; /** @@ -185,8 +282,31 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['text'] = $data['text'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('dateTime', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('document', $data ?? [], null); + $this->setIfExists('video', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -235,6 +355,9 @@ public function getType() */ public function setType($type) { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -259,10 +382,148 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; } + + /** + * Gets currency + * + * @return object|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param object|null $currency A currency object + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets dateTime + * + * @return object|null + */ + public function getDateTime() + { + return $this->container['dateTime']; + } + + /** + * Sets dateTime + * + * @param object|null $dateTime A date_time object + * + * @return self + */ + public function setDateTime($dateTime) + { + if (is_null($dateTime)) { + throw new \InvalidArgumentException('non-nullable dateTime cannot be null'); + } + $this->container['dateTime'] = $dateTime; + + return $this; + } + + /** + * Gets image + * + * @return object|null + */ + public function getImage() + { + return $this->container['image']; + } + + /** + * Sets image + * + * @param object|null $image A media object of type image + * + * @return self + */ + public function setImage($image) + { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } + $this->container['image'] = $image; + + return $this; + } + + /** + * Gets document + * + * @return object|null + */ + public function getDocument() + { + return $this->container['document']; + } + + /** + * Sets document + * + * @param object|null $document A media object of type document + * + * @return self + */ + public function setDocument($document) + { + if (is_null($document)) { + throw new \InvalidArgumentException('non-nullable document cannot be null'); + } + $this->container['document'] = $document; + + return $this; + } + + /** + * Gets video + * + * @return object|null + */ + public function getVideo() + { + return $this->container['video']; + } + + /** + * Sets video + * + * @param object|null $video A media object of type video + * + * @return self + */ + public function setVideo($video) + { + if (is_null($video)) { + throw new \InvalidArgumentException('non-nullable video cannot be null'); + } + $this->container['video'] = $video; + + return $this; + } /** * Returns true if offset exists. False otherwise. * @@ -270,7 +531,7 @@ public function setText($text) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +543,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +557,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +573,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +585,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppTemplate.php b/lib/Model/WhatsAppTemplate.php index 1fc96e0..06d3d7c 100644 --- a/lib/Model/WhatsAppTemplate.php +++ b/lib/Model/WhatsAppTemplate.php @@ -2,7 +2,7 @@ /** * WhatsAppTemplate * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable 'components' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'language' => false, + 'components' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['language'] = $data['language'] ?? null; - $this->container['components'] = $data['components'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('components', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -244,6 +330,9 @@ public function getName() */ public function setName($name) { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -268,6 +357,9 @@ public function getLanguage() */ public function setLanguage($language) { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } $this->container['language'] = $language; return $this; @@ -292,6 +384,9 @@ public function getComponents() */ public function setComponents($components) { + if (is_null($components)) { + throw new \InvalidArgumentException('non-nullable components cannot be null'); + } $this->container['components'] = $components; return $this; @@ -303,7 +398,7 @@ public function setComponents($components) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -315,6 +410,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -328,7 +424,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -344,7 +440,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -356,6 +452,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index 2a1510f..6f7fd57 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -29,6 +29,7 @@ namespace Messente\Api; +use GuzzleHttp\Psr7\Utils; use Messente\Api\Model\ModelInterface; /** @@ -87,7 +88,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +99,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -130,6 +131,20 @@ public static function sanitizeFilename($filename) } } + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + /** * Take value and turn it into a string suitable for inclusion in * the path, by url-encoding. @@ -144,22 +159,141 @@ public static function toPathValue($value) } /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. + * Checks if a value is empty, based on its OpenAPI type. * - * @param string[]|string|\DateTime $object an object to be serialized to a string + * @param mixed $value + * @param string $openApiType * - * @return string the serialized object + * @return bool true if $value is empty */ - public static function toQueryValue($object) + private static function isEmptyValue($value, string $openApiType): bool { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; } + + return (int) $value; } /** @@ -205,7 +339,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -216,7 +350,7 @@ public static function toString($value) } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { - return $value; + return (string) $value; } } @@ -263,7 +397,6 @@ public static function serializeCollection(array $collection, $style, $allowColl * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used * * @return object|array|null a single or an array of $class instances */ @@ -306,13 +439,13 @@ public static function deserialize($data, $class, $httpHeaders = null) if ($class === 'object') { settype($data, 'array'); return $data; - } else if ($class === 'mixed') { + } elseif ($class === 'mixed') { settype($data, gettype($data)); return $data; } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -322,29 +455,27 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond - // precision for php's DateTime to handle. This conversion - // (string -> unix timestamp -> DateTime) is a workaround - // for the problem. - return (new \DateTime())->setTimestamp(strtotime($data)); + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); } } else { return null; } } - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (array_key_exists('Content-Disposition', $httpHeaders) && - preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); @@ -357,7 +488,16 @@ public static function deserialize($data, $class, $httpHeaders = null) fclose($file); return new \SplFileObject($filename, 'r'); - } elseif (method_exists($class, 'getAllowableEnumValues')) { + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); @@ -365,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -379,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } @@ -391,4 +544,66 @@ public static function deserialize($data, $class, $httpHeaders = null) return $instance; } } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } } diff --git a/test/Api/BlacklistApiTest.php b/test/Api/BlacklistApiTest.php deleted file mode 100644 index 4a9cd00..0000000 --- a/test/Api/BlacklistApiTest.php +++ /dev/null @@ -1,122 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteFromBlacklist - * - * Deletes a phone number from the blacklist. - * - */ - public function testDeleteFromBlacklist() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchBlacklist - * - * Returns all blacklisted phone numbers. - * - */ - public function testFetchBlacklist() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for isBlacklisted - * - * Checks if a phone number is blacklisted. - * - */ - public function testIsBlacklisted() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/ContactsApiTest.php b/test/Api/ContactsApiTest.php deleted file mode 100644 index 7cbcd7e..0000000 --- a/test/Api/ContactsApiTest.php +++ /dev/null @@ -1,170 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for createContact - * - * Creates a new contact. - * - */ - public function testCreateContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteContact - * - * Deletes a contact. - * - */ - public function testDeleteContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContact - * - * Lists a contact. - * - */ - public function testFetchContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContactGroups - * - * Lists groups of a contact. - * - */ - public function testFetchContactGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContacts - * - * Returns all contacts. - * - */ - public function testFetchContacts() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for removeContactFromGroup - * - * Removes a contact from a group. - * - */ - public function testRemoveContactFromGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for updateContact - * - * Updates a contact. - * - */ - public function testUpdateContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/DeliveryReportApiTest.php b/test/Api/DeliveryReportApiTest.php deleted file mode 100644 index cce94dd..0000000 --- a/test/Api/DeliveryReportApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/GroupsApiTest.php b/test/Api/GroupsApiTest.php deleted file mode 100644 index 3faadc3..0000000 --- a/test/Api/GroupsApiTest.php +++ /dev/null @@ -1,134 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteGroup - * - * Deletes a group. - * - */ - public function testDeleteGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchGroup - * - * Lists a group. - * - */ - public function testFetchGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchGroups - * - * Returns all groups. - * - */ - public function testFetchGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for updateGroup - * - * Updates a group with the provided name. - * - */ - public function testUpdateGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/NumberLookupApiTest.php b/test/Api/NumberLookupApiTest.php deleted file mode 100644 index f64ee88..0000000 --- a/test/Api/NumberLookupApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/OmnimessageApiTest.php b/test/Api/OmnimessageApiTest.php deleted file mode 100644 index 6b61e27..0000000 --- a/test/Api/OmnimessageApiTest.php +++ /dev/null @@ -1,98 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for sendOmnimessage - * - * Sends an Omnimessage. - * - */ - public function testSendOmnimessage() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/StatisticsApiTest.php b/test/Api/StatisticsApiTest.php deleted file mode 100644 index 10f2646..0000000 --- a/test/Api/StatisticsApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ChannelTest.php b/test/Model/ChannelTest.php deleted file mode 100644 index 5d478ad..0000000 --- a/test/Model/ChannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactEnvelopeTest.php b/test/Model/ContactEnvelopeTest.php deleted file mode 100644 index ad42b6a..0000000 --- a/test/Model/ContactEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contact" - */ - public function testPropertyContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactFieldsTest.php b/test/Model/ContactFieldsTest.php deleted file mode 100644 index 7fa774d..0000000 --- a/test/Model/ContactFieldsTest.php +++ /dev/null @@ -1,172 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactListEnvelopeTest.php b/test/Model/ContactListEnvelopeTest.php deleted file mode 100644 index bde0072..0000000 --- a/test/Model/ContactListEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contacts" - */ - public function testPropertyContacts() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactResponseFieldsTest.php b/test/Model/ContactResponseFieldsTest.php deleted file mode 100644 index 0709a33..0000000 --- a/test/Model/ContactResponseFieldsTest.php +++ /dev/null @@ -1,181 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "scheduledDeletionDate" - */ - public function testPropertyScheduledDeletionDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactUpdateFieldsTest.php b/test/Model/ContactUpdateFieldsTest.php deleted file mode 100644 index c179501..0000000 --- a/test/Model/ContactUpdateFieldsTest.php +++ /dev/null @@ -1,163 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/DeliveryReportResponseTest.php b/test/Model/DeliveryReportResponseTest.php deleted file mode 100644 index 8bb70a1..0000000 --- a/test/Model/DeliveryReportResponseTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "statuses" - */ - public function testPropertyStatuses() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "omnimessageId" - */ - public function testPropertyOmnimessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/DeliveryResultTest.php b/test/Model/DeliveryResultTest.php deleted file mode 100644 index a1e207b..0000000 --- a/test/Model/DeliveryResultTest.php +++ /dev/null @@ -1,136 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "status" - */ - public function testPropertyStatus() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageId" - */ - public function testPropertyMessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "err" - */ - public function testPropertyErr() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "timestamp" - */ - public function testPropertyTimestamp() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeOmnichannelMachineTest.php b/test/Model/ErrorCodeOmnichannelMachineTest.php deleted file mode 100644 index 1cdf214..0000000 --- a/test/Model/ErrorCodeOmnichannelMachineTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeOmnichannelTest.php b/test/Model/ErrorCodeOmnichannelTest.php deleted file mode 100644 index 78fddb5..0000000 --- a/test/Model/ErrorCodeOmnichannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodePhonebookTest.php b/test/Model/ErrorCodePhonebookTest.php deleted file mode 100644 index 71bc429..0000000 --- a/test/Model/ErrorCodePhonebookTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeStatisticsTest.php b/test/Model/ErrorCodeStatisticsTest.php deleted file mode 100644 index f03468e..0000000 --- a/test/Model/ErrorCodeStatisticsTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemNumberLookupErrorTest.php b/test/Model/ErrorItemNumberLookupErrorTest.php deleted file mode 100644 index 8885f53..0000000 --- a/test/Model/ErrorItemNumberLookupErrorTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "description" - */ - public function testPropertyDescription() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemNumberLookupTest.php b/test/Model/ErrorItemNumberLookupTest.php deleted file mode 100644 index 9246aa1..0000000 --- a/test/Model/ErrorItemNumberLookupTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemOmnichannelTest.php b/test/Model/ErrorItemOmnichannelTest.php deleted file mode 100644 index ae5544a..0000000 --- a/test/Model/ErrorItemOmnichannelTest.php +++ /dev/null @@ -1,118 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "detail" - */ - public function testPropertyDetail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "source" - */ - public function testPropertySource() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemPhonebookTest.php b/test/Model/ErrorItemPhonebookTest.php deleted file mode 100644 index 4d28e07..0000000 --- a/test/Model/ErrorItemPhonebookTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "detail" - */ - public function testPropertyDetail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemStatisticsTest.php b/test/Model/ErrorItemStatisticsTest.php deleted file mode 100644 index 24e42b7..0000000 --- a/test/Model/ErrorItemStatisticsTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "details" - */ - public function testPropertyDetails() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorNumberLookupTest.php b/test/Model/ErrorNumberLookupTest.php deleted file mode 100644 index 27b57c4..0000000 --- a/test/Model/ErrorNumberLookupTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorOmnichannelTest.php b/test/Model/ErrorOmnichannelTest.php deleted file mode 100644 index 5f1e138..0000000 --- a/test/Model/ErrorOmnichannelTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorPhonebookTest.php b/test/Model/ErrorPhonebookTest.php deleted file mode 100644 index 4e836bf..0000000 --- a/test/Model/ErrorPhonebookTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorStatisticsTest.php b/test/Model/ErrorStatisticsTest.php deleted file mode 100644 index 4272499..0000000 --- a/test/Model/ErrorStatisticsTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorTitleOmnichannelTest.php b/test/Model/ErrorTitleOmnichannelTest.php deleted file mode 100644 index c29096a..0000000 --- a/test/Model/ErrorTitleOmnichannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorTitlePhonebookTest.php b/test/Model/ErrorTitlePhonebookTest.php deleted file mode 100644 index 2816116..0000000 --- a/test/Model/ErrorTitlePhonebookTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/FetchBlacklistSuccessTest.php b/test/Model/FetchBlacklistSuccessTest.php deleted file mode 100644 index a93ea6f..0000000 --- a/test/Model/FetchBlacklistSuccessTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumbers" - */ - public function testPropertyPhoneNumbers() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupEnvelopeTest.php b/test/Model/GroupEnvelopeTest.php deleted file mode 100644 index ac7b3b1..0000000 --- a/test/Model/GroupEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "group" - */ - public function testPropertyGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupListEnvelopeTest.php b/test/Model/GroupListEnvelopeTest.php deleted file mode 100644 index 47b2f4b..0000000 --- a/test/Model/GroupListEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "groups" - */ - public function testPropertyGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupNameTest.php b/test/Model/GroupNameTest.php deleted file mode 100644 index 82a5d94..0000000 --- a/test/Model/GroupNameTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "name" - */ - public function testPropertyName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupResponseFieldsTest.php b/test/Model/GroupResponseFieldsTest.php deleted file mode 100644 index cd5136a..0000000 --- a/test/Model/GroupResponseFieldsTest.php +++ /dev/null @@ -1,118 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "id" - */ - public function testPropertyId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "name" - */ - public function testPropertyName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "createdOn" - */ - public function testPropertyCreatedOn() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contactsCount" - */ - public function testPropertyContactsCount() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/MessageResultTest.php b/test/Model/MessageResultTest.php deleted file mode 100644 index 778d4dc..0000000 --- a/test/Model/MessageResultTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageId" - */ - public function testPropertyMessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/MobileNetworkTest.php b/test/Model/MobileNetworkTest.php deleted file mode 100644 index 6b19db3..0000000 --- a/test/Model/MobileNetworkTest.php +++ /dev/null @@ -1,127 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "mccmnc" - */ - public function testPropertyMccmnc() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "networkName" - */ - public function testPropertyNetworkName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryName" - */ - public function testPropertyCountryName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryPrefix" - */ - public function testPropertyCountryPrefix() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryCode" - */ - public function testPropertyCountryCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/NumberToBlacklistTest.php b/test/Model/NumberToBlacklistTest.php deleted file mode 100644 index 2b005cd..0000000 --- a/test/Model/NumberToBlacklistTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/NumbersToInvestigateTest.php b/test/Model/NumbersToInvestigateTest.php deleted file mode 100644 index 54c17fb..0000000 --- a/test/Model/NumbersToInvestigateTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "numbers" - */ - public function testPropertyNumbers() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/OmniMessageCreateSuccessResponseTest.php b/test/Model/OmniMessageCreateSuccessResponseTest.php deleted file mode 100644 index 1544f73..0000000 --- a/test/Model/OmniMessageCreateSuccessResponseTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messages" - */ - public function testPropertyMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "omnimessageId" - */ - public function testPropertyOmnimessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/OmnimessageTest.php b/test/Model/OmnimessageTest.php deleted file mode 100644 index c498a37..0000000 --- a/test/Model/OmnimessageTest.php +++ /dev/null @@ -1,136 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messages" - */ - public function testPropertyMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "dlrUrl" - */ - public function testPropertyDlrUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "textStore" - */ - public function testPropertyTextStore() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "timeToSend" - */ - public function testPropertyTimeToSend() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "priority" - */ - public function testPropertyPriority() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/PriorityTest.php b/test/Model/PriorityTest.php deleted file mode 100644 index 124fe12..0000000 --- a/test/Model/PriorityTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SMSTest.php b/test/Model/SMSTest.php deleted file mode 100644 index 3ab9316..0000000 --- a/test/Model/SMSTest.php +++ /dev/null @@ -1,145 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "autoconvert" - */ - public function testPropertyAutoconvert() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "udh" - */ - public function testPropertyUdh() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportSettingsTest.php b/test/Model/StatisticsReportSettingsTest.php deleted file mode 100644 index d73d235..0000000 --- a/test/Model/StatisticsReportSettingsTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "startDate" - */ - public function testPropertyStartDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "endDate" - */ - public function testPropertyEndDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageTypes" - */ - public function testPropertyMessageTypes() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportSuccessTest.php b/test/Model/StatisticsReportSuccessTest.php deleted file mode 100644 index f200c05..0000000 --- a/test/Model/StatisticsReportSuccessTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "reports" - */ - public function testPropertyReports() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportTest.php b/test/Model/StatisticsReportTest.php deleted file mode 100644 index 8a4021a..0000000 --- a/test/Model/StatisticsReportTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "totalMessages" - */ - public function testPropertyTotalMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "totalPrice" - */ - public function testPropertyTotalPrice() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "country" - */ - public function testPropertyCountry() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatusTest.php b/test/Model/StatusTest.php deleted file mode 100644 index 10530f9..0000000 --- a/test/Model/StatusTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SyncNumberLookupResultTest.php b/test/Model/SyncNumberLookupResultTest.php deleted file mode 100644 index 8eb6dae..0000000 --- a/test/Model/SyncNumberLookupResultTest.php +++ /dev/null @@ -1,163 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "number" - */ - public function testPropertyNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "roaming" - */ - public function testPropertyRoaming() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ported" - */ - public function testPropertyPorted() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "roamingNetwork" - */ - public function testPropertyRoamingNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "currentNetwork" - */ - public function testPropertyCurrentNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "originalNetwork" - */ - public function testPropertyOriginalNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "portedNetwork" - */ - public function testPropertyPortedNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "status" - */ - public function testPropertyStatus() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SyncNumberLookupSuccessTest.php b/test/Model/SyncNumberLookupSuccessTest.php deleted file mode 100644 index 1274234..0000000 --- a/test/Model/SyncNumberLookupSuccessTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "requestId" - */ - public function testPropertyRequestId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "result" - */ - public function testPropertyResult() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/TelegramTest.php b/test/Model/TelegramTest.php deleted file mode 100644 index 6a88027..0000000 --- a/test/Model/TelegramTest.php +++ /dev/null @@ -1,145 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "imageUrl" - */ - public function testPropertyImageUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "documentUrl" - */ - public function testPropertyDocumentUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "audioUrl" - */ - public function testPropertyAudioUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/TextStoreTest.php b/test/Model/TextStoreTest.php deleted file mode 100644 index 70ff6ca..0000000 --- a/test/Model/TextStoreTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ViberTest.php b/test/Model/ViberTest.php deleted file mode 100644 index f15e95e..0000000 --- a/test/Model/ViberTest.php +++ /dev/null @@ -1,154 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "imageUrl" - */ - public function testPropertyImageUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "buttonUrl" - */ - public function testPropertyButtonUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "buttonText" - */ - public function testPropertyButtonText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppComponentTest.php b/test/Model/WhatsAppComponentTest.php deleted file mode 100644 index 6edcac6..0000000 --- a/test/Model/WhatsAppComponentTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "type" - */ - public function testPropertyType() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "parameters" - */ - public function testPropertyParameters() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppLanguageTest.php b/test/Model/WhatsAppLanguageTest.php deleted file mode 100644 index d3836c5..0000000 --- a/test/Model/WhatsAppLanguageTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "policy" - */ - public function testPropertyPolicy() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppParameterTest.php b/test/Model/WhatsAppParameterTest.php deleted file mode 100644 index 5cf2857..0000000 --- a/test/Model/WhatsAppParameterTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "type" - */ - public function testPropertyType() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppTemplateTest.php b/test/Model/WhatsAppTemplateTest.php deleted file mode 100644 index 6ecae7f..0000000 --- a/test/Model/WhatsAppTemplateTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "name" - */ - public function testPropertyName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "language" - */ - public function testPropertyLanguage() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "components" - */ - public function testPropertyComponents() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppTest.php b/test/Model/WhatsAppTest.php deleted file mode 100644 index 4913f76..0000000 --- a/test/Model/WhatsAppTest.php +++ /dev/null @@ -1,127 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "template" - */ - public function testPropertyTemplate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} From a77d7d120f5139851d88129a0681ca06c177daa0 Mon Sep 17 00:00:00 2001 From: api-librarian Date: Mon, 1 Jul 2024 13:09:22 +0000 Subject: [PATCH 3/9] Travis update: Jul 2024 (Build 747) [skip ci] --- .gitignore | 15 - .openapi-generator-ignore | 23 - .openapi-generator/FILES | 129 - .openapi-generator/VERSION | 1 - .php-cs-fixer.dist.php | 29 - .travis.yml | 8 - README.md | 145 - composer.json | 35 - docs/Api/BlacklistApi.md | 245 -- docs/Api/ContactsApi.md | 499 --- docs/Api/DeliveryReportApi.md | 68 - docs/Api/GroupsApi.md | 310 -- docs/Api/NumberLookupApi.md | 68 - docs/Api/OmnimessageApi.md | 129 - docs/Api/StatisticsApi.md | 68 - docs/Model/Channel.md | 8 - docs/Model/ContactEnvelope.md | 9 - docs/Model/ContactFields.md | 18 - docs/Model/ContactListEnvelope.md | 9 - docs/Model/ContactResponseFields.md | 19 - docs/Model/ContactUpdateFields.md | 17 - docs/Model/DeliveryReportResponse.md | 11 - docs/Model/DeliveryResult.md | 14 - docs/Model/ErrorCodeOmnichannel.md | 8 - docs/Model/ErrorCodeOmnichannelMachine.md | 8 - docs/Model/ErrorCodePhonebook.md | 8 - docs/Model/ErrorCodeStatistics.md | 8 - docs/Model/ErrorItemNumberLookup.md | 9 - docs/Model/ErrorItemNumberLookupError.md | 10 - docs/Model/ErrorItemOmnichannel.md | 12 - docs/Model/ErrorItemPhonebook.md | 11 - docs/Model/ErrorItemStatistics.md | 11 - docs/Model/ErrorNumberLookup.md | 9 - docs/Model/ErrorOmnichannel.md | 9 - docs/Model/ErrorPhonebook.md | 9 - docs/Model/ErrorStatistics.md | 9 - docs/Model/ErrorTitleOmnichannel.md | 8 - docs/Model/ErrorTitlePhonebook.md | 8 - docs/Model/FetchBlacklistSuccess.md | 9 - docs/Model/GroupEnvelope.md | 9 - docs/Model/GroupListEnvelope.md | 9 - docs/Model/GroupName.md | 9 - docs/Model/GroupResponseFields.md | 12 - docs/Model/MessageResult.md | 11 - docs/Model/MobileNetwork.md | 13 - docs/Model/NumberToBlacklist.md | 9 - docs/Model/NumbersToInvestigate.md | 9 - .../Model/OmniMessageCreateSuccessResponse.md | 11 - docs/Model/Omnimessage.md | 14 - docs/Model/OmnimessageMessagesInner.md | 21 - docs/Model/Priority.md | 8 - docs/Model/SMS.md | 15 - docs/Model/StatisticsReport.md | 11 - docs/Model/StatisticsReportSettings.md | 11 - docs/Model/StatisticsReportSuccess.md | 9 - docs/Model/Status.md | 8 - docs/Model/SyncNumberLookupResult.md | 17 - docs/Model/SyncNumberLookupSuccess.md | 10 - docs/Model/Telegram.md | 15 - docs/Model/TextStore.md | 8 - docs/Model/Viber.md | 16 - docs/Model/WhatsApp.md | 13 - docs/Model/WhatsAppComponent.md | 12 - docs/Model/WhatsAppLanguage.md | 10 - docs/Model/WhatsAppParameter.md | 15 - docs/Model/WhatsAppTemplate.md | 11 - git_push.sh | 57 - lib/Api/BlacklistApi.php | 1300 ------- lib/Api/ContactsApi.php | 3384 ----------------- lib/Api/DeliveryReportApi.php | 525 --- lib/Api/GroupsApi.php | 2040 ---------- lib/Api/NumberLookupApi.php | 559 --- lib/Api/OmnimessageApi.php | 908 ----- lib/Api/StatisticsApi.php | 594 --- lib/ApiException.php | 120 - lib/Configuration.php | 533 --- lib/HeaderSelector.php | 246 -- lib/Model/Channel.php | 70 - lib/Model/ContactEnvelope.php | 411 -- lib/Model/ContactFields.php | 783 ---- lib/Model/ContactListEnvelope.php | 413 -- lib/Model/ContactResponseFields.php | 821 ---- lib/Model/ContactUpdateFields.php | 746 ---- lib/Model/DeliveryReportResponse.php | 488 --- lib/Model/DeliveryResult.php | 588 --- lib/Model/ErrorCodeOmnichannel.php | 79 - lib/Model/ErrorCodeOmnichannelMachine.php | 94 - lib/Model/ErrorCodePhonebook.php | 76 - lib/Model/ErrorCodeStatistics.php | 70 - lib/Model/ErrorItemNumberLookup.php | 414 -- lib/Model/ErrorItemNumberLookupError.php | 467 --- lib/Model/ErrorItemOmnichannel.php | 532 --- lib/Model/ErrorItemPhonebook.php | 488 --- lib/Model/ErrorItemStatistics.php | 488 --- lib/Model/ErrorNumberLookup.php | 414 -- lib/Model/ErrorOmnichannel.php | 414 -- lib/Model/ErrorPhonebook.php | 414 -- lib/Model/ErrorStatistics.php | 414 -- lib/Model/ErrorTitleOmnichannel.php | 79 - lib/Model/ErrorTitlePhonebook.php | 76 - lib/Model/FetchBlacklistSuccess.php | 413 -- lib/Model/GroupEnvelope.php | 411 -- lib/Model/GroupListEnvelope.php | 413 -- lib/Model/GroupName.php | 423 --- lib/Model/GroupResponseFields.php | 529 --- lib/Model/MessageResult.php | 488 --- lib/Model/MobileNetwork.php | 547 --- lib/Model/ModelInterface.php | 112 - lib/Model/NumberToBlacklist.php | 414 -- lib/Model/NumbersToInvestigate.php | 429 --- .../OmniMessageCreateSuccessResponse.php | 488 --- lib/Model/Omnimessage.php | 587 --- lib/Model/OmnimessageMessagesInner.php | 889 ----- lib/Model/Priority.php | 67 - lib/Model/SMS.php | 686 ---- lib/Model/StatisticsReport.php | 488 --- lib/Model/StatisticsReportSettings.php | 485 --- lib/Model/StatisticsReportSuccess.php | 414 -- lib/Model/Status.php | 91 - lib/Model/SyncNumberLookupResult.php | 773 ---- lib/Model/SyncNumberLookupSuccess.php | 451 --- lib/Model/Telegram.php | 647 ---- lib/Model/TextStore.php | 67 - lib/Model/Viber.php | 681 ---- lib/Model/WhatsApp.php | 579 --- lib/Model/WhatsAppComponent.php | 516 --- lib/Model/WhatsAppLanguage.php | 448 --- lib/Model/WhatsAppParameter.php | 618 --- lib/Model/WhatsAppTemplate.php | 485 --- lib/ObjectSerializer.php | 609 --- phpunit.xml.dist | 18 - 131 files changed, 35710 deletions(-) delete mode 100644 .gitignore delete mode 100644 .openapi-generator-ignore delete mode 100644 .openapi-generator/FILES delete mode 100644 .openapi-generator/VERSION delete mode 100644 .php-cs-fixer.dist.php delete mode 100644 .travis.yml delete mode 100644 README.md delete mode 100644 composer.json delete mode 100644 docs/Api/BlacklistApi.md delete mode 100644 docs/Api/ContactsApi.md delete mode 100644 docs/Api/DeliveryReportApi.md delete mode 100644 docs/Api/GroupsApi.md delete mode 100644 docs/Api/NumberLookupApi.md delete mode 100644 docs/Api/OmnimessageApi.md delete mode 100644 docs/Api/StatisticsApi.md delete mode 100644 docs/Model/Channel.md delete mode 100644 docs/Model/ContactEnvelope.md delete mode 100644 docs/Model/ContactFields.md delete mode 100644 docs/Model/ContactListEnvelope.md delete mode 100644 docs/Model/ContactResponseFields.md delete mode 100644 docs/Model/ContactUpdateFields.md delete mode 100644 docs/Model/DeliveryReportResponse.md delete mode 100644 docs/Model/DeliveryResult.md delete mode 100644 docs/Model/ErrorCodeOmnichannel.md delete mode 100644 docs/Model/ErrorCodeOmnichannelMachine.md delete mode 100644 docs/Model/ErrorCodePhonebook.md delete mode 100644 docs/Model/ErrorCodeStatistics.md delete mode 100644 docs/Model/ErrorItemNumberLookup.md delete mode 100644 docs/Model/ErrorItemNumberLookupError.md delete mode 100644 docs/Model/ErrorItemOmnichannel.md delete mode 100644 docs/Model/ErrorItemPhonebook.md delete mode 100644 docs/Model/ErrorItemStatistics.md delete mode 100644 docs/Model/ErrorNumberLookup.md delete mode 100644 docs/Model/ErrorOmnichannel.md delete mode 100644 docs/Model/ErrorPhonebook.md delete mode 100644 docs/Model/ErrorStatistics.md delete mode 100644 docs/Model/ErrorTitleOmnichannel.md delete mode 100644 docs/Model/ErrorTitlePhonebook.md delete mode 100644 docs/Model/FetchBlacklistSuccess.md delete mode 100644 docs/Model/GroupEnvelope.md delete mode 100644 docs/Model/GroupListEnvelope.md delete mode 100644 docs/Model/GroupName.md delete mode 100644 docs/Model/GroupResponseFields.md delete mode 100644 docs/Model/MessageResult.md delete mode 100644 docs/Model/MobileNetwork.md delete mode 100644 docs/Model/NumberToBlacklist.md delete mode 100644 docs/Model/NumbersToInvestigate.md delete mode 100644 docs/Model/OmniMessageCreateSuccessResponse.md delete mode 100644 docs/Model/Omnimessage.md delete mode 100644 docs/Model/OmnimessageMessagesInner.md delete mode 100644 docs/Model/Priority.md delete mode 100644 docs/Model/SMS.md delete mode 100644 docs/Model/StatisticsReport.md delete mode 100644 docs/Model/StatisticsReportSettings.md delete mode 100644 docs/Model/StatisticsReportSuccess.md delete mode 100644 docs/Model/Status.md delete mode 100644 docs/Model/SyncNumberLookupResult.md delete mode 100644 docs/Model/SyncNumberLookupSuccess.md delete mode 100644 docs/Model/Telegram.md delete mode 100644 docs/Model/TextStore.md delete mode 100644 docs/Model/Viber.md delete mode 100644 docs/Model/WhatsApp.md delete mode 100644 docs/Model/WhatsAppComponent.md delete mode 100644 docs/Model/WhatsAppLanguage.md delete mode 100644 docs/Model/WhatsAppParameter.md delete mode 100644 docs/Model/WhatsAppTemplate.md delete mode 100644 git_push.sh delete mode 100644 lib/Api/BlacklistApi.php delete mode 100644 lib/Api/ContactsApi.php delete mode 100644 lib/Api/DeliveryReportApi.php delete mode 100644 lib/Api/GroupsApi.php delete mode 100644 lib/Api/NumberLookupApi.php delete mode 100644 lib/Api/OmnimessageApi.php delete mode 100644 lib/Api/StatisticsApi.php delete mode 100644 lib/ApiException.php delete mode 100644 lib/Configuration.php delete mode 100644 lib/HeaderSelector.php delete mode 100644 lib/Model/Channel.php delete mode 100644 lib/Model/ContactEnvelope.php delete mode 100644 lib/Model/ContactFields.php delete mode 100644 lib/Model/ContactListEnvelope.php delete mode 100644 lib/Model/ContactResponseFields.php delete mode 100644 lib/Model/ContactUpdateFields.php delete mode 100644 lib/Model/DeliveryReportResponse.php delete mode 100644 lib/Model/DeliveryResult.php delete mode 100644 lib/Model/ErrorCodeOmnichannel.php delete mode 100644 lib/Model/ErrorCodeOmnichannelMachine.php delete mode 100644 lib/Model/ErrorCodePhonebook.php delete mode 100644 lib/Model/ErrorCodeStatistics.php delete mode 100644 lib/Model/ErrorItemNumberLookup.php delete mode 100644 lib/Model/ErrorItemNumberLookupError.php delete mode 100644 lib/Model/ErrorItemOmnichannel.php delete mode 100644 lib/Model/ErrorItemPhonebook.php delete mode 100644 lib/Model/ErrorItemStatistics.php delete mode 100644 lib/Model/ErrorNumberLookup.php delete mode 100644 lib/Model/ErrorOmnichannel.php delete mode 100644 lib/Model/ErrorPhonebook.php delete mode 100644 lib/Model/ErrorStatistics.php delete mode 100644 lib/Model/ErrorTitleOmnichannel.php delete mode 100644 lib/Model/ErrorTitlePhonebook.php delete mode 100644 lib/Model/FetchBlacklistSuccess.php delete mode 100644 lib/Model/GroupEnvelope.php delete mode 100644 lib/Model/GroupListEnvelope.php delete mode 100644 lib/Model/GroupName.php delete mode 100644 lib/Model/GroupResponseFields.php delete mode 100644 lib/Model/MessageResult.php delete mode 100644 lib/Model/MobileNetwork.php delete mode 100644 lib/Model/ModelInterface.php delete mode 100644 lib/Model/NumberToBlacklist.php delete mode 100644 lib/Model/NumbersToInvestigate.php delete mode 100644 lib/Model/OmniMessageCreateSuccessResponse.php delete mode 100644 lib/Model/Omnimessage.php delete mode 100644 lib/Model/OmnimessageMessagesInner.php delete mode 100644 lib/Model/Priority.php delete mode 100644 lib/Model/SMS.php delete mode 100644 lib/Model/StatisticsReport.php delete mode 100644 lib/Model/StatisticsReportSettings.php delete mode 100644 lib/Model/StatisticsReportSuccess.php delete mode 100644 lib/Model/Status.php delete mode 100644 lib/Model/SyncNumberLookupResult.php delete mode 100644 lib/Model/SyncNumberLookupSuccess.php delete mode 100644 lib/Model/Telegram.php delete mode 100644 lib/Model/TextStore.php delete mode 100644 lib/Model/Viber.php delete mode 100644 lib/Model/WhatsApp.php delete mode 100644 lib/Model/WhatsAppComponent.php delete mode 100644 lib/Model/WhatsAppLanguage.php delete mode 100644 lib/Model/WhatsAppParameter.php delete mode 100644 lib/Model/WhatsAppTemplate.php delete mode 100644 lib/ObjectSerializer.php delete mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9f1681c..0000000 --- a/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore - -composer.phar -/vendor/ - -# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control -# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -# composer.lock - -# php-cs-fixer cache -.php_cs.cache -.php-cs-fixer.cache - -# PHPUnit cache -.phpunit.result.cache diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore deleted file mode 100644 index 7484ee5..0000000 --- a/.openapi-generator-ignore +++ /dev/null @@ -1,23 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES deleted file mode 100644 index 7105b0d..0000000 --- a/.openapi-generator/FILES +++ /dev/null @@ -1,129 +0,0 @@ -.gitignore -.openapi-generator-ignore -.php-cs-fixer.dist.php -.travis.yml -README.md -composer.json -docs/Api/BlacklistApi.md -docs/Api/ContactsApi.md -docs/Api/DeliveryReportApi.md -docs/Api/GroupsApi.md -docs/Api/NumberLookupApi.md -docs/Api/OmnimessageApi.md -docs/Api/StatisticsApi.md -docs/Model/Channel.md -docs/Model/ContactEnvelope.md -docs/Model/ContactFields.md -docs/Model/ContactListEnvelope.md -docs/Model/ContactResponseFields.md -docs/Model/ContactUpdateFields.md -docs/Model/DeliveryReportResponse.md -docs/Model/DeliveryResult.md -docs/Model/ErrorCodeOmnichannel.md -docs/Model/ErrorCodeOmnichannelMachine.md -docs/Model/ErrorCodePhonebook.md -docs/Model/ErrorCodeStatistics.md -docs/Model/ErrorItemNumberLookup.md -docs/Model/ErrorItemNumberLookupError.md -docs/Model/ErrorItemOmnichannel.md -docs/Model/ErrorItemPhonebook.md -docs/Model/ErrorItemStatistics.md -docs/Model/ErrorNumberLookup.md -docs/Model/ErrorOmnichannel.md -docs/Model/ErrorPhonebook.md -docs/Model/ErrorStatistics.md -docs/Model/ErrorTitleOmnichannel.md -docs/Model/ErrorTitlePhonebook.md -docs/Model/FetchBlacklistSuccess.md -docs/Model/GroupEnvelope.md -docs/Model/GroupListEnvelope.md -docs/Model/GroupName.md -docs/Model/GroupResponseFields.md -docs/Model/MessageResult.md -docs/Model/MobileNetwork.md -docs/Model/NumberToBlacklist.md -docs/Model/NumbersToInvestigate.md -docs/Model/OmniMessageCreateSuccessResponse.md -docs/Model/Omnimessage.md -docs/Model/OmnimessageMessagesInner.md -docs/Model/Priority.md -docs/Model/SMS.md -docs/Model/StatisticsReport.md -docs/Model/StatisticsReportSettings.md -docs/Model/StatisticsReportSuccess.md -docs/Model/Status.md -docs/Model/SyncNumberLookupResult.md -docs/Model/SyncNumberLookupSuccess.md -docs/Model/Telegram.md -docs/Model/TextStore.md -docs/Model/Viber.md -docs/Model/WhatsApp.md -docs/Model/WhatsAppComponent.md -docs/Model/WhatsAppLanguage.md -docs/Model/WhatsAppParameter.md -docs/Model/WhatsAppTemplate.md -git_push.sh -lib/Api/BlacklistApi.php -lib/Api/ContactsApi.php -lib/Api/DeliveryReportApi.php -lib/Api/GroupsApi.php -lib/Api/NumberLookupApi.php -lib/Api/OmnimessageApi.php -lib/Api/StatisticsApi.php -lib/ApiException.php -lib/Configuration.php -lib/HeaderSelector.php -lib/Model/Channel.php -lib/Model/ContactEnvelope.php -lib/Model/ContactFields.php -lib/Model/ContactListEnvelope.php -lib/Model/ContactResponseFields.php -lib/Model/ContactUpdateFields.php -lib/Model/DeliveryReportResponse.php -lib/Model/DeliveryResult.php -lib/Model/ErrorCodeOmnichannel.php -lib/Model/ErrorCodeOmnichannelMachine.php -lib/Model/ErrorCodePhonebook.php -lib/Model/ErrorCodeStatistics.php -lib/Model/ErrorItemNumberLookup.php -lib/Model/ErrorItemNumberLookupError.php -lib/Model/ErrorItemOmnichannel.php -lib/Model/ErrorItemPhonebook.php -lib/Model/ErrorItemStatistics.php -lib/Model/ErrorNumberLookup.php -lib/Model/ErrorOmnichannel.php -lib/Model/ErrorPhonebook.php -lib/Model/ErrorStatistics.php -lib/Model/ErrorTitleOmnichannel.php -lib/Model/ErrorTitlePhonebook.php -lib/Model/FetchBlacklistSuccess.php -lib/Model/GroupEnvelope.php -lib/Model/GroupListEnvelope.php -lib/Model/GroupName.php -lib/Model/GroupResponseFields.php -lib/Model/MessageResult.php -lib/Model/MobileNetwork.php -lib/Model/ModelInterface.php -lib/Model/NumberToBlacklist.php -lib/Model/NumbersToInvestigate.php -lib/Model/OmniMessageCreateSuccessResponse.php -lib/Model/Omnimessage.php -lib/Model/OmnimessageMessagesInner.php -lib/Model/Priority.php -lib/Model/SMS.php -lib/Model/StatisticsReport.php -lib/Model/StatisticsReportSettings.php -lib/Model/StatisticsReportSuccess.php -lib/Model/Status.php -lib/Model/SyncNumberLookupResult.php -lib/Model/SyncNumberLookupSuccess.php -lib/Model/Telegram.php -lib/Model/TextStore.php -lib/Model/Viber.php -lib/Model/WhatsApp.php -lib/Model/WhatsAppComponent.php -lib/Model/WhatsAppLanguage.php -lib/Model/WhatsAppParameter.php -lib/Model/WhatsAppTemplate.php -lib/ObjectSerializer.php -phpunit.xml.dist diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION deleted file mode 100644 index 93c8dda..0000000 --- a/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.6.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index af9cf39..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,29 +0,0 @@ -in(__DIR__) - ->exclude('vendor') - ->exclude('test') - ->exclude('tests') -; - -$config = new PhpCsFixer\Config(); -return $config->setRules([ - '@PSR12' => true, - 'phpdoc_order' => true, - 'array_syntax' => [ 'syntax' => 'short' ], - 'strict_comparison' => true, - 'strict_param' => true, - 'no_trailing_whitespace' => false, - 'no_trailing_whitespace_in_comment' => false, - 'braces' => false, - 'single_blank_line_at_eof' => false, - 'blank_line_after_namespace' => false, - 'no_leading_import_slash' => false, - ]) - ->setFinder($finder) -; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 667b815..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: php -# Bionic environment has preinstalled PHP from 7.1 to 7.4 -# https://docs.travis-ci.com/user/reference/bionic/#php-support -dist: bionic -php: - - 7.4 -before_install: "composer install" -script: "vendor/bin/phpunit" diff --git a/README.md b/README.md deleted file mode 100644 index 3ad019b..0000000 --- a/README.md +++ /dev/null @@ -1,145 +0,0 @@ -# Messente API Library - -- Messente API version: 2.0.0 -- PHP artifact version: 3.0.0 - -[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. - -## Installation - -Install Messente API library with `composer require messente/messente-api-php`. - -## Features - -Messente API has the following features: - -- Omnichannel ([external docs](https://messente.com/documentation/omnichannel-api)), -- Phonebook ([external docs](https://messente.com/documentation/phonebook-api)). - -Messente API Library provides the operations described below to access the features. - -### BlacklistApi - -1. Adds a phone number to the blacklist [`addToBlacklist`](docs/Api/BlacklistApi.md#addtoblacklist) -1. Deletes a phone number from the blacklist [`deleteFromBlacklist`](docs/Api/BlacklistApi.md#deletefromblacklist) -1. Returns all blacklisted phone numbers [`fetchBlacklist`](docs/Api/BlacklistApi.md#fetchblacklist) -1. Checks if a phone number is blacklisted [`isBlacklisted`](docs/Api/BlacklistApi.md#isblacklisted) - -### ContactsApi - -1. Adds a contact to a group [`addContactToGroup`](docs/Api/ContactsApi.md#addcontacttogroup) -1. Creates a new contact [`createContact`](docs/Api/ContactsApi.md#createcontact) -1. Deletes a contact [`deleteContact`](docs/Api/ContactsApi.md#deletecontact) -1. Lists a contact [`fetchContact`](docs/Api/ContactsApi.md#fetchcontact) -1. Lists groups of a contact [`fetchContactGroups`](docs/Api/ContactsApi.md#fetchcontactgroups) -1. Returns all contacts [`fetchContacts`](docs/Api/ContactsApi.md#fetchcontacts) -1. Removes a contact from a group [`removeContactFromGroup`](docs/Api/ContactsApi.md#removecontactfromgroup) -1. Updates a contact [`updateContact`](docs/Api/ContactsApi.md#updatecontact) - -### DeliveryReportApi - -1. Retrieves the delivery report for the Omnimessage [`retrieveDeliveryReport`](docs/Api/DeliveryReportApi.md#retrievedeliveryreport) - -### GroupsApi - -1. Creates a new group with the provided name [`createGroup`](docs/Api/GroupsApi.md#creategroup) -1. Deletes a group [`deleteGroup`](docs/Api/GroupsApi.md#deletegroup) -1. Lists a group [`fetchGroup`](docs/Api/GroupsApi.md#fetchgroup) -1. Returns all groups [`fetchGroups`](docs/Api/GroupsApi.md#fetchgroups) -1. Updates a group with the provided name [`updateGroup`](docs/Api/GroupsApi.md#updategroup) - -### NumberLookupApi - -1. Requests info about phone numbers [`fetchInfo`](docs/Api/NumberLookupApi.md#fetchinfo) - -### OmnimessageApi - -1. Cancels a scheduled Omnimessage [`cancelScheduledMessage`](docs/Api/OmnimessageApi.md#cancelscheduledmessage) -1. Sends an Omnimessage [`sendOmnimessage`](docs/Api/OmnimessageApi.md#sendomnimessage) - -### StatisticsApi - -1. Requests statistics reports for each country [`createStatisticsReport`](docs/Api/StatisticsApi.md#createstatisticsreport) - -## Auth - -**Type**: HTTP basic authentication - -Read the [external getting-started article](https://messente.com/documentation/getting-started) which explains API keys and Sender ID logic. - -## Getting started: sending an omnimessage - -```php -setUsername('') - ->setPassword(''); - -$apiInstance = new OmnimessageApi( - new GuzzleHttp\Client(), - $config -); - -$omnimessage = new Omnimessage([ - "to" => "" -]); - -$viber = new Viber( - ["text" => "Hello Viber!", "sender" => "MyViberSender"] -); - -$sms = new SMS( - ["text" => "Hello SMS!", "sender" => "MySmsSender"] -); - -$whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; -$whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); -$whatsAppLanguage = new WhatsAppLanguage(['code' => '']); -$whatsAppTemplate = new WhatsAppTemplate( - [ - 'name'=> '', - 'language'=> $whatsAppLanguage, - 'components' => [$whatsAppComponent] - ] -); - -$whatsapp = new WhatsApp( - [ - 'sender' => '', - 'template' => $whatsAppTemplate, - ] -); - -$omnimessage->setMessages([$whatsapp, $viber, $sms]); - - -try { - $result = $apiInstance->sendOmnimessage($omnimessage); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL; -} -?> - -``` - -## License - -[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) - -## Terms - -[https://messente.com/terms-and-conditions](https://messente.com/terms-and-conditions) diff --git a/composer.json b/composer.json deleted file mode 100644 index 9985e13..0000000 --- a/composer.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "messente/messente-api-php", - "version": "3.0.0", - "description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.", - "keywords": ["viber", "telegram", "sms", "whatsapp", "phonebook", "openapitools", - "openapi-generator", - "openapi", - "php", - "sdk", - "rest", - "api" - ], - "homepage": "https://messente.com", - "license": "unlicense", - "authors": [ - { - "name": "Messente", - "homepage": "https://messente.com" - } - ], - "require": { - "php": ">=7.1", - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/guzzle": "^6.2 || ^7.0", - "guzzlehttp/psr7": "^1.8" - }, - "autoload": { - "psr-4": { "Messente\\Api\\" : "lib/" } - }, - "autoload-dev": { - "psr-4": { "Messente\\Api\\Test\\" : "test/" } - } -} diff --git a/docs/Api/BlacklistApi.md b/docs/Api/BlacklistApi.md deleted file mode 100644 index 26c6414..0000000 --- a/docs/Api/BlacklistApi.md +++ /dev/null @@ -1,245 +0,0 @@ -# Messente\Api\BlacklistApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist | -| [**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist | -| [**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers | -| [**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted | - - -## `addToBlacklist()` - -```php -addToBlacklist($numberToBlacklist) -``` - -Adds a phone number to the blacklist - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\BlacklistApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$numberToBlacklist = {"phoneNumber":"+37251000000"}; // \Messente\Api\Model\NumberToBlacklist | Phone number to be blacklisted - -try { - $apiInstance->addToBlacklist($numberToBlacklist); -} catch (Exception $e) { - echo 'Exception when calling BlacklistApi->addToBlacklist: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `deleteFromBlacklist()` - -```php -deleteFromBlacklist($phone) -``` - -Deletes a phone number from the blacklist - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\BlacklistApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number - -try { - $apiInstance->deleteFromBlacklist($phone); -} catch (Exception $e) { - echo 'Exception when calling BlacklistApi->deleteFromBlacklist: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchBlacklist()` - -```php -fetchBlacklist(): \Messente\Api\Model\FetchBlacklistSuccess -``` - -Returns all blacklisted phone numbers - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\BlacklistApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->fetchBlacklist(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling BlacklistApi->fetchBlacklist: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Messente\Api\Model\FetchBlacklistSuccess**](../Model/FetchBlacklistSuccess.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `isBlacklisted()` - -```php -isBlacklisted($phone) -``` - -Checks if a phone number is blacklisted - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\BlacklistApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number - -try { - $apiInstance->isBlacklisted($phone); -} catch (Exception $e) { - echo 'Exception when calling BlacklistApi->isBlacklisted: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md deleted file mode 100644 index a99a3ad..0000000 --- a/docs/Api/ContactsApi.md +++ /dev/null @@ -1,499 +0,0 @@ -# Messente\Api\ContactsApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group | -| [**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact | -| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact | -| [**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact | -| [**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact | -| [**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts | -| [**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group | -| [**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact | - - -## `addContactToGroup()` - -```php -addContactToGroup($groupId, $phone): object -``` - -Adds a contact to a group - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format -$phone = +37251000000; // string | A phone number - -try { - $result = $apiInstance->addContactToGroup($groupId, $phone); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->addContactToGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **phone** | **string**| A phone number | | - -### Return type - -**object** - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `createContact()` - -```php -createContact($contactFields): \Messente\Api\Model\ContactEnvelope -``` - -Creates a new contact - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$contactFields = {"phoneNumber":"+37251000000","email":"anyone@messente.com","firstName":"Any","lastName":"One","company":"Messente","title":"Sir","custom":"Any custom","custom2":"Any custom two","custom3":"Any custom three","custom4":"Any custom four"}; // \Messente\Api\Model\ContactFields - -try { - $result = $apiInstance->createContact($contactFields); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | | - -### Return type - -[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `deleteContact()` - -```php -deleteContact($phone) -``` - -Deletes a contact - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number - -try { - $apiInstance->deleteContact($phone); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->deleteContact: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchContact()` - -```php -fetchContact($phone): \Messente\Api\Model\ContactEnvelope -``` - -Lists a contact - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number - -try { - $result = $apiInstance->fetchContact($phone); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->fetchContact: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | - -### Return type - -[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchContactGroups()` - -```php -fetchContactGroups($phone): \Messente\Api\Model\GroupListEnvelope -``` - -Lists groups of a contact - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number - -try { - $result = $apiInstance->fetchContactGroups($phone); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->fetchContactGroups: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | - -### Return type - -[**\Messente\Api\Model\GroupListEnvelope**](../Model/GroupListEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchContacts()` - -```php -fetchContacts($groupIds): \Messente\Api\Model\ContactListEnvelope -``` - -Returns all contacts - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupIds = ["5792a02a-e5c2-422b-a0a0-0ae65d814663","4792a02a-e5c2-422b-a0a0-0ae65d814662"]; // string[] | Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" - -try { - $result = $apiInstance->fetchContacts($groupIds); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->fetchContacts: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] | - -### Return type - -[**\Messente\Api\Model\ContactListEnvelope**](../Model/ContactListEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `removeContactFromGroup()` - -```php -removeContactFromGroup($groupId, $phone) -``` - -Removes a contact from a group - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format -$phone = +37251000000; // string | A phone number - -try { - $apiInstance->removeContactFromGroup($groupId, $phone); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->removeContactFromGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **phone** | **string**| A phone number | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `updateContact()` - -```php -updateContact($phone, $contactUpdateFields): \Messente\Api\Model\ContactEnvelope -``` - -Updates a contact - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\ContactsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$phone = +37251000000; // string | A phone number -$contactUpdateFields = {"email":"anyone@messente.com","firstName":"Any","lastName":"One","company":"Messente","title":"Sir","custom":"Any custom","custom2":"Any custom two","custom3":"Any custom three","custom4":"Any custom four"}; // \Messente\Api\Model\ContactUpdateFields - -try { - $result = $apiInstance->updateContact($phone, $contactUpdateFields); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling ContactsApi->updateContact: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | -| **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | | - -### Return type - -[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/DeliveryReportApi.md b/docs/Api/DeliveryReportApi.md deleted file mode 100644 index 622fe6f..0000000 --- a/docs/Api/DeliveryReportApi.md +++ /dev/null @@ -1,68 +0,0 @@ -# Messente\Api\DeliveryReportApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage | - - -## `retrieveDeliveryReport()` - -```php -retrieveDeliveryReport($omnimessageId): \Messente\Api\Model\DeliveryReportResponse -``` - -Retrieves the delivery report for the Omnimessage - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\DeliveryReportApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$omnimessageId = 'omnimessageId_example'; // string | UUID of the omnimessage to for which the delivery report is to be retrieved - -try { - $result = $apiInstance->retrieveDeliveryReport($omnimessageId); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling DeliveryReportApi->retrieveDeliveryReport: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | | - -### Return type - -[**\Messente\Api\Model\DeliveryReportResponse**](../Model/DeliveryReportResponse.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/GroupsApi.md b/docs/Api/GroupsApi.md deleted file mode 100644 index 8ad8bb9..0000000 --- a/docs/Api/GroupsApi.md +++ /dev/null @@ -1,310 +0,0 @@ -# Messente\Api\GroupsApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name | -| [**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group | -| [**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group | -| [**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups | -| [**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name | - - -## `createGroup()` - -```php -createGroup($groupName): \Messente\Api\Model\GroupEnvelope -``` - -Creates a new group with the provided name - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\GroupsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupName = {"name":"Any group name"}; // \Messente\Api\Model\GroupName - -try { - $result = $apiInstance->createGroup($groupName); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling GroupsApi->createGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | - -### Return type - -[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `deleteGroup()` - -```php -deleteGroup($groupId) -``` - -Deletes a group - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\GroupsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format - -try { - $apiInstance->deleteGroup($groupId); -} catch (Exception $e) { - echo 'Exception when calling GroupsApi->deleteGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | - -### Return type - -void (empty response body) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchGroup()` - -```php -fetchGroup($groupId): \Messente\Api\Model\GroupEnvelope -``` - -Lists a group - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\GroupsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format - -try { - $result = $apiInstance->fetchGroup($groupId); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling GroupsApi->fetchGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | - -### Return type - -[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `fetchGroups()` - -```php -fetchGroups(): \Messente\Api\Model\GroupListEnvelope -``` - -Returns all groups - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\GroupsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->fetchGroups(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling GroupsApi->fetchGroups: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Messente\Api\Model\GroupListEnvelope**](../Model/GroupListEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `updateGroup()` - -```php -updateGroup($groupId, $groupName): \Messente\Api\Model\GroupEnvelope -``` - -Updates a group with the provided name - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\GroupsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format -$groupName = {"name":"Any group name"}; // \Messente\Api\Model\GroupName - -try { - $result = $apiInstance->updateGroup($groupId, $groupName); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling GroupsApi->updateGroup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | - -### Return type - -[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/NumberLookupApi.md b/docs/Api/NumberLookupApi.md deleted file mode 100644 index 01fa35c..0000000 --- a/docs/Api/NumberLookupApi.md +++ /dev/null @@ -1,68 +0,0 @@ -# Messente\Api\NumberLookupApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers | - - -## `fetchInfo()` - -```php -fetchInfo($numbersToInvestigate): \Messente\Api\Model\SyncNumberLookupSuccess -``` - -Requests info about phone numbers - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\NumberLookupApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$numbersToInvestigate = {"numbers":["+37251000000","+37251000001"]}; // \Messente\Api\Model\NumbersToInvestigate | Numbers for lookup - -try { - $result = $apiInstance->fetchInfo($numbersToInvestigate); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling NumberLookupApi->fetchInfo: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | | - -### Return type - -[**\Messente\Api\Model\SyncNumberLookupSuccess**](../Model/SyncNumberLookupSuccess.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md deleted file mode 100644 index b4317da..0000000 --- a/docs/Api/OmnimessageApi.md +++ /dev/null @@ -1,129 +0,0 @@ -# Messente\Api\OmnimessageApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | -| [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | - - -## `cancelScheduledMessage()` - -```php -cancelScheduledMessage($omnimessageId): object -``` - -Cancels a scheduled Omnimessage - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\OmnimessageApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$omnimessageId = 'omnimessageId_example'; // string | UUID of the scheduled omnimessage to be cancelled - -try { - $result = $apiInstance->cancelScheduledMessage($omnimessageId); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OmnimessageApi->cancelScheduledMessage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | | - -### Return type - -**object** - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `sendOmnimessage()` - -```php -sendOmnimessage($omnimessage): \Messente\Api\Model\OmniMessageCreateSuccessResponse -``` - -Sends an Omnimessage - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\OmnimessageApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$omnimessage = new \Messente\Api\Model\Omnimessage(); // \Messente\Api\Model\Omnimessage | Omnimessage to be sent - -try { - $result = $apiInstance->sendOmnimessage($omnimessage); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OmnimessageApi->sendOmnimessage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | | - -### Return type - -[**\Messente\Api\Model\OmniMessageCreateSuccessResponse**](../Model/OmniMessageCreateSuccessResponse.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md deleted file mode 100644 index be19360..0000000 --- a/docs/Api/StatisticsApi.md +++ /dev/null @@ -1,68 +0,0 @@ -# Messente\Api\StatisticsApi - -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country | - - -## `createStatisticsReport()` - -```php -createStatisticsReport($statisticsReportSettings): \Messente\Api\Model\StatisticsReportSuccess -``` - -Requests statistics reports for each country - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\StatisticsApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$statisticsReportSettings = {"start_date":"2017-01-01","end_date":"2019-06-20","message_types":["sms"]}; // \Messente\Api\Model\StatisticsReportSettings | Settings for statistics report - -try { - $result = $apiInstance->createStatisticsReport($statisticsReportSettings); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling StatisticsApi->createStatisticsReport: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | | - -### Return type - -[**\Messente\Api\Model\StatisticsReportSuccess**](../Model/StatisticsReportSuccess.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/docs/Model/Channel.md b/docs/Model/Channel.md deleted file mode 100644 index 866cd4a..0000000 --- a/docs/Model/Channel.md +++ /dev/null @@ -1,8 +0,0 @@ -# # Channel - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactEnvelope.md b/docs/Model/ContactEnvelope.md deleted file mode 100644 index c86b00d..0000000 --- a/docs/Model/ContactEnvelope.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ContactEnvelope - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**contact** | [**\Messente\Api\Model\ContactResponseFields**](ContactResponseFields.md) | | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactFields.md b/docs/Model/ContactFields.md deleted file mode 100644 index 5f5e1a3..0000000 --- a/docs/Model/ContactFields.md +++ /dev/null @@ -1,18 +0,0 @@ -# # ContactFields - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**phoneNumber** | **string** | Phone number in e.164 format | -**email** | **string** | The email of the contact | [optional] -**firstName** | **string** | The first name of the contact | [optional] -**lastName** | **string** | The last name of the contact | [optional] -**company** | **string** | The company of the contact | [optional] -**title** | **string** | The title of the contact | [optional] -**custom** | **string** | The first custom field | [optional] -**custom2** | **string** | The second custom field | [optional] -**custom3** | **string** | The third custom field | [optional] -**custom4** | **string** | The fourth custom field | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactListEnvelope.md b/docs/Model/ContactListEnvelope.md deleted file mode 100644 index 0ad220a..0000000 --- a/docs/Model/ContactListEnvelope.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ContactListEnvelope - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**contacts** | [**\Messente\Api\Model\ContactResponseFields[]**](ContactResponseFields.md) | An array of contacts | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactResponseFields.md b/docs/Model/ContactResponseFields.md deleted file mode 100644 index d9ed0a8..0000000 --- a/docs/Model/ContactResponseFields.md +++ /dev/null @@ -1,19 +0,0 @@ -# # ContactResponseFields - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**phoneNumber** | **string** | Phone number in e.164 format | [optional] -**email** | **string** | The email of the contact | [optional] -**firstName** | **string** | The first name of the contact | [optional] -**lastName** | **string** | The last name of the contact | [optional] -**company** | **string** | The company of the contact | [optional] -**title** | **string** | The title of the contact | [optional] -**custom** | **string** | The first custom field | [optional] -**custom2** | **string** | The second custom field | [optional] -**custom3** | **string** | The third custom field | [optional] -**custom4** | **string** | The fourth custom field | [optional] -**scheduledDeletionDate** | **\DateTime** | The date in ISO 8601 format, YYYY-MM-DD, on which the contact is going to be deleted because it has not belonged to a group for 30 days | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactUpdateFields.md b/docs/Model/ContactUpdateFields.md deleted file mode 100644 index 1110f27..0000000 --- a/docs/Model/ContactUpdateFields.md +++ /dev/null @@ -1,17 +0,0 @@ -# # ContactUpdateFields - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**email** | **string** | The email of the contact | [optional] -**firstName** | **string** | The first name of the contact | [optional] -**lastName** | **string** | The last name of the contact | [optional] -**company** | **string** | The company of the contact | [optional] -**title** | **string** | The title of the contact | [optional] -**custom** | **string** | The first custom field | [optional] -**custom2** | **string** | The second custom field | [optional] -**custom3** | **string** | The third custom field | [optional] -**custom4** | **string** | The fourth custom field | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeliveryReportResponse.md b/docs/Model/DeliveryReportResponse.md deleted file mode 100644 index 0dc0688..0000000 --- a/docs/Model/DeliveryReportResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# # DeliveryReportResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**statuses** | [**\Messente\Api\Model\DeliveryResult[]**](DeliveryResult.md) | Contains the delivery reports for each channel, ordered by send order | -**to** | **string** | Phone number in e.164 format | -**omnimessageId** | **string** | Unique identifier for the omnimessage | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeliveryResult.md b/docs/Model/DeliveryResult.md deleted file mode 100644 index 427c9f2..0000000 --- a/docs/Model/DeliveryResult.md +++ /dev/null @@ -1,14 +0,0 @@ -# # DeliveryResult - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**status** | [**\Messente\Api\Model\Status**](Status.md) | | [optional] -**channel** | [**\Messente\Api\Model\Channel**](Channel.md) | | [optional] -**messageId** | **string** | Unique identifier for the message | [optional] -**error** | **string** | Human-readable description of what went wrong, *null* in case of success or if the message has not been processed yet | [optional] -**err** | [**\Messente\Api\Model\ErrorCodeOmnichannelMachine**](ErrorCodeOmnichannelMachine.md) | | [optional] -**timestamp** | **\DateTime** | When this status was received by Omnichannel API | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeOmnichannel.md b/docs/Model/ErrorCodeOmnichannel.md deleted file mode 100644 index 667281b..0000000 --- a/docs/Model/ErrorCodeOmnichannel.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorCodeOmnichannel - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeOmnichannelMachine.md b/docs/Model/ErrorCodeOmnichannelMachine.md deleted file mode 100644 index da84b2d..0000000 --- a/docs/Model/ErrorCodeOmnichannelMachine.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorCodeOmnichannelMachine - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodePhonebook.md b/docs/Model/ErrorCodePhonebook.md deleted file mode 100644 index d7fe431..0000000 --- a/docs/Model/ErrorCodePhonebook.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorCodePhonebook - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeStatistics.md b/docs/Model/ErrorCodeStatistics.md deleted file mode 100644 index 3ba4cf6..0000000 --- a/docs/Model/ErrorCodeStatistics.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorCodeStatistics - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemNumberLookup.md b/docs/Model/ErrorItemNumberLookup.md deleted file mode 100644 index c923237..0000000 --- a/docs/Model/ErrorItemNumberLookup.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ErrorItemNumberLookup - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**error** | [**\Messente\Api\Model\ErrorItemNumberLookupError**](ErrorItemNumberLookupError.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemNumberLookupError.md b/docs/Model/ErrorItemNumberLookupError.md deleted file mode 100644 index dab852b..0000000 --- a/docs/Model/ErrorItemNumberLookupError.md +++ /dev/null @@ -1,10 +0,0 @@ -# # ErrorItemNumberLookupError - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**description** | **string** | Error description | -**code** | **int** | Matches the following error title. This field is a constant * 101 - Unauthorized * 102 - Invalid arguments or parameters * 103 - Server error * 104 - Crediting error #1 * 105 - Crediting error #2 * 106 - Client error | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemOmnichannel.md b/docs/Model/ErrorItemOmnichannel.md deleted file mode 100644 index 64aec57..0000000 --- a/docs/Model/ErrorItemOmnichannel.md +++ /dev/null @@ -1,12 +0,0 @@ -# # ErrorItemOmnichannel - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | [**\Messente\Api\Model\ErrorTitleOmnichannel**](ErrorTitleOmnichannel.md) | | -**detail** | **string** | Free form more detailed description of the error | -**code** | [**\Messente\Api\Model\ErrorCodeOmnichannel**](ErrorCodeOmnichannel.md) | | -**source** | **string** | Describes which field is causing the issue in the payload, null for non 400 status code responses | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemPhonebook.md b/docs/Model/ErrorItemPhonebook.md deleted file mode 100644 index 8ca8880..0000000 --- a/docs/Model/ErrorItemPhonebook.md +++ /dev/null @@ -1,11 +0,0 @@ -# # ErrorItemPhonebook - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | [**\Messente\Api\Model\ErrorTitlePhonebook**](ErrorTitlePhonebook.md) | | -**detail** | **string** | Free form more detailed description of the error | -**code** | [**\Messente\Api\Model\ErrorCodePhonebook**](ErrorCodePhonebook.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemStatistics.md b/docs/Model/ErrorItemStatistics.md deleted file mode 100644 index 62d0e8a..0000000 --- a/docs/Model/ErrorItemStatistics.md +++ /dev/null @@ -1,11 +0,0 @@ -# # ErrorItemStatistics - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**title** | **string** | Error title | -**details** | **string** | Error details | -**code** | [**\Messente\Api\Model\ErrorCodeStatistics**](ErrorCodeStatistics.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorNumberLookup.md b/docs/Model/ErrorNumberLookup.md deleted file mode 100644 index d8116b4..0000000 --- a/docs/Model/ErrorNumberLookup.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ErrorNumberLookup - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**errors** | [**\Messente\Api\Model\ErrorItemNumberLookup[]**](ErrorItemNumberLookup.md) | An array of errors | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorOmnichannel.md b/docs/Model/ErrorOmnichannel.md deleted file mode 100644 index fe59aea..0000000 --- a/docs/Model/ErrorOmnichannel.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ErrorOmnichannel - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**errors** | [**\Messente\Api\Model\ErrorItemOmnichannel[]**](ErrorItemOmnichannel.md) | An array of errors | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorPhonebook.md b/docs/Model/ErrorPhonebook.md deleted file mode 100644 index 0345c9e..0000000 --- a/docs/Model/ErrorPhonebook.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ErrorPhonebook - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**errors** | [**\Messente\Api\Model\ErrorItemPhonebook[]**](ErrorItemPhonebook.md) | An array of errors | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorStatistics.md b/docs/Model/ErrorStatistics.md deleted file mode 100644 index 3dba2a6..0000000 --- a/docs/Model/ErrorStatistics.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ErrorStatistics - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**errors** | [**\Messente\Api\Model\ErrorItemStatistics[]**](ErrorItemStatistics.md) | An array of errors | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorTitleOmnichannel.md b/docs/Model/ErrorTitleOmnichannel.md deleted file mode 100644 index 25938a8..0000000 --- a/docs/Model/ErrorTitleOmnichannel.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorTitleOmnichannel - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorTitlePhonebook.md b/docs/Model/ErrorTitlePhonebook.md deleted file mode 100644 index 9f4f024..0000000 --- a/docs/Model/ErrorTitlePhonebook.md +++ /dev/null @@ -1,8 +0,0 @@ -# # ErrorTitlePhonebook - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FetchBlacklistSuccess.md b/docs/Model/FetchBlacklistSuccess.md deleted file mode 100644 index 36a7fef..0000000 --- a/docs/Model/FetchBlacklistSuccess.md +++ /dev/null @@ -1,9 +0,0 @@ -# # FetchBlacklistSuccess - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**phoneNumbers** | **string[]** | Array of unique phone numbers | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupEnvelope.md b/docs/Model/GroupEnvelope.md deleted file mode 100644 index ed34926..0000000 --- a/docs/Model/GroupEnvelope.md +++ /dev/null @@ -1,9 +0,0 @@ -# # GroupEnvelope - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**group** | [**\Messente\Api\Model\GroupResponseFields**](GroupResponseFields.md) | | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupListEnvelope.md b/docs/Model/GroupListEnvelope.md deleted file mode 100644 index 7244a7a..0000000 --- a/docs/Model/GroupListEnvelope.md +++ /dev/null @@ -1,9 +0,0 @@ -# # GroupListEnvelope - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**groups** | [**\Messente\Api\Model\GroupResponseFields[]**](GroupResponseFields.md) | An array of groups | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupName.md b/docs/Model/GroupName.md deleted file mode 100644 index d97a1f0..0000000 --- a/docs/Model/GroupName.md +++ /dev/null @@ -1,9 +0,0 @@ -# # GroupName - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | The name of the group | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupResponseFields.md b/docs/Model/GroupResponseFields.md deleted file mode 100644 index c08e03e..0000000 --- a/docs/Model/GroupResponseFields.md +++ /dev/null @@ -1,12 +0,0 @@ -# # GroupResponseFields - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | Id string in UUID format | -**name** | **string** | The name of the group | -**createdOn** | **string** | When the group was created | [optional] -**contactsCount** | **int** | The count of contacts in the group | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageResult.md b/docs/Model/MessageResult.md deleted file mode 100644 index b8a4036..0000000 --- a/docs/Model/MessageResult.md +++ /dev/null @@ -1,11 +0,0 @@ -# # MessageResult - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**messageId** | **string** | Unique identifier for the message | -**channel** | [**\Messente\Api\Model\Channel**](Channel.md) | | -**sender** | **string** | Sender that was used for the message | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MobileNetwork.md b/docs/Model/MobileNetwork.md deleted file mode 100644 index f0529f2..0000000 --- a/docs/Model/MobileNetwork.md +++ /dev/null @@ -1,13 +0,0 @@ -# # MobileNetwork - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**mccmnc** | **string** | Mobile country and mobile network code | [optional] -**networkName** | **string** | Mobile network name | [optional] -**countryName** | **string** | Country name | [optional] -**countryPrefix** | **string** | Country prefix | [optional] -**countryCode** | **string** | Country code | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NumberToBlacklist.md b/docs/Model/NumberToBlacklist.md deleted file mode 100644 index 6b1906a..0000000 --- a/docs/Model/NumberToBlacklist.md +++ /dev/null @@ -1,9 +0,0 @@ -# # NumberToBlacklist - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**phoneNumber** | **string** | Phone number in e.164 format | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NumbersToInvestigate.md b/docs/Model/NumbersToInvestigate.md deleted file mode 100644 index 705faae..0000000 --- a/docs/Model/NumbersToInvestigate.md +++ /dev/null @@ -1,9 +0,0 @@ -# # NumbersToInvestigate - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**numbers** | **string[]** | A list of phone numbers. Max 10 numbers per request | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OmniMessageCreateSuccessResponse.md b/docs/Model/OmniMessageCreateSuccessResponse.md deleted file mode 100644 index 6177048..0000000 --- a/docs/Model/OmniMessageCreateSuccessResponse.md +++ /dev/null @@ -1,11 +0,0 @@ -# # OmniMessageCreateSuccessResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**messages** | [**\Messente\Api\Model\MessageResult[]**](MessageResult.md) | List of messages that compose the omnimessage | -**to** | **string** | Phone number in e.164 format | -**omnimessageId** | **string** | Unique identifier for the omnimessage | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Omnimessage.md b/docs/Model/Omnimessage.md deleted file mode 100644 index b5d8079..0000000 --- a/docs/Model/Omnimessage.md +++ /dev/null @@ -1,14 +0,0 @@ -# # Omnimessage - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**to** | **string** | Phone number in e.164 format | -**messages** | [**\Messente\Api\Model\OmnimessageMessagesInner[]**](OmnimessageMessagesInner.md) | An array of messages | -**dlrUrl** | **string** | URL where the delivery report will be sent | [optional] -**textStore** | [**\Messente\Api\Model\TextStore**](TextStore.md) | | [optional] -**timeToSend** | **\DateTime** | Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) | [optional] -**priority** | [**\Messente\Api\Model\Priority**](Priority.md) | | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OmnimessageMessagesInner.md b/docs/Model/OmnimessageMessagesInner.md deleted file mode 100644 index fa0bdf7..0000000 --- a/docs/Model/OmnimessageMessagesInner.md +++ /dev/null @@ -1,21 +0,0 @@ -# # OmnimessageMessagesInner - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] -**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**text** | **string** | Plaintext content for Telegram | -**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] -**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] -**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] -**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] -**udh** | **string** | hex-encoded string containing SMS UDH | [optional] -**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] -**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] -**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Priority.md b/docs/Model/Priority.md deleted file mode 100644 index 552ead2..0000000 --- a/docs/Model/Priority.md +++ /dev/null @@ -1,8 +0,0 @@ -# # Priority - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SMS.md b/docs/Model/SMS.md deleted file mode 100644 index 3558995..0000000 --- a/docs/Model/SMS.md +++ /dev/null @@ -1,15 +0,0 @@ -# # SMS - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**text** | **string** | Text content of the SMS | -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] -**udh** | **string** | hex-encoded string containing SMS UDH | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'sms'] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReport.md b/docs/Model/StatisticsReport.md deleted file mode 100644 index 283b6b7..0000000 --- a/docs/Model/StatisticsReport.md +++ /dev/null @@ -1,11 +0,0 @@ -# # StatisticsReport - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**totalMessages** | **int** | Sum of all messages | -**totalPrice** | **string** | Price for all messages | -**country** | **string** | Target country of all messages | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReportSettings.md b/docs/Model/StatisticsReportSettings.md deleted file mode 100644 index dc51d8b..0000000 --- a/docs/Model/StatisticsReportSettings.md +++ /dev/null @@ -1,11 +0,0 @@ -# # StatisticsReportSettings - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**startDate** | **\DateTime** | Start date for the report | -**endDate** | **\DateTime** | End date for the report | -**messageTypes** | **string[]** | Optional list of message types (sms, viber, whatsapp, hlr, telegram) | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReportSuccess.md b/docs/Model/StatisticsReportSuccess.md deleted file mode 100644 index 0f78d80..0000000 --- a/docs/Model/StatisticsReportSuccess.md +++ /dev/null @@ -1,9 +0,0 @@ -# # StatisticsReportSuccess - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**reports** | [**\Messente\Api\Model\StatisticsReport[]**](StatisticsReport.md) | Array of report objects | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Status.md b/docs/Model/Status.md deleted file mode 100644 index c462142..0000000 --- a/docs/Model/Status.md +++ /dev/null @@ -1,8 +0,0 @@ -# # Status - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SyncNumberLookupResult.md b/docs/Model/SyncNumberLookupResult.md deleted file mode 100644 index 38ba91f..0000000 --- a/docs/Model/SyncNumberLookupResult.md +++ /dev/null @@ -1,17 +0,0 @@ -# # SyncNumberLookupResult - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**number** | **string** | Phone number in e.164 format | -**roaming** | **bool** | Indicates if a number is roaming | [optional] -**ported** | **bool** | Indicates if a number is ported | [optional] -**roamingNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] -**currentNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] -**originalNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] -**portedNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] -**status** | **string** | Status of the phone number | [optional] -**error** | **mixed** | Indicates if any error occurred while handling the request | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SyncNumberLookupSuccess.md b/docs/Model/SyncNumberLookupSuccess.md deleted file mode 100644 index debed8f..0000000 --- a/docs/Model/SyncNumberLookupSuccess.md +++ /dev/null @@ -1,10 +0,0 @@ -# # SyncNumberLookupSuccess - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**requestId** | **string** | ID of the request | -**result** | [**\Messente\Api\Model\SyncNumberLookupResult[]**](SyncNumberLookupResult.md) | A container for phone number info objects | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Telegram.md b/docs/Model/Telegram.md deleted file mode 100644 index 1debeb9..0000000 --- a/docs/Model/Telegram.md +++ /dev/null @@ -1,15 +0,0 @@ -# # Telegram - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] -**text** | **string** | Plaintext content for Telegram | [optional] -**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] -**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] -**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TextStore.md b/docs/Model/TextStore.md deleted file mode 100644 index 3b2f6f1..0000000 --- a/docs/Model/TextStore.md +++ /dev/null @@ -1,8 +0,0 @@ -# # TextStore - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Viber.md b/docs/Model/Viber.md deleted file mode 100644 index b771b22..0000000 --- a/docs/Model/Viber.md +++ /dev/null @@ -1,16 +0,0 @@ -# # Viber - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**text** | **string** | Plaintext content for Viber | [optional] -**imageUrl** | **string** | URL for the embedded image Valid combinations: 1) image_url, 2) text, image_url, button_url, button_text | [optional] -**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] -**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'viber'] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsApp.md b/docs/Model/WhatsApp.md deleted file mode 100644 index ae5bbdd..0000000 --- a/docs/Model/WhatsApp.md +++ /dev/null @@ -1,13 +0,0 @@ -# # WhatsApp - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] -**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'whatsapp'] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppComponent.md b/docs/Model/WhatsAppComponent.md deleted file mode 100644 index 8e0104c..0000000 --- a/docs/Model/WhatsAppComponent.md +++ /dev/null @@ -1,12 +0,0 @@ -# # WhatsAppComponent - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **string** | Type of the component | -**subType** | **string** | Sub-type of the component | [optional] -**index** | **int** | index used to position buttons | [optional] -**parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppLanguage.md b/docs/Model/WhatsAppLanguage.md deleted file mode 100644 index d202598..0000000 --- a/docs/Model/WhatsAppLanguage.md +++ /dev/null @@ -1,10 +0,0 @@ -# # WhatsAppLanguage - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **string** | Language code | -**policy** | **string** | Language policy | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppParameter.md b/docs/Model/WhatsAppParameter.md deleted file mode 100644 index a7b9a68..0000000 --- a/docs/Model/WhatsAppParameter.md +++ /dev/null @@ -1,15 +0,0 @@ -# # WhatsAppParameter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **string** | Type of the parameter | -**text** | **string** | A text | [optional] -**currency** | **object** | A currency object | [optional] -**dateTime** | **object** | A date_time object | [optional] -**image** | **object** | A media object of type image | [optional] -**document** | **object** | A media object of type document | [optional] -**video** | **object** | A media object of type video | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppTemplate.md b/docs/Model/WhatsAppTemplate.md deleted file mode 100644 index a63f2a3..0000000 --- a/docs/Model/WhatsAppTemplate.md +++ /dev/null @@ -1,11 +0,0 @@ -# # WhatsAppTemplate - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the template | -**language** | [**\Messente\Api\Model\WhatsAppLanguage**](WhatsAppLanguage.md) | | -**components** | [**\Messente\Api\Model\WhatsAppComponent[]**](WhatsAppComponent.md) | List of template components | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh deleted file mode 100644 index 14bad7f..0000000 --- a/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="messente" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="messente-api-php" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/Api/BlacklistApi.php b/lib/Api/BlacklistApi.php deleted file mode 100644 index bec68a5..0000000 --- a/lib/Api/BlacklistApi.php +++ /dev/null @@ -1,1300 +0,0 @@ - [ - 'application/json', - ], - 'deleteFromBlacklist' => [ - 'application/json', - ], - 'fetchBlacklist' => [ - 'application/json', - ], - 'isBlacklisted' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addToBlacklist - * - * Adds a phone number to the blacklist - * - * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function addToBlacklist($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) - { - $this->addToBlacklistWithHttpInfo($numberToBlacklist, $contentType); - } - - /** - * Operation addToBlacklistWithHttpInfo - * - * Adds a phone number to the blacklist - * - * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) - { - $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 409: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addToBlacklistAsync - * - * Adds a phone number to the blacklist - * - * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addToBlacklistAsync($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) - { - return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addToBlacklistAsyncWithHttpInfo - * - * Adds a phone number to the blacklist - * - * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) - { - $returnType = ''; - $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addToBlacklist' - * - * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function addToBlacklistRequest($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) - { - - // verify the required parameter 'numberToBlacklist' is set - if ($numberToBlacklist === null || (is_array($numberToBlacklist) && count($numberToBlacklist) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $numberToBlacklist when calling addToBlacklist' - ); - } - - - $resourcePath = '/phonebook/blacklist'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($numberToBlacklist)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); - } else { - $httpBody = $numberToBlacklist; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteFromBlacklist - * - * Deletes a phone number from the blacklist - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function deleteFromBlacklist($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) - { - $this->deleteFromBlacklistWithHttpInfo($phone, $contentType); - } - - /** - * Operation deleteFromBlacklistWithHttpInfo - * - * Deletes a phone number from the blacklist - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) - { - $request = $this->deleteFromBlacklistRequest($phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteFromBlacklistAsync - * - * Deletes a phone number from the blacklist - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteFromBlacklistAsync($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) - { - return $this->deleteFromBlacklistAsyncWithHttpInfo($phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteFromBlacklistAsyncWithHttpInfo - * - * Deletes a phone number from the blacklist - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteFromBlacklistAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) - { - $returnType = ''; - $request = $this->deleteFromBlacklistRequest($phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteFromBlacklist' - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function deleteFromBlacklistRequest($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling deleteFromBlacklist' - ); - } - - - $resourcePath = '/phonebook/blacklist/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchBlacklist - * - * Returns all blacklisted phone numbers - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchBlacklist(string $contentType = self::contentTypes['fetchBlacklist'][0]) - { - list($response) = $this->fetchBlacklistWithHttpInfo($contentType); - return $response; - } - - /** - * Operation fetchBlacklistWithHttpInfo - * - * Returns all blacklisted phone numbers - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) - { - $request = $this->fetchBlacklistRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\FetchBlacklistSuccess' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\FetchBlacklistSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\FetchBlacklistSuccess', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\FetchBlacklistSuccess', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchBlacklistAsync - * - * Returns all blacklisted phone numbers - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchBlacklistAsync(string $contentType = self::contentTypes['fetchBlacklist'][0]) - { - return $this->fetchBlacklistAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchBlacklistAsyncWithHttpInfo - * - * Returns all blacklisted phone numbers - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchBlacklistAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) - { - $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; - $request = $this->fetchBlacklistRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchBlacklist' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchBlacklistRequest(string $contentType = self::contentTypes['fetchBlacklist'][0]) - { - - - $resourcePath = '/phonebook/blacklist'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation isBlacklisted - * - * Checks if a phone number is blacklisted - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function isBlacklisted($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) - { - $this->isBlacklistedWithHttpInfo($phone, $contentType); - } - - /** - * Operation isBlacklistedWithHttpInfo - * - * Checks if a phone number is blacklisted - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function isBlacklistedWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) - { - $request = $this->isBlacklistedRequest($phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation isBlacklistedAsync - * - * Checks if a phone number is blacklisted - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function isBlacklistedAsync($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) - { - return $this->isBlacklistedAsyncWithHttpInfo($phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation isBlacklistedAsyncWithHttpInfo - * - * Checks if a phone number is blacklisted - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function isBlacklistedAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) - { - $returnType = ''; - $request = $this->isBlacklistedRequest($phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'isBlacklisted' - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function isBlacklistedRequest($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling isBlacklisted' - ); - } - - - $resourcePath = '/phonebook/blacklist/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php deleted file mode 100644 index 4b8ca37..0000000 --- a/lib/Api/ContactsApi.php +++ /dev/null @@ -1,3384 +0,0 @@ - [ - 'application/json', - ], - 'createContact' => [ - 'application/json', - ], - 'deleteContact' => [ - 'application/json', - ], - 'fetchContact' => [ - 'application/json', - ], - 'fetchContactGroups' => [ - 'application/json', - ], - 'fetchContacts' => [ - 'application/json', - ], - 'removeContactFromGroup' => [ - 'application/json', - ], - 'updateContact' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation addContactToGroup - * - * Adds a contact to a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function addContactToGroup($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) - { - list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone, $contentType); - return $response; - } - - /** - * Operation addContactToGroupWithHttpInfo - * - * Adds a contact to a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) - { - $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 201: - if ('object' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('object' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, 'object', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 409: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = 'object'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'object', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 409: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation addContactToGroupAsync - * - * Adds a contact to a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addContactToGroupAsync($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) - { - return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation addContactToGroupAsyncWithHttpInfo - * - * Adds a contact to a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function addContactToGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) - { - $returnType = 'object'; - $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'addContactToGroup' - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function addContactToGroupRequest($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) - { - - // verify the required parameter 'groupId' is set - if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupId when calling addContactToGroup' - ); - } - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling addContactToGroup' - ); - } - - - $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($groupId !== null) { - $resourcePath = str_replace( - '{' . 'groupId' . '}', - ObjectSerializer::toPathValue($groupId), - $resourcePath - ); - } - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation createContact - * - * Creates a new contact - * - * @param \Messente\Api\Model\ContactFields $contactFields contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function createContact($contactFields, string $contentType = self::contentTypes['createContact'][0]) - { - list($response) = $this->createContactWithHttpInfo($contactFields, $contentType); - return $response; - } - - /** - * Operation createContactWithHttpInfo - * - * Creates a new contact - * - * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function createContactWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) - { - $request = $this->createContactRequest($contactFields, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 201: - if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 409: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\ContactEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ContactEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 409: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createContactAsync - * - * Creates a new contact - * - * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createContactAsync($contactFields, string $contentType = self::contentTypes['createContact'][0]) - { - return $this->createContactAsyncWithHttpInfo($contactFields, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createContactAsyncWithHttpInfo - * - * Creates a new contact - * - * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createContactAsyncWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) - { - $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->createContactRequest($contactFields, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createContact' - * - * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createContactRequest($contactFields, string $contentType = self::contentTypes['createContact'][0]) - { - - // verify the required parameter 'contactFields' is set - if ($contactFields === null || (is_array($contactFields) && count($contactFields) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contactFields when calling createContact' - ); - } - - - $resourcePath = '/phonebook/contacts'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($contactFields)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactFields)); - } else { - $httpBody = $contactFields; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteContact - * - * Deletes a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function deleteContact($phone, string $contentType = self::contentTypes['deleteContact'][0]) - { - $this->deleteContactWithHttpInfo($phone, $contentType); - } - - /** - * Operation deleteContactWithHttpInfo - * - * Deletes a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteContactWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) - { - $request = $this->deleteContactRequest($phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteContactAsync - * - * Deletes a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteContactAsync($phone, string $contentType = self::contentTypes['deleteContact'][0]) - { - return $this->deleteContactAsyncWithHttpInfo($phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteContactAsyncWithHttpInfo - * - * Deletes a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) - { - $returnType = ''; - $request = $this->deleteContactRequest($phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteContact' - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function deleteContactRequest($phone, string $contentType = self::contentTypes['deleteContact'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling deleteContact' - ); - } - - - $resourcePath = '/phonebook/contacts/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchContact - * - * Lists a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchContact($phone, string $contentType = self::contentTypes['fetchContact'][0]) - { - list($response) = $this->fetchContactWithHttpInfo($phone, $contentType); - return $response; - } - - /** - * Operation fetchContactWithHttpInfo - * - * Lists a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchContactWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) - { - $request = $this->fetchContactRequest($phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\ContactEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ContactEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchContactAsync - * - * Lists a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactAsync($phone, string $contentType = self::contentTypes['fetchContact'][0]) - { - return $this->fetchContactAsyncWithHttpInfo($phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchContactAsyncWithHttpInfo - * - * Lists a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) - { - $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->fetchContactRequest($phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchContact' - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchContactRequest($phone, string $contentType = self::contentTypes['fetchContact'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling fetchContact' - ); - } - - - $resourcePath = '/phonebook/contacts/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchContactGroups - * - * Lists groups of a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchContactGroups($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) - { - list($response) = $this->fetchContactGroupsWithHttpInfo($phone, $contentType); - return $response; - } - - /** - * Operation fetchContactGroupsWithHttpInfo - * - * Lists groups of a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchContactGroupsWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) - { - $request = $this->fetchContactGroupsRequest($phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\GroupListEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupListEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\GroupListEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\GroupListEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchContactGroupsAsync - * - * Lists groups of a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactGroupsAsync($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) - { - return $this->fetchContactGroupsAsyncWithHttpInfo($phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchContactGroupsAsyncWithHttpInfo - * - * Lists groups of a contact - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactGroupsAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) - { - $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchContactGroupsRequest($phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchContactGroups' - * - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchContactGroupsRequest($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling fetchContactGroups' - ); - } - - - $resourcePath = '/phonebook/contacts/{phone}/groups'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchContacts - * - * Returns all contacts - * - * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchContacts($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) - { - list($response) = $this->fetchContactsWithHttpInfo($groupIds, $contentType); - return $response; - } - - /** - * Operation fetchContactsWithHttpInfo - * - * Returns all contacts - * - * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchContactsWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) - { - $request = $this->fetchContactsRequest($groupIds, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\ContactListEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactListEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\ContactListEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ContactListEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchContactsAsync - * - * Returns all contacts - * - * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactsAsync($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) - { - return $this->fetchContactsAsyncWithHttpInfo($groupIds, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchContactsAsyncWithHttpInfo - * - * Returns all contacts - * - * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchContactsAsyncWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) - { - $returnType = '\Messente\Api\Model\ContactListEnvelope'; - $request = $this->fetchContactsRequest($groupIds, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchContacts' - * - * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchContactsRequest($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) - { - - - - $resourcePath = '/phonebook/contacts'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $groupIds, - 'groupIds', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation removeContactFromGroup - * - * Removes a contact from a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function removeContactFromGroup($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) - { - $this->removeContactFromGroupWithHttpInfo($groupId, $phone, $contentType); - } - - /** - * Operation removeContactFromGroupWithHttpInfo - * - * Removes a contact from a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) - { - $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation removeContactFromGroupAsync - * - * Removes a contact from a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeContactFromGroupAsync($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) - { - return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation removeContactFromGroupAsyncWithHttpInfo - * - * Removes a contact from a group - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) - { - $returnType = ''; - $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'removeContactFromGroup' - * - * @param string $groupId String in UUID format (required) - * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function removeContactFromGroupRequest($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) - { - - // verify the required parameter 'groupId' is set - if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupId when calling removeContactFromGroup' - ); - } - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling removeContactFromGroup' - ); - } - - - $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($groupId !== null) { - $resourcePath = str_replace( - '{' . 'groupId' . '}', - ObjectSerializer::toPathValue($groupId), - $resourcePath - ); - } - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateContact - * - * Updates a contact - * - * @param string $phone A phone number (required) - * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function updateContact($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) - { - list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields, $contentType); - return $response; - } - - /** - * Operation updateContactWithHttpInfo - * - * Updates a contact - * - * @param string $phone A phone number (required) - * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) - { - $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\ContactEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ContactEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateContactAsync - * - * Updates a contact - * - * @param string $phone A phone number (required) - * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateContactAsync($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) - { - return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateContactAsyncWithHttpInfo - * - * Updates a contact - * - * @param string $phone A phone number (required) - * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) - { - $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateContact' - * - * @param string $phone A phone number (required) - * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function updateContactRequest($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) - { - - // verify the required parameter 'phone' is set - if ($phone === null || (is_array($phone) && count($phone) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $phone when calling updateContact' - ); - } - - // verify the required parameter 'contactUpdateFields' is set - if ($contactUpdateFields === null || (is_array($contactUpdateFields) && count($contactUpdateFields) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $contactUpdateFields when calling updateContact' - ); - } - - - $resourcePath = '/phonebook/contacts/{phone}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($phone !== null) { - $resourcePath = str_replace( - '{' . 'phone' . '}', - ObjectSerializer::toPathValue($phone), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($contactUpdateFields)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); - } else { - $httpBody = $contactUpdateFields; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/DeliveryReportApi.php b/lib/Api/DeliveryReportApi.php deleted file mode 100644 index 037e7ff..0000000 --- a/lib/Api/DeliveryReportApi.php +++ /dev/null @@ -1,525 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation retrieveDeliveryReport - * - * Retrieves the delivery report for the Omnimessage - * - * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel - */ - public function retrieveDeliveryReport($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) - { - list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId, $contentType); - return $response; - } - - /** - * Operation retrieveDeliveryReportWithHttpInfo - * - * Retrieves the delivery report for the Omnimessage - * - * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) - */ - public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) - { - $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\DeliveryReportResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\DeliveryReportResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\DeliveryReportResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\DeliveryReportResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\DeliveryReportResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation retrieveDeliveryReportAsync - * - * Retrieves the delivery report for the Omnimessage - * - * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function retrieveDeliveryReportAsync($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) - { - return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation retrieveDeliveryReportAsyncWithHttpInfo - * - * Retrieves the delivery report for the Omnimessage - * - * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) - { - $returnType = '\Messente\Api\Model\DeliveryReportResponse'; - $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'retrieveDeliveryReport' - * - * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function retrieveDeliveryReportRequest($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) - { - - // verify the required parameter 'omnimessageId' is set - if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $omnimessageId when calling retrieveDeliveryReport' - ); - } - - - $resourcePath = '/omnimessage/{omnimessageId}/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($omnimessageId !== null) { - $resourcePath = str_replace( - '{' . 'omnimessageId' . '}', - ObjectSerializer::toPathValue($omnimessageId), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/GroupsApi.php b/lib/Api/GroupsApi.php deleted file mode 100644 index 0b4c8e5..0000000 --- a/lib/Api/GroupsApi.php +++ /dev/null @@ -1,2040 +0,0 @@ - [ - 'application/json', - ], - 'deleteGroup' => [ - 'application/json', - ], - 'fetchGroup' => [ - 'application/json', - ], - 'fetchGroups' => [ - 'application/json', - ], - 'updateGroup' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation createGroup - * - * Creates a new group with the provided name - * - * @param \Messente\Api\Model\GroupName $groupName groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function createGroup($groupName, string $contentType = self::contentTypes['createGroup'][0]) - { - list($response) = $this->createGroupWithHttpInfo($groupName, $contentType); - return $response; - } - - /** - * Operation createGroupWithHttpInfo - * - * Creates a new group with the provided name - * - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function createGroupWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) - { - $request = $this->createGroupRequest($groupName, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 201: - if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\GroupEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\GroupEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createGroupAsync - * - * Creates a new group with the provided name - * - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createGroupAsync($groupName, string $contentType = self::contentTypes['createGroup'][0]) - { - return $this->createGroupAsyncWithHttpInfo($groupName, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createGroupAsyncWithHttpInfo - * - * Creates a new group with the provided name - * - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createGroupAsyncWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) - { - $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->createGroupRequest($groupName, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createGroup' - * - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createGroupRequest($groupName, string $contentType = self::contentTypes['createGroup'][0]) - { - - // verify the required parameter 'groupName' is set - if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupName when calling createGroup' - ); - } - - - $resourcePath = '/phonebook/groups'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($groupName)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); - } else { - $httpBody = $groupName; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation deleteGroup - * - * Deletes a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function deleteGroup($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) - { - $this->deleteGroupWithHttpInfo($groupId, $contentType); - } - - /** - * Operation deleteGroupWithHttpInfo - * - * Deletes a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function deleteGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) - { - $request = $this->deleteGroupRequest($groupId, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation deleteGroupAsync - * - * Deletes a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteGroupAsync($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) - { - return $this->deleteGroupAsyncWithHttpInfo($groupId, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation deleteGroupAsyncWithHttpInfo - * - * Deletes a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function deleteGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) - { - $returnType = ''; - $request = $this->deleteGroupRequest($groupId, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'deleteGroup' - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function deleteGroupRequest($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) - { - - // verify the required parameter 'groupId' is set - if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupId when calling deleteGroup' - ); - } - - - $resourcePath = '/phonebook/groups/{groupId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($groupId !== null) { - $resourcePath = str_replace( - '{' . 'groupId' . '}', - ObjectSerializer::toPathValue($groupId), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchGroup - * - * Lists a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchGroup($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) - { - list($response) = $this->fetchGroupWithHttpInfo($groupId, $contentType); - return $response; - } - - /** - * Operation fetchGroupWithHttpInfo - * - * Lists a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) - { - $request = $this->fetchGroupRequest($groupId, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\GroupEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\GroupEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchGroupAsync - * - * Lists a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchGroupAsync($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) - { - return $this->fetchGroupAsyncWithHttpInfo($groupId, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchGroupAsyncWithHttpInfo - * - * Lists a group - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) - { - $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->fetchGroupRequest($groupId, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchGroup' - * - * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchGroupRequest($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) - { - - // verify the required parameter 'groupId' is set - if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupId when calling fetchGroup' - ); - } - - - $resourcePath = '/phonebook/groups/{groupId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($groupId !== null) { - $resourcePath = str_replace( - '{' . 'groupId' . '}', - ObjectSerializer::toPathValue($groupId), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation fetchGroups - * - * Returns all groups - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function fetchGroups(string $contentType = self::contentTypes['fetchGroups'][0]) - { - list($response) = $this->fetchGroupsWithHttpInfo($contentType); - return $response; - } - - /** - * Operation fetchGroupsWithHttpInfo - * - * Returns all groups - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) - { - $request = $this->fetchGroupsRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\GroupListEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupListEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\GroupListEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\GroupListEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchGroupsAsync - * - * Returns all groups - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchGroupsAsync(string $contentType = self::contentTypes['fetchGroups'][0]) - { - return $this->fetchGroupsAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchGroupsAsyncWithHttpInfo - * - * Returns all groups - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) - { - $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchGroupsRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchGroups' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchGroupsRequest(string $contentType = self::contentTypes['fetchGroups'][0]) - { - - - $resourcePath = '/phonebook/groups'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation updateGroup - * - * Updates a group with the provided name - * - * @param string $groupId String in UUID format (required) - * @param \Messente\Api\Model\GroupName $groupName groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook - */ - public function updateGroup($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) - { - list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName, $contentType); - return $response; - } - - /** - * Operation updateGroupWithHttpInfo - * - * Updates a group with the provided name - * - * @param string $groupId String in UUID format (required) - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) - */ - public function updateGroupWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) - { - $request = $this->updateGroupRequest($groupId, $groupName, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - default: - if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\GroupEnvelope'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\GroupEnvelope', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - default: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorPhonebook', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation updateGroupAsync - * - * Updates a group with the provided name - * - * @param string $groupId String in UUID format (required) - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateGroupAsync($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) - { - return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateGroupAsyncWithHttpInfo - * - * Updates a group with the provided name - * - * @param string $groupId String in UUID format (required) - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function updateGroupAsyncWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) - { - $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->updateGroupRequest($groupId, $groupName, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateGroup' - * - * @param string $groupId String in UUID format (required) - * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function updateGroupRequest($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) - { - - // verify the required parameter 'groupId' is set - if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupId when calling updateGroup' - ); - } - - // verify the required parameter 'groupName' is set - if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $groupName when calling updateGroup' - ); - } - - - $resourcePath = '/phonebook/groups/{groupId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($groupId !== null) { - $resourcePath = str_replace( - '{' . 'groupId' . '}', - ObjectSerializer::toPathValue($groupId), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($groupName)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); - } else { - $httpBody = $groupName; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/NumberLookupApi.php b/lib/Api/NumberLookupApi.php deleted file mode 100644 index 4bea0f0..0000000 --- a/lib/Api/NumberLookupApi.php +++ /dev/null @@ -1,559 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation fetchInfo - * - * Requests info about phone numbers - * - * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup - */ - public function fetchInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) - { - list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate, $contentType); - return $response; - } - - /** - * Operation fetchInfoWithHttpInfo - * - * Requests info about phone numbers - * - * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup, HTTP status code, HTTP response headers (array of strings) - */ - public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) - { - $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\SyncNumberLookupSuccess' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\SyncNumberLookupSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\SyncNumberLookupSuccess', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 402: - if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\SyncNumberLookupSuccess', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorNumberLookup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorNumberLookup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 402: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorNumberLookup', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation fetchInfoAsync - * - * Requests info about phone numbers - * - * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchInfoAsync($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) - { - return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation fetchInfoAsyncWithHttpInfo - * - * Requests info about phone numbers - * - * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) - { - $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; - $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'fetchInfo' - * - * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function fetchInfoRequest($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) - { - - // verify the required parameter 'numbersToInvestigate' is set - if ($numbersToInvestigate === null || (is_array($numbersToInvestigate) && count($numbersToInvestigate) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $numbersToInvestigate when calling fetchInfo' - ); - } - - - $resourcePath = '/hlr/sync'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($numbersToInvestigate)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); - } else { - $httpBody = $numbersToInvestigate; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php deleted file mode 100644 index 1cc0442..0000000 --- a/lib/Api/OmnimessageApi.php +++ /dev/null @@ -1,908 +0,0 @@ - [ - 'application/json', - ], - 'sendOmnimessage' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation cancelScheduledMessage - * - * Cancels a scheduled Omnimessage - * - * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel - */ - public function cancelScheduledMessage($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) - { - list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId, $contentType); - return $response; - } - - /** - * Operation cancelScheduledMessageWithHttpInfo - * - * Cancels a scheduled Omnimessage - * - * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) - */ - public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) - { - $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 202: - if ('object' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('object' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, 'object', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = 'object'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'object', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation cancelScheduledMessageAsync - * - * Cancels a scheduled Omnimessage - * - * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cancelScheduledMessageAsync($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) - { - return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation cancelScheduledMessageAsyncWithHttpInfo - * - * Cancels a scheduled Omnimessage - * - * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) - { - $returnType = 'object'; - $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'cancelScheduledMessage' - * - * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function cancelScheduledMessageRequest($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) - { - - // verify the required parameter 'omnimessageId' is set - if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $omnimessageId when calling cancelScheduledMessage' - ); - } - - - $resourcePath = '/omnimessage/{omnimessageId}'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($omnimessageId !== null) { - $resourcePath = str_replace( - '{' . 'omnimessageId' . '}', - ObjectSerializer::toPathValue($omnimessageId), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation sendOmnimessage - * - * Sends an Omnimessage - * - * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel - */ - public function sendOmnimessage($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) - { - list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage, $contentType); - return $response; - } - - /** - * Operation sendOmnimessageWithHttpInfo - * - * Sends an Omnimessage - * - * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) - */ - public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) - { - $request = $this->sendOmnimessageRequest($omnimessage, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 201: - if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\OmniMessageCreateSuccessResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\OmniMessageCreateSuccessResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation sendOmnimessageAsync - * - * Sends an Omnimessage - * - * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function sendOmnimessageAsync($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) - { - return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation sendOmnimessageAsyncWithHttpInfo - * - * Sends an Omnimessage - * - * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function sendOmnimessageAsyncWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) - { - $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; - $request = $this->sendOmnimessageRequest($omnimessage, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'sendOmnimessage' - * - * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function sendOmnimessageRequest($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) - { - - // verify the required parameter 'omnimessage' is set - if ($omnimessage === null || (is_array($omnimessage) && count($omnimessage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $omnimessage when calling sendOmnimessage' - ); - } - - - $resourcePath = '/omnimessage'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($omnimessage)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omnimessage)); - } else { - $httpBody = $omnimessage; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/Api/StatisticsApi.php b/lib/Api/StatisticsApi.php deleted file mode 100644 index 0d70d5a..0000000 --- a/lib/Api/StatisticsApi.php +++ /dev/null @@ -1,594 +0,0 @@ - [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: new Configuration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation createStatisticsReport - * - * Requests statistics reports for each country - * - * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics - */ - public function createStatisticsReport($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) - { - list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings, $contentType); - return $response; - } - - /** - * Operation createStatisticsReportWithHttpInfo - * - * Requests statistics reports for each country - * - * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics, HTTP status code, HTTP response headers (array of strings) - */ - public function createStatisticsReportWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) - { - $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\Messente\Api\Model\StatisticsReportSuccess' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\StatisticsReportSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\StatisticsReportSuccess', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 422: - if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 500: - if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\StatisticsReportSuccess', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorStatistics', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorStatistics', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 422: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorStatistics', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 500: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorStatistics', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation createStatisticsReportAsync - * - * Requests statistics reports for each country - * - * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createStatisticsReportAsync($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) - { - return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation createStatisticsReportAsyncWithHttpInfo - * - * Requests statistics reports for each country - * - * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) - { - $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; - $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'createStatisticsReport' - * - * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function createStatisticsReportRequest($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) - { - - // verify the required parameter 'statisticsReportSettings' is set - if ($statisticsReportSettings === null || (is_array($statisticsReportSettings) && count($statisticsReportSettings) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $statisticsReportSettings when calling createStatisticsReport' - ); - } - - - $resourcePath = '/statistics/reports'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($statisticsReportSettings)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); - } else { - $httpBody = $statisticsReportSettings; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/lib/ApiException.php b/lib/ApiException.php deleted file mode 100644 index a61f0f5..0000000 --- a/lib/ApiException.php +++ /dev/null @@ -1,120 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deserialized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/lib/Configuration.php b/lib/Configuration.php deleted file mode 100644 index a4a08cd..0000000 --- a/lib/Configuration.php +++ /dev/null @@ -1,533 +0,0 @@ -tempFolderPath = sys_get_temp_dir(); - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets the prefix for API key (e.g. Bearer) - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer - * - * @return $this - */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) - { - $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; - } - - /** - * Gets API key prefix - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string - */ - public function getApiKeyPrefix($apiKeyIdentifier) - { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; - } - - /** - * Sets the access token for OAuth - * - * @param string $accessToken Token for OAuth - * - * @return $this - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - return $this; - } - - /** - * Gets the access token for OAuth - * - * @return string Access token for OAuth - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * Sets boolean format for query string. - * - * @param string $booleanFormat Boolean format for query string - * - * @return $this - */ - public function setBooleanFormatForQueryString(string $booleanFormat) - { - $this->booleanFormatForQueryString = $booleanFormat; - - return $this; - } - - /** - * Gets boolean format for query string. - * - * @return string Boolean format for query string - */ - public function getBooleanFormatForQueryString(): string - { - return $this->booleanFormatForQueryString; - } - - /** - * Sets the username for HTTP basic authentication - * - * @param string $username Username for HTTP basic authentication - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Gets the username for HTTP basic authentication - * - * @return string Username for HTTP basic authentication - */ - public function getUsername() - { - return $this->username; - } - - /** - * Sets the password for HTTP basic authentication - * - * @param string $password Password for HTTP basic authentication - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Gets the password for HTTP basic authentication - * - * @return string Password for HTTP basic authentication - */ - public function getPassword() - { - return $this->password; - } - - /** - * Sets the host - * - * @param string $host Host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - return $this; - } - - /** - * Gets the host - * - * @return string Host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - /** - * Sets the temp folder path - * - * @param string $tempFolderPath Temp folder path - * - * @return $this - */ - public function setTempFolderPath($tempFolderPath) - { - $this->tempFolderPath = $tempFolderPath; - return $this; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() - { - return $this->tempFolderPath; - } - - /** - * Gets the default configuration instance - * - * @return Configuration - */ - public static function getDefaultConfiguration() - { - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; - } - - /** - * Sets the default configuration instance - * - * @param Configuration $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(Configuration $config) - { - self::$defaultConfiguration = $config; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $report = 'PHP SDK (Messente\Api) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return null|string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->getApiKey($apiKeyIdentifier); - - if ($apiKey === null) { - return null; - } - - if ($prefix === null) { - $keyWithPrefix = $apiKey; - } else { - $keyWithPrefix = $prefix . ' ' . $apiKey; - } - - return $keyWithPrefix; - } - - /** - * Returns an array of host settings - * - * @return array an array of host settings - */ - public function getHostSettings() - { - return [ - [ - "url" => "https://api.messente.com/v1", - "description" => "No description provided", - ] - ]; - } - - /** - * Returns URL based on host settings, index and variables - * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients - * @param int $hostIndex index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) - { - if (null === $variables) { - $variables = []; - } - - // check array index out of bound - if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); - } - - $host = $hostSettings[$hostIndex]; - $url = $host["url"]; - - // go through variable and assign a value - foreach ($host["variables"] ?? [] as $name => $variable) { - if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum - $url = str_replace("{".$name."}", $variables[$name], $url); - } else { - throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); - } - } else { - // use default value - $url = str_replace("{".$name."}", $variable["default_value"], $url); - } - } - - return $url; - } - - /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) - { - return self::getHostString($this->getHostSettings(), $index, $variables); - } -} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php deleted file mode 100644 index d28cb40..0000000 --- a/lib/HeaderSelector.php +++ /dev/null @@ -1,246 +0,0 @@ -selectAcceptHeader($accept); - if ($accept !== null) { - $headers['Accept'] = $accept; - } - - if (!$isMultipart) { - if($contentType === '') { - $contentType = 'application/json'; - } - - $headers['Content-Type'] = $contentType; - } - - return $headers; - } - - /** - * Return the header 'Accept' based on an array of Accept provided. - * - * @param string[] $accept Array of header - * - * @return null|string Accept (e.g. application/json) - */ - private function selectAcceptHeader(array $accept): ?string - { - # filter out empty entries - $accept = array_filter($accept); - - if (count($accept) === 0) { - return null; - } - - # If there's only one Accept header, just use it - if (count($accept) === 1) { - return reset($accept); - } - - # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); - if (count($headersWithJson) === 0) { - return implode(',', $accept); - } - - # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, - # to give the highest priority to json-like headers - recalculating the existing ones, if needed - return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); - } - - /** - * Create an Accept header string from the given "Accept" headers array, recalculating all weights - * - * @param string[] $accept Array of Accept Headers - * @param string[] $headersWithJson Array of Accept Headers of type "json" - * - * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") - */ - private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string - { - $processedHeaders = [ - 'withApplicationJson' => [], - 'withJson' => [], - 'withoutJson' => [], - ]; - - foreach ($accept as $header) { - - $headerData = $this->getHeaderAndWeight($header); - - if (stripos($headerData['header'], 'application/json') === 0) { - $processedHeaders['withApplicationJson'][] = $headerData; - } elseif (in_array($header, $headersWithJson, true)) { - $processedHeaders['withJson'][] = $headerData; - } else { - $processedHeaders['withoutJson'][] = $headerData; - } - } - - $acceptHeaders = []; - $currentWeight = 1000; - - $hasMoreThan28Headers = count($accept) > 28; - - foreach($processedHeaders as $headers) { - if (count($headers) > 0) { - $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); - } - } - - $acceptHeaders = array_merge(...$acceptHeaders); - - return implode(',', $acceptHeaders); - } - - /** - * Given an Accept header, returns an associative array splitting the header and its weight - * - * @param string $header "Accept" Header - * - * @return array with the header and its weight - */ - private function getHeaderAndWeight(string $header): array - { - # matches headers with weight, splitting the header and the weight in $outputArray - if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { - $headerData = [ - 'header' => $outputArray[1], - 'weight' => (int)($outputArray[2] * 1000), - ]; - } else { - $headerData = [ - 'header' => trim($header), - 'weight' => 1000, - ]; - } - - return $headerData; - } - - /** - * @param array[] $headers - * @param float $currentWeight - * @param bool $hasMoreThan28Headers - * @return string[] array of adjusted "Accept" headers - */ - private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array - { - usort($headers, function (array $a, array $b) { - return $b['weight'] - $a['weight']; - }); - - $acceptHeaders = []; - foreach ($headers as $index => $header) { - if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) - { - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - } - - $weight = $currentWeight; - - $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); - } - - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - - return $acceptHeaders; - } - - /** - * @param string $header - * @param int $weight - * @return string - */ - private function buildAcceptHeader(string $header, int $weight): string - { - if($weight === 1000) { - return $header; - } - - return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); - } - - /** - * Calculate the next weight, based on the current one. - * - * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the - * following formula: - * - * next weight = current weight - 10 ^ (floor(log(current weight - 1))) - * - * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) - * - * Starting from 1000, this generates the following series: - * - * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - * - * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works - * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 - * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. - * - * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) - * @param bool $hasMoreThan28Headers - * @return int - */ - public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int - { - if ($currentWeight <= 1) { - return 1; - } - - if ($hasMoreThan28Headers) { - return $currentWeight - 1; - } - - return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); - } -} diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php deleted file mode 100644 index e48e7d4..0000000 --- a/lib/Model/Channel.php +++ /dev/null @@ -1,70 +0,0 @@ - - */ -class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContactEnvelope'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'contact' => '\Messente\Api\Model\ContactResponseFields' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'contact' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'contact' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'contact' => 'contact' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'contact' => 'setContact' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'contact' => 'getContact' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('contact', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets contact - * - * @return \Messente\Api\Model\ContactResponseFields|null - */ - public function getContact() - { - return $this->container['contact']; - } - - /** - * Sets contact - * - * @param \Messente\Api\Model\ContactResponseFields|null $contact contact - * - * @return self - */ - public function setContact($contact) - { - if (is_null($contact)) { - throw new \InvalidArgumentException('non-nullable contact cannot be null'); - } - $this->container['contact'] = $contact; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ContactFields.php b/lib/Model/ContactFields.php deleted file mode 100644 index 971bc81..0000000 --- a/lib/Model/ContactFields.php +++ /dev/null @@ -1,783 +0,0 @@ - - */ -class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContactFields'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'phoneNumber' => 'string', - 'email' => 'string', - 'firstName' => 'string', - 'lastName' => 'string', - 'company' => 'string', - 'title' => 'string', - 'custom' => 'string', - 'custom2' => 'string', - 'custom3' => 'string', - 'custom4' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'phoneNumber' => null, - 'email' => null, - 'firstName' => null, - 'lastName' => null, - 'company' => null, - 'title' => null, - 'custom' => null, - 'custom2' => null, - 'custom3' => null, - 'custom4' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false, - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'phoneNumber' => 'phoneNumber', - 'email' => 'email', - 'firstName' => 'firstName', - 'lastName' => 'lastName', - 'company' => 'company', - 'title' => 'title', - 'custom' => 'custom', - 'custom2' => 'custom2', - 'custom3' => 'custom3', - 'custom4' => 'custom4' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'phoneNumber' => 'setPhoneNumber', - 'email' => 'setEmail', - 'firstName' => 'setFirstName', - 'lastName' => 'setLastName', - 'company' => 'setCompany', - 'title' => 'setTitle', - 'custom' => 'setCustom', - 'custom2' => 'setCustom2', - 'custom3' => 'setCustom3', - 'custom4' => 'setCustom4' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'phoneNumber' => 'getPhoneNumber', - 'email' => 'getEmail', - 'firstName' => 'getFirstName', - 'lastName' => 'getLastName', - 'company' => 'getCompany', - 'title' => 'getTitle', - 'custom' => 'getCustom', - 'custom2' => 'getCustom2', - 'custom3' => 'getCustom3', - 'custom4' => 'getCustom4' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('phoneNumber', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['phoneNumber'] === null) { - $invalidProperties[] = "'phoneNumber' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets phoneNumber - * - * @return string - */ - public function getPhoneNumber() - { - return $this->container['phoneNumber']; - } - - /** - * Sets phoneNumber - * - * @param string $phoneNumber Phone number in e.164 format - * - * @return self - */ - public function setPhoneNumber($phoneNumber) - { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } - $this->container['phoneNumber'] = $phoneNumber; - - return $this; - } - - /** - * Gets email - * - * @return string|null - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string|null $email The email of the contact - * - * @return self - */ - public function setEmail($email) - { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets firstName - * - * @return string|null - */ - public function getFirstName() - { - return $this->container['firstName']; - } - - /** - * Sets firstName - * - * @param string|null $firstName The first name of the contact - * - * @return self - */ - public function setFirstName($firstName) - { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['firstName'] = $firstName; - - return $this; - } - - /** - * Gets lastName - * - * @return string|null - */ - public function getLastName() - { - return $this->container['lastName']; - } - - /** - * Sets lastName - * - * @param string|null $lastName The last name of the contact - * - * @return self - */ - public function setLastName($lastName) - { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['lastName'] = $lastName; - - return $this; - } - - /** - * Gets company - * - * @return string|null - */ - public function getCompany() - { - return $this->container['company']; - } - - /** - * Sets company - * - * @param string|null $company The company of the contact - * - * @return self - */ - public function setCompany($company) - { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['company'] = $company; - - return $this; - } - - /** - * Gets title - * - * @return string|null - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string|null $title The title of the contact - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets custom - * - * @return string|null - */ - public function getCustom() - { - return $this->container['custom']; - } - - /** - * Sets custom - * - * @param string|null $custom The first custom field - * - * @return self - */ - public function setCustom($custom) - { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom'] = $custom; - - return $this; - } - - /** - * Gets custom2 - * - * @return string|null - */ - public function getCustom2() - { - return $this->container['custom2']; - } - - /** - * Sets custom2 - * - * @param string|null $custom2 The second custom field - * - * @return self - */ - public function setCustom2($custom2) - { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom2'] = $custom2; - - return $this; - } - - /** - * Gets custom3 - * - * @return string|null - */ - public function getCustom3() - { - return $this->container['custom3']; - } - - /** - * Sets custom3 - * - * @param string|null $custom3 The third custom field - * - * @return self - */ - public function setCustom3($custom3) - { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom3'] = $custom3; - - return $this; - } - - /** - * Gets custom4 - * - * @return string|null - */ - public function getCustom4() - { - return $this->container['custom4']; - } - - /** - * Sets custom4 - * - * @param string|null $custom4 The fourth custom field - * - * @return self - */ - public function setCustom4($custom4) - { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom4'] = $custom4; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ContactListEnvelope.php b/lib/Model/ContactListEnvelope.php deleted file mode 100644 index 81b91ea..0000000 --- a/lib/Model/ContactListEnvelope.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContactListEnvelope'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'contacts' => '\Messente\Api\Model\ContactResponseFields[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'contacts' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'contacts' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'contacts' => 'contacts' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'contacts' => 'setContacts' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'contacts' => 'getContacts' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('contacts', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets contacts - * - * @return \Messente\Api\Model\ContactResponseFields[]|null - */ - public function getContacts() - { - return $this->container['contacts']; - } - - /** - * Sets contacts - * - * @param \Messente\Api\Model\ContactResponseFields[]|null $contacts An array of contacts - * - * @return self - */ - public function setContacts($contacts) - { - if (is_null($contacts)) { - throw new \InvalidArgumentException('non-nullable contacts cannot be null'); - } - - - $this->container['contacts'] = $contacts; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ContactResponseFields.php b/lib/Model/ContactResponseFields.php deleted file mode 100644 index 06a560d..0000000 --- a/lib/Model/ContactResponseFields.php +++ /dev/null @@ -1,821 +0,0 @@ - - */ -class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContactResponseFields'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'phoneNumber' => 'string', - 'email' => 'string', - 'firstName' => 'string', - 'lastName' => 'string', - 'company' => 'string', - 'title' => 'string', - 'custom' => 'string', - 'custom2' => 'string', - 'custom3' => 'string', - 'custom4' => 'string', - 'scheduledDeletionDate' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'phoneNumber' => null, - 'email' => null, - 'firstName' => null, - 'lastName' => null, - 'company' => null, - 'title' => null, - 'custom' => null, - 'custom2' => null, - 'custom3' => null, - 'custom4' => null, - 'scheduledDeletionDate' => 'date' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false, - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true, - 'scheduledDeletionDate' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'phoneNumber' => 'phoneNumber', - 'email' => 'email', - 'firstName' => 'firstName', - 'lastName' => 'lastName', - 'company' => 'company', - 'title' => 'title', - 'custom' => 'custom', - 'custom2' => 'custom2', - 'custom3' => 'custom3', - 'custom4' => 'custom4', - 'scheduledDeletionDate' => 'scheduledDeletionDate' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'phoneNumber' => 'setPhoneNumber', - 'email' => 'setEmail', - 'firstName' => 'setFirstName', - 'lastName' => 'setLastName', - 'company' => 'setCompany', - 'title' => 'setTitle', - 'custom' => 'setCustom', - 'custom2' => 'setCustom2', - 'custom3' => 'setCustom3', - 'custom4' => 'setCustom4', - 'scheduledDeletionDate' => 'setScheduledDeletionDate' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'phoneNumber' => 'getPhoneNumber', - 'email' => 'getEmail', - 'firstName' => 'getFirstName', - 'lastName' => 'getLastName', - 'company' => 'getCompany', - 'title' => 'getTitle', - 'custom' => 'getCustom', - 'custom2' => 'getCustom2', - 'custom3' => 'getCustom3', - 'custom4' => 'getCustom4', - 'scheduledDeletionDate' => 'getScheduledDeletionDate' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('phoneNumber', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - $this->setIfExists('scheduledDeletionDate', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets phoneNumber - * - * @return string|null - */ - public function getPhoneNumber() - { - return $this->container['phoneNumber']; - } - - /** - * Sets phoneNumber - * - * @param string|null $phoneNumber Phone number in e.164 format - * - * @return self - */ - public function setPhoneNumber($phoneNumber) - { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } - $this->container['phoneNumber'] = $phoneNumber; - - return $this; - } - - /** - * Gets email - * - * @return string|null - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string|null $email The email of the contact - * - * @return self - */ - public function setEmail($email) - { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets firstName - * - * @return string|null - */ - public function getFirstName() - { - return $this->container['firstName']; - } - - /** - * Sets firstName - * - * @param string|null $firstName The first name of the contact - * - * @return self - */ - public function setFirstName($firstName) - { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['firstName'] = $firstName; - - return $this; - } - - /** - * Gets lastName - * - * @return string|null - */ - public function getLastName() - { - return $this->container['lastName']; - } - - /** - * Sets lastName - * - * @param string|null $lastName The last name of the contact - * - * @return self - */ - public function setLastName($lastName) - { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['lastName'] = $lastName; - - return $this; - } - - /** - * Gets company - * - * @return string|null - */ - public function getCompany() - { - return $this->container['company']; - } - - /** - * Sets company - * - * @param string|null $company The company of the contact - * - * @return self - */ - public function setCompany($company) - { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['company'] = $company; - - return $this; - } - - /** - * Gets title - * - * @return string|null - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string|null $title The title of the contact - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets custom - * - * @return string|null - */ - public function getCustom() - { - return $this->container['custom']; - } - - /** - * Sets custom - * - * @param string|null $custom The first custom field - * - * @return self - */ - public function setCustom($custom) - { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom'] = $custom; - - return $this; - } - - /** - * Gets custom2 - * - * @return string|null - */ - public function getCustom2() - { - return $this->container['custom2']; - } - - /** - * Sets custom2 - * - * @param string|null $custom2 The second custom field - * - * @return self - */ - public function setCustom2($custom2) - { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom2'] = $custom2; - - return $this; - } - - /** - * Gets custom3 - * - * @return string|null - */ - public function getCustom3() - { - return $this->container['custom3']; - } - - /** - * Sets custom3 - * - * @param string|null $custom3 The third custom field - * - * @return self - */ - public function setCustom3($custom3) - { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom3'] = $custom3; - - return $this; - } - - /** - * Gets custom4 - * - * @return string|null - */ - public function getCustom4() - { - return $this->container['custom4']; - } - - /** - * Sets custom4 - * - * @param string|null $custom4 The fourth custom field - * - * @return self - */ - public function setCustom4($custom4) - { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom4'] = $custom4; - - return $this; - } - - /** - * Gets scheduledDeletionDate - * - * @return \DateTime|null - */ - public function getScheduledDeletionDate() - { - return $this->container['scheduledDeletionDate']; - } - - /** - * Sets scheduledDeletionDate - * - * @param \DateTime|null $scheduledDeletionDate The date in ISO 8601 format, YYYY-MM-DD, on which the contact is going to be deleted because it has not belonged to a group for 30 days - * - * @return self - */ - public function setScheduledDeletionDate($scheduledDeletionDate) - { - if (is_null($scheduledDeletionDate)) { - array_push($this->openAPINullablesSetToNull, 'scheduledDeletionDate'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('scheduledDeletionDate', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['scheduledDeletionDate'] = $scheduledDeletionDate; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ContactUpdateFields.php b/lib/Model/ContactUpdateFields.php deleted file mode 100644 index 8f2b5a5..0000000 --- a/lib/Model/ContactUpdateFields.php +++ /dev/null @@ -1,746 +0,0 @@ - - */ -class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ContactUpdateFields'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'email' => 'string', - 'firstName' => 'string', - 'lastName' => 'string', - 'company' => 'string', - 'title' => 'string', - 'custom' => 'string', - 'custom2' => 'string', - 'custom3' => 'string', - 'custom4' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'email' => null, - 'firstName' => null, - 'lastName' => null, - 'company' => null, - 'title' => null, - 'custom' => null, - 'custom2' => null, - 'custom3' => null, - 'custom4' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'email' => 'email', - 'firstName' => 'firstName', - 'lastName' => 'lastName', - 'company' => 'company', - 'title' => 'title', - 'custom' => 'custom', - 'custom2' => 'custom2', - 'custom3' => 'custom3', - 'custom4' => 'custom4' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'email' => 'setEmail', - 'firstName' => 'setFirstName', - 'lastName' => 'setLastName', - 'company' => 'setCompany', - 'title' => 'setTitle', - 'custom' => 'setCustom', - 'custom2' => 'setCustom2', - 'custom3' => 'setCustom3', - 'custom4' => 'setCustom4' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'email' => 'getEmail', - 'firstName' => 'getFirstName', - 'lastName' => 'getLastName', - 'company' => 'getCompany', - 'title' => 'getTitle', - 'custom' => 'getCustom', - 'custom2' => 'getCustom2', - 'custom3' => 'getCustom3', - 'custom4' => 'getCustom4' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets email - * - * @return string|null - */ - public function getEmail() - { - return $this->container['email']; - } - - /** - * Sets email - * - * @param string|null $email The email of the contact - * - * @return self - */ - public function setEmail($email) - { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['email'] = $email; - - return $this; - } - - /** - * Gets firstName - * - * @return string|null - */ - public function getFirstName() - { - return $this->container['firstName']; - } - - /** - * Sets firstName - * - * @param string|null $firstName The first name of the contact - * - * @return self - */ - public function setFirstName($firstName) - { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['firstName'] = $firstName; - - return $this; - } - - /** - * Gets lastName - * - * @return string|null - */ - public function getLastName() - { - return $this->container['lastName']; - } - - /** - * Sets lastName - * - * @param string|null $lastName The last name of the contact - * - * @return self - */ - public function setLastName($lastName) - { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['lastName'] = $lastName; - - return $this; - } - - /** - * Gets company - * - * @return string|null - */ - public function getCompany() - { - return $this->container['company']; - } - - /** - * Sets company - * - * @param string|null $company The company of the contact - * - * @return self - */ - public function setCompany($company) - { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['company'] = $company; - - return $this; - } - - /** - * Gets title - * - * @return string|null - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string|null $title The title of the contact - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets custom - * - * @return string|null - */ - public function getCustom() - { - return $this->container['custom']; - } - - /** - * Sets custom - * - * @param string|null $custom The first custom field - * - * @return self - */ - public function setCustom($custom) - { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom'] = $custom; - - return $this; - } - - /** - * Gets custom2 - * - * @return string|null - */ - public function getCustom2() - { - return $this->container['custom2']; - } - - /** - * Sets custom2 - * - * @param string|null $custom2 The second custom field - * - * @return self - */ - public function setCustom2($custom2) - { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom2'] = $custom2; - - return $this; - } - - /** - * Gets custom3 - * - * @return string|null - */ - public function getCustom3() - { - return $this->container['custom3']; - } - - /** - * Sets custom3 - * - * @param string|null $custom3 The third custom field - * - * @return self - */ - public function setCustom3($custom3) - { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom3'] = $custom3; - - return $this; - } - - /** - * Gets custom4 - * - * @return string|null - */ - public function getCustom4() - { - return $this->container['custom4']; - } - - /** - * Sets custom4 - * - * @param string|null $custom4 The fourth custom field - * - * @return self - */ - public function setCustom4($custom4) - { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['custom4'] = $custom4; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/DeliveryReportResponse.php b/lib/Model/DeliveryReportResponse.php deleted file mode 100644 index 39c14ed..0000000 --- a/lib/Model/DeliveryReportResponse.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DeliveryReportResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'statuses' => '\Messente\Api\Model\DeliveryResult[]', - 'to' => 'string', - 'omnimessageId' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'statuses' => null, - 'to' => null, - 'omnimessageId' => 'UUID' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'statuses' => false, - 'to' => false, - 'omnimessageId' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'statuses' => 'statuses', - 'to' => 'to', - 'omnimessageId' => 'omnimessage_id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'statuses' => 'setStatuses', - 'to' => 'setTo', - 'omnimessageId' => 'setOmnimessageId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'statuses' => 'getStatuses', - 'to' => 'getTo', - 'omnimessageId' => 'getOmnimessageId' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('statuses', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('omnimessageId', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['statuses'] === null) { - $invalidProperties[] = "'statuses' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - if ($this->container['omnimessageId'] === null) { - $invalidProperties[] = "'omnimessageId' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets statuses - * - * @return \Messente\Api\Model\DeliveryResult[] - */ - public function getStatuses() - { - return $this->container['statuses']; - } - - /** - * Sets statuses - * - * @param \Messente\Api\Model\DeliveryResult[] $statuses Contains the delivery reports for each channel, ordered by send order - * - * @return self - */ - public function setStatuses($statuses) - { - if (is_null($statuses)) { - throw new \InvalidArgumentException('non-nullable statuses cannot be null'); - } - $this->container['statuses'] = $statuses; - - return $this; - } - - /** - * Gets to - * - * @return string - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param string $to Phone number in e.164 format - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets omnimessageId - * - * @return string - */ - public function getOmnimessageId() - { - return $this->container['omnimessageId']; - } - - /** - * Sets omnimessageId - * - * @param string $omnimessageId Unique identifier for the omnimessage - * - * @return self - */ - public function setOmnimessageId($omnimessageId) - { - if (is_null($omnimessageId)) { - throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); - } - $this->container['omnimessageId'] = $omnimessageId; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/DeliveryResult.php b/lib/Model/DeliveryResult.php deleted file mode 100644 index 09858a8..0000000 --- a/lib/Model/DeliveryResult.php +++ /dev/null @@ -1,588 +0,0 @@ - - */ -class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DeliveryResult'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'status' => '\Messente\Api\Model\Status', - 'channel' => '\Messente\Api\Model\Channel', - 'messageId' => 'string', - 'error' => 'string', - 'err' => '\Messente\Api\Model\ErrorCodeOmnichannelMachine', - 'timestamp' => '\DateTime' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'status' => null, - 'channel' => null, - 'messageId' => 'UUID', - 'error' => null, - 'err' => null, - 'timestamp' => 'date-time' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'status' => false, - 'channel' => false, - 'messageId' => false, - 'error' => true, - 'err' => false, - 'timestamp' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'status' => 'status', - 'channel' => 'channel', - 'messageId' => 'message_id', - 'error' => 'error', - 'err' => 'err', - 'timestamp' => 'timestamp' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'status' => 'setStatus', - 'channel' => 'setChannel', - 'messageId' => 'setMessageId', - 'error' => 'setError', - 'err' => 'setErr', - 'timestamp' => 'setTimestamp' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'status' => 'getStatus', - 'channel' => 'getChannel', - 'messageId' => 'getMessageId', - 'error' => 'getError', - 'err' => 'getErr', - 'timestamp' => 'getTimestamp' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], null); - $this->setIfExists('messageId', $data ?? [], null); - $this->setIfExists('error', $data ?? [], null); - $this->setIfExists('err', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets status - * - * @return \Messente\Api\Model\Status|null - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param \Messente\Api\Model\Status|null $status status - * - * @return self - */ - public function setStatus($status) - { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets channel - * - * @return \Messente\Api\Model\Channel|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param \Messente\Api\Model\Channel|null $channel channel - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $this->container['channel'] = $channel; - - return $this; - } - - /** - * Gets messageId - * - * @return string|null - */ - public function getMessageId() - { - return $this->container['messageId']; - } - - /** - * Sets messageId - * - * @param string|null $messageId Unique identifier for the message - * - * @return self - */ - public function setMessageId($messageId) - { - if (is_null($messageId)) { - throw new \InvalidArgumentException('non-nullable messageId cannot be null'); - } - $this->container['messageId'] = $messageId; - - return $this; - } - - /** - * Gets error - * - * @return string|null - */ - public function getError() - { - return $this->container['error']; - } - - /** - * Sets error - * - * @param string|null $error Human-readable description of what went wrong, *null* in case of success or if the message has not been processed yet - * - * @return self - */ - public function setError($error) - { - if (is_null($error)) { - array_push($this->openAPINullablesSetToNull, 'error'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('error', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['error'] = $error; - - return $this; - } - - /** - * Gets err - * - * @return \Messente\Api\Model\ErrorCodeOmnichannelMachine|null - */ - public function getErr() - { - return $this->container['err']; - } - - /** - * Sets err - * - * @param \Messente\Api\Model\ErrorCodeOmnichannelMachine|null $err err - * - * @return self - */ - public function setErr($err) - { - if (is_null($err)) { - throw new \InvalidArgumentException('non-nullable err cannot be null'); - } - $this->container['err'] = $err; - - return $this; - } - - /** - * Gets timestamp - * - * @return \DateTime|null - */ - public function getTimestamp() - { - return $this->container['timestamp']; - } - - /** - * Sets timestamp - * - * @param \DateTime|null $timestamp When this status was received by Omnichannel API - * - * @return self - */ - public function setTimestamp($timestamp) - { - if (is_null($timestamp)) { - throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); - } - $this->container['timestamp'] = $timestamp; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorCodeOmnichannel.php b/lib/Model/ErrorCodeOmnichannel.php deleted file mode 100644 index 51e6e9c..0000000 --- a/lib/Model/ErrorCodeOmnichannel.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorItemNumberLookup'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'error' => '\Messente\Api\Model\ErrorItemNumberLookupError' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'error' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'error' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'error' => 'error' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'error' => 'setError' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'error' => 'getError' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('error', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['error'] === null) { - $invalidProperties[] = "'error' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets error - * - * @return \Messente\Api\Model\ErrorItemNumberLookupError - */ - public function getError() - { - return $this->container['error']; - } - - /** - * Sets error - * - * @param \Messente\Api\Model\ErrorItemNumberLookupError $error error - * - * @return self - */ - public function setError($error) - { - if (is_null($error)) { - throw new \InvalidArgumentException('non-nullable error cannot be null'); - } - $this->container['error'] = $error; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorItemNumberLookupError.php b/lib/Model/ErrorItemNumberLookupError.php deleted file mode 100644 index 54436a2..0000000 --- a/lib/Model/ErrorItemNumberLookupError.php +++ /dev/null @@ -1,467 +0,0 @@ - - */ -class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorItemNumberLookup_error'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'description' => 'string', - 'code' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'description' => null, - 'code' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'description' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'description' => 'description', - 'code' => 'code' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'description' => 'setDescription', - 'code' => 'setCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'description' => 'getDescription', - 'code' => 'getCode' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['description'] === null) { - $invalidProperties[] = "'description' can't be null"; - } - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - if (($this->container['code'] > 106)) { - $invalidProperties[] = "invalid value for 'code', must be smaller than or equal to 106."; - } - - if (($this->container['code'] < 101)) { - $invalidProperties[] = "invalid value for 'code', must be bigger than or equal to 101."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets description - * - * @return string - */ - public function getDescription() - { - return $this->container['description']; - } - - /** - * Sets description - * - * @param string $description Error description - * - * @return self - */ - public function setDescription($description) - { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); - } - $this->container['description'] = $description; - - return $this; - } - - /** - * Gets code - * - * @return int - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param int $code Matches the following error title. This field is a constant * 101 - Unauthorized * 102 - Invalid arguments or parameters * 103 - Server error * 104 - Crediting error #1 * 105 - Crediting error #2 * 106 - Client error - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - - if (($code > 106)) { - throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be smaller than or equal to 106.'); - } - if (($code < 101)) { - throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be bigger than or equal to 101.'); - } - - $this->container['code'] = $code; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorItemOmnichannel.php b/lib/Model/ErrorItemOmnichannel.php deleted file mode 100644 index afd0fc5..0000000 --- a/lib/Model/ErrorItemOmnichannel.php +++ /dev/null @@ -1,532 +0,0 @@ - - */ -class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorItemOmnichannel'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'title' => '\Messente\Api\Model\ErrorTitleOmnichannel', - 'detail' => 'string', - 'code' => '\Messente\Api\Model\ErrorCodeOmnichannel', - 'source' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'title' => null, - 'detail' => null, - 'code' => null, - 'source' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'detail' => false, - 'code' => false, - 'source' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'detail' => 'detail', - 'code' => 'code', - 'source' => 'source' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'detail' => 'setDetail', - 'code' => 'setCode', - 'source' => 'setSource' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'detail' => 'getDetail', - 'code' => 'getCode', - 'source' => 'getSource' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('detail', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('source', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['title'] === null) { - $invalidProperties[] = "'title' can't be null"; - } - if ($this->container['detail'] === null) { - $invalidProperties[] = "'detail' can't be null"; - } - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - if ($this->container['source'] === null) { - $invalidProperties[] = "'source' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return \Messente\Api\Model\ErrorTitleOmnichannel - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param \Messente\Api\Model\ErrorTitleOmnichannel $title title - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets detail - * - * @return string - */ - public function getDetail() - { - return $this->container['detail']; - } - - /** - * Sets detail - * - * @param string $detail Free form more detailed description of the error - * - * @return self - */ - public function setDetail($detail) - { - if (is_null($detail)) { - throw new \InvalidArgumentException('non-nullable detail cannot be null'); - } - $this->container['detail'] = $detail; - - return $this; - } - - /** - * Gets code - * - * @return \Messente\Api\Model\ErrorCodeOmnichannel - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param \Messente\Api\Model\ErrorCodeOmnichannel $code code - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets source - * - * @return string - */ - public function getSource() - { - return $this->container['source']; - } - - /** - * Sets source - * - * @param string $source Describes which field is causing the issue in the payload, null for non 400 status code responses - * - * @return self - */ - public function setSource($source) - { - if (is_null($source)) { - array_push($this->openAPINullablesSetToNull, 'source'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('source', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['source'] = $source; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorItemPhonebook.php b/lib/Model/ErrorItemPhonebook.php deleted file mode 100644 index 2a3b976..0000000 --- a/lib/Model/ErrorItemPhonebook.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorItemPhonebook'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'title' => '\Messente\Api\Model\ErrorTitlePhonebook', - 'detail' => 'string', - 'code' => '\Messente\Api\Model\ErrorCodePhonebook' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'title' => null, - 'detail' => null, - 'code' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'detail' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'detail' => 'detail', - 'code' => 'code' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'detail' => 'setDetail', - 'code' => 'setCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'detail' => 'getDetail', - 'code' => 'getCode' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('detail', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['title'] === null) { - $invalidProperties[] = "'title' can't be null"; - } - if ($this->container['detail'] === null) { - $invalidProperties[] = "'detail' can't be null"; - } - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return \Messente\Api\Model\ErrorTitlePhonebook - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param \Messente\Api\Model\ErrorTitlePhonebook $title title - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets detail - * - * @return string - */ - public function getDetail() - { - return $this->container['detail']; - } - - /** - * Sets detail - * - * @param string $detail Free form more detailed description of the error - * - * @return self - */ - public function setDetail($detail) - { - if (is_null($detail)) { - throw new \InvalidArgumentException('non-nullable detail cannot be null'); - } - $this->container['detail'] = $detail; - - return $this; - } - - /** - * Gets code - * - * @return \Messente\Api\Model\ErrorCodePhonebook - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param \Messente\Api\Model\ErrorCodePhonebook $code code - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorItemStatistics.php b/lib/Model/ErrorItemStatistics.php deleted file mode 100644 index d01b438..0000000 --- a/lib/Model/ErrorItemStatistics.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorItemStatistics'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'title' => 'string', - 'details' => 'string', - 'code' => '\Messente\Api\Model\ErrorCodeStatistics' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'title' => null, - 'details' => null, - 'code' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'details' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'title' => 'title', - 'details' => 'details', - 'code' => 'code' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'title' => 'setTitle', - 'details' => 'setDetails', - 'code' => 'setCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'title' => 'getTitle', - 'details' => 'getDetails', - 'code' => 'getCode' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('details', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['title'] === null) { - $invalidProperties[] = "'title' can't be null"; - } - if ($this->container['details'] === null) { - $invalidProperties[] = "'details' can't be null"; - } - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets title - * - * @return string - */ - public function getTitle() - { - return $this->container['title']; - } - - /** - * Sets title - * - * @param string $title Error title - * - * @return self - */ - public function setTitle($title) - { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } - $this->container['title'] = $title; - - return $this; - } - - /** - * Gets details - * - * @return string - */ - public function getDetails() - { - return $this->container['details']; - } - - /** - * Sets details - * - * @param string $details Error details - * - * @return self - */ - public function setDetails($details) - { - if (is_null($details)) { - throw new \InvalidArgumentException('non-nullable details cannot be null'); - } - $this->container['details'] = $details; - - return $this; - } - - /** - * Gets code - * - * @return \Messente\Api\Model\ErrorCodeStatistics - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param \Messente\Api\Model\ErrorCodeStatistics $code code - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorNumberLookup.php b/lib/Model/ErrorNumberLookup.php deleted file mode 100644 index fce5576..0000000 --- a/lib/Model/ErrorNumberLookup.php +++ /dev/null @@ -1,414 +0,0 @@ - - */ -class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorNumberLookup'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\Messente\Api\Model\ErrorItemNumberLookup[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'errors' => 'errors' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets errors - * - * @return \Messente\Api\Model\ErrorItemNumberLookup[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \Messente\Api\Model\ErrorItemNumberLookup[] $errors An array of errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorOmnichannel.php b/lib/Model/ErrorOmnichannel.php deleted file mode 100644 index d613256..0000000 --- a/lib/Model/ErrorOmnichannel.php +++ /dev/null @@ -1,414 +0,0 @@ - - */ -class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorOmnichannel'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\Messente\Api\Model\ErrorItemOmnichannel[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'errors' => 'errors' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets errors - * - * @return \Messente\Api\Model\ErrorItemOmnichannel[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \Messente\Api\Model\ErrorItemOmnichannel[] $errors An array of errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorPhonebook.php b/lib/Model/ErrorPhonebook.php deleted file mode 100644 index 4a42fb3..0000000 --- a/lib/Model/ErrorPhonebook.php +++ /dev/null @@ -1,414 +0,0 @@ - - */ -class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorPhonebook'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\Messente\Api\Model\ErrorItemPhonebook[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'errors' => 'errors' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets errors - * - * @return \Messente\Api\Model\ErrorItemPhonebook[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \Messente\Api\Model\ErrorItemPhonebook[] $errors An array of errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorStatistics.php b/lib/Model/ErrorStatistics.php deleted file mode 100644 index 1c49519..0000000 --- a/lib/Model/ErrorStatistics.php +++ /dev/null @@ -1,414 +0,0 @@ - - */ -class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ErrorStatistics'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'errors' => '\Messente\Api\Model\ErrorItemStatistics[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'errors' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'errors' => 'errors' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'errors' => 'setErrors' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'errors' => 'getErrors' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['errors'] === null) { - $invalidProperties[] = "'errors' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets errors - * - * @return \Messente\Api\Model\ErrorItemStatistics[] - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param \Messente\Api\Model\ErrorItemStatistics[] $errors An array of errors - * - * @return self - */ - public function setErrors($errors) - { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } - $this->container['errors'] = $errors; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ErrorTitleOmnichannel.php b/lib/Model/ErrorTitleOmnichannel.php deleted file mode 100644 index 2538506..0000000 --- a/lib/Model/ErrorTitleOmnichannel.php +++ /dev/null @@ -1,79 +0,0 @@ - - */ -class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'FetchBlacklistSuccess'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'phoneNumbers' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'phoneNumbers' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumbers' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'phoneNumbers' => 'phoneNumbers' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'phoneNumbers' => 'setPhoneNumbers' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'phoneNumbers' => 'getPhoneNumbers' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('phoneNumbers', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets phoneNumbers - * - * @return string[]|null - */ - public function getPhoneNumbers() - { - return $this->container['phoneNumbers']; - } - - /** - * Sets phoneNumbers - * - * @param string[]|null $phoneNumbers Array of unique phone numbers - * - * @return self - */ - public function setPhoneNumbers($phoneNumbers) - { - if (is_null($phoneNumbers)) { - throw new \InvalidArgumentException('non-nullable phoneNumbers cannot be null'); - } - - - $this->container['phoneNumbers'] = $phoneNumbers; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupEnvelope.php b/lib/Model/GroupEnvelope.php deleted file mode 100644 index 60a9d7b..0000000 --- a/lib/Model/GroupEnvelope.php +++ /dev/null @@ -1,411 +0,0 @@ - - */ -class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'GroupEnvelope'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'group' => '\Messente\Api\Model\GroupResponseFields' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'group' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'group' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'group' => 'group' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'group' => 'setGroup' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'group' => 'getGroup' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('group', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets group - * - * @return \Messente\Api\Model\GroupResponseFields|null - */ - public function getGroup() - { - return $this->container['group']; - } - - /** - * Sets group - * - * @param \Messente\Api\Model\GroupResponseFields|null $group group - * - * @return self - */ - public function setGroup($group) - { - if (is_null($group)) { - throw new \InvalidArgumentException('non-nullable group cannot be null'); - } - $this->container['group'] = $group; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupListEnvelope.php b/lib/Model/GroupListEnvelope.php deleted file mode 100644 index b0fc28c..0000000 --- a/lib/Model/GroupListEnvelope.php +++ /dev/null @@ -1,413 +0,0 @@ - - */ -class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'GroupListEnvelope'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'groups' => '\Messente\Api\Model\GroupResponseFields[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'groups' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'groups' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'groups' => 'groups' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'groups' => 'setGroups' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'groups' => 'getGroups' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('groups', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets groups - * - * @return \Messente\Api\Model\GroupResponseFields[]|null - */ - public function getGroups() - { - return $this->container['groups']; - } - - /** - * Sets groups - * - * @param \Messente\Api\Model\GroupResponseFields[]|null $groups An array of groups - * - * @return self - */ - public function setGroups($groups) - { - if (is_null($groups)) { - throw new \InvalidArgumentException('non-nullable groups cannot be null'); - } - - - $this->container['groups'] = $groups; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupName.php b/lib/Model/GroupName.php deleted file mode 100644 index 17725d9..0000000 --- a/lib/Model/GroupName.php +++ /dev/null @@ -1,423 +0,0 @@ - - */ -class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'GroupName'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'name' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('name', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ((mb_strlen($this->container['name']) < 1)) { - $invalidProperties[] = "invalid value for 'name', the character length must be bigger than or equal to 1."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the group - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - - if ((mb_strlen($name) < 1)) { - throw new \InvalidArgumentException('invalid length for $name when calling GroupName., must be bigger than or equal to 1.'); - } - - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/GroupResponseFields.php b/lib/Model/GroupResponseFields.php deleted file mode 100644 index e2632ba..0000000 --- a/lib/Model/GroupResponseFields.php +++ /dev/null @@ -1,529 +0,0 @@ - - */ -class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'GroupResponseFields'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'string', - 'name' => 'string', - 'createdOn' => 'string', - 'contactsCount' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => null, - 'name' => null, - 'createdOn' => '%Y-%m-%dT%H:%M:%S.%fZ', - 'contactsCount' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'name' => false, - 'createdOn' => true, - 'contactsCount' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'name' => 'name', - 'createdOn' => 'createdOn', - 'contactsCount' => 'contactsCount' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'name' => 'setName', - 'createdOn' => 'setCreatedOn', - 'contactsCount' => 'setContactsCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'name' => 'getName', - 'createdOn' => 'getCreatedOn', - 'contactsCount' => 'getContactsCount' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('createdOn', $data ?? [], null); - $this->setIfExists('contactsCount', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['contactsCount'] === null) { - $invalidProperties[] = "'contactsCount' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string $id Id string in UUID format - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name The name of the group - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets createdOn - * - * @return string|null - */ - public function getCreatedOn() - { - return $this->container['createdOn']; - } - - /** - * Sets createdOn - * - * @param string|null $createdOn When the group was created - * - * @return self - */ - public function setCreatedOn($createdOn) - { - if (is_null($createdOn)) { - array_push($this->openAPINullablesSetToNull, 'createdOn'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('createdOn', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['createdOn'] = $createdOn; - - return $this; - } - - /** - * Gets contactsCount - * - * @return int - */ - public function getContactsCount() - { - return $this->container['contactsCount']; - } - - /** - * Sets contactsCount - * - * @param int $contactsCount The count of contacts in the group - * - * @return self - */ - public function setContactsCount($contactsCount) - { - if (is_null($contactsCount)) { - throw new \InvalidArgumentException('non-nullable contactsCount cannot be null'); - } - $this->container['contactsCount'] = $contactsCount; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/MessageResult.php b/lib/Model/MessageResult.php deleted file mode 100644 index 1aa0a00..0000000 --- a/lib/Model/MessageResult.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'MessageResult'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'messageId' => 'string', - 'channel' => '\Messente\Api\Model\Channel', - 'sender' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'messageId' => 'UUID', - 'channel' => null, - 'sender' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'messageId' => false, - 'channel' => false, - 'sender' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'messageId' => 'message_id', - 'channel' => 'channel', - 'sender' => 'sender' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'messageId' => 'setMessageId', - 'channel' => 'setChannel', - 'sender' => 'setSender' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'messageId' => 'getMessageId', - 'channel' => 'getChannel', - 'sender' => 'getSender' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('messageId', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], null); - $this->setIfExists('sender', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['messageId'] === null) { - $invalidProperties[] = "'messageId' can't be null"; - } - if ($this->container['channel'] === null) { - $invalidProperties[] = "'channel' can't be null"; - } - if ($this->container['sender'] === null) { - $invalidProperties[] = "'sender' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets messageId - * - * @return string - */ - public function getMessageId() - { - return $this->container['messageId']; - } - - /** - * Sets messageId - * - * @param string $messageId Unique identifier for the message - * - * @return self - */ - public function setMessageId($messageId) - { - if (is_null($messageId)) { - throw new \InvalidArgumentException('non-nullable messageId cannot be null'); - } - $this->container['messageId'] = $messageId; - - return $this; - } - - /** - * Gets channel - * - * @return \Messente\Api\Model\Channel - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param \Messente\Api\Model\Channel $channel channel - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $this->container['channel'] = $channel; - - return $this; - } - - /** - * Gets sender - * - * @return string - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string $sender Sender that was used for the message - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/MobileNetwork.php b/lib/Model/MobileNetwork.php deleted file mode 100644 index 009d7f5..0000000 --- a/lib/Model/MobileNetwork.php +++ /dev/null @@ -1,547 +0,0 @@ - - */ -class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'MobileNetwork'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'mccmnc' => 'string', - 'networkName' => 'string', - 'countryName' => 'string', - 'countryPrefix' => 'string', - 'countryCode' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'mccmnc' => null, - 'networkName' => null, - 'countryName' => null, - 'countryPrefix' => null, - 'countryCode' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'mccmnc' => false, - 'networkName' => false, - 'countryName' => false, - 'countryPrefix' => false, - 'countryCode' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'mccmnc' => 'mccmnc', - 'networkName' => 'networkName', - 'countryName' => 'countryName', - 'countryPrefix' => 'countryPrefix', - 'countryCode' => 'countryCode' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'mccmnc' => 'setMccmnc', - 'networkName' => 'setNetworkName', - 'countryName' => 'setCountryName', - 'countryPrefix' => 'setCountryPrefix', - 'countryCode' => 'setCountryCode' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'mccmnc' => 'getMccmnc', - 'networkName' => 'getNetworkName', - 'countryName' => 'getCountryName', - 'countryPrefix' => 'getCountryPrefix', - 'countryCode' => 'getCountryCode' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('mccmnc', $data ?? [], null); - $this->setIfExists('networkName', $data ?? [], null); - $this->setIfExists('countryName', $data ?? [], null); - $this->setIfExists('countryPrefix', $data ?? [], null); - $this->setIfExists('countryCode', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets mccmnc - * - * @return string|null - */ - public function getMccmnc() - { - return $this->container['mccmnc']; - } - - /** - * Sets mccmnc - * - * @param string|null $mccmnc Mobile country and mobile network code - * - * @return self - */ - public function setMccmnc($mccmnc) - { - if (is_null($mccmnc)) { - throw new \InvalidArgumentException('non-nullable mccmnc cannot be null'); - } - $this->container['mccmnc'] = $mccmnc; - - return $this; - } - - /** - * Gets networkName - * - * @return string|null - */ - public function getNetworkName() - { - return $this->container['networkName']; - } - - /** - * Sets networkName - * - * @param string|null $networkName Mobile network name - * - * @return self - */ - public function setNetworkName($networkName) - { - if (is_null($networkName)) { - throw new \InvalidArgumentException('non-nullable networkName cannot be null'); - } - $this->container['networkName'] = $networkName; - - return $this; - } - - /** - * Gets countryName - * - * @return string|null - */ - public function getCountryName() - { - return $this->container['countryName']; - } - - /** - * Sets countryName - * - * @param string|null $countryName Country name - * - * @return self - */ - public function setCountryName($countryName) - { - if (is_null($countryName)) { - throw new \InvalidArgumentException('non-nullable countryName cannot be null'); - } - $this->container['countryName'] = $countryName; - - return $this; - } - - /** - * Gets countryPrefix - * - * @return string|null - */ - public function getCountryPrefix() - { - return $this->container['countryPrefix']; - } - - /** - * Sets countryPrefix - * - * @param string|null $countryPrefix Country prefix - * - * @return self - */ - public function setCountryPrefix($countryPrefix) - { - if (is_null($countryPrefix)) { - throw new \InvalidArgumentException('non-nullable countryPrefix cannot be null'); - } - $this->container['countryPrefix'] = $countryPrefix; - - return $this; - } - - /** - * Gets countryCode - * - * @return string|null - */ - public function getCountryCode() - { - return $this->container['countryCode']; - } - - /** - * Sets countryCode - * - * @param string|null $countryCode Country code - * - * @return self - */ - public function setCountryCode($countryCode) - { - if (is_null($countryCode)) { - throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); - } - $this->container['countryCode'] = $countryCode; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php deleted file mode 100644 index da1a39e..0000000 --- a/lib/Model/ModelInterface.php +++ /dev/null @@ -1,112 +0,0 @@ - - */ -class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'NumberToBlacklist'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'phoneNumber' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'phoneNumber' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'phoneNumber' => 'phoneNumber' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'phoneNumber' => 'setPhoneNumber' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'phoneNumber' => 'getPhoneNumber' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('phoneNumber', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['phoneNumber'] === null) { - $invalidProperties[] = "'phoneNumber' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets phoneNumber - * - * @return string - */ - public function getPhoneNumber() - { - return $this->container['phoneNumber']; - } - - /** - * Sets phoneNumber - * - * @param string $phoneNumber Phone number in e.164 format - * - * @return self - */ - public function setPhoneNumber($phoneNumber) - { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } - $this->container['phoneNumber'] = $phoneNumber; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/NumbersToInvestigate.php b/lib/Model/NumbersToInvestigate.php deleted file mode 100644 index fcdb632..0000000 --- a/lib/Model/NumbersToInvestigate.php +++ /dev/null @@ -1,429 +0,0 @@ - - */ -class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'NumbersToInvestigate'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'numbers' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'numbers' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'numbers' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'numbers' => 'numbers' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'numbers' => 'setNumbers' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'numbers' => 'getNumbers' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('numbers', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['numbers'] === null) { - $invalidProperties[] = "'numbers' can't be null"; - } - if ((count($this->container['numbers']) > 10)) { - $invalidProperties[] = "invalid value for 'numbers', number of items must be less than or equal to 10."; - } - - if ((count($this->container['numbers']) < 1)) { - $invalidProperties[] = "invalid value for 'numbers', number of items must be greater than or equal to 1."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets numbers - * - * @return string[] - */ - public function getNumbers() - { - return $this->container['numbers']; - } - - /** - * Sets numbers - * - * @param string[] $numbers A list of phone numbers. Max 10 numbers per request - * - * @return self - */ - public function setNumbers($numbers) - { - if (is_null($numbers)) { - throw new \InvalidArgumentException('non-nullable numbers cannot be null'); - } - - if ((count($numbers) > 10)) { - throw new \InvalidArgumentException('invalid value for $numbers when calling NumbersToInvestigate., number of items must be less than or equal to 10.'); - } - if ((count($numbers) < 1)) { - throw new \InvalidArgumentException('invalid length for $numbers when calling NumbersToInvestigate., number of items must be greater than or equal to 1.'); - } - $this->container['numbers'] = $numbers; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/OmniMessageCreateSuccessResponse.php b/lib/Model/OmniMessageCreateSuccessResponse.php deleted file mode 100644 index 51f9bf1..0000000 --- a/lib/Model/OmniMessageCreateSuccessResponse.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'OmniMessageCreateSuccessResponse'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'messages' => '\Messente\Api\Model\MessageResult[]', - 'to' => 'string', - 'omnimessageId' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'messages' => null, - 'to' => null, - 'omnimessageId' => 'UUID' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'messages' => false, - 'to' => false, - 'omnimessageId' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'messages' => 'messages', - 'to' => 'to', - 'omnimessageId' => 'omnimessage_id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'messages' => 'setMessages', - 'to' => 'setTo', - 'omnimessageId' => 'setOmnimessageId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'messages' => 'getMessages', - 'to' => 'getTo', - 'omnimessageId' => 'getOmnimessageId' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('messages', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('omnimessageId', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['messages'] === null) { - $invalidProperties[] = "'messages' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - if ($this->container['omnimessageId'] === null) { - $invalidProperties[] = "'omnimessageId' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets messages - * - * @return \Messente\Api\Model\MessageResult[] - */ - public function getMessages() - { - return $this->container['messages']; - } - - /** - * Sets messages - * - * @param \Messente\Api\Model\MessageResult[] $messages List of messages that compose the omnimessage - * - * @return self - */ - public function setMessages($messages) - { - if (is_null($messages)) { - throw new \InvalidArgumentException('non-nullable messages cannot be null'); - } - $this->container['messages'] = $messages; - - return $this; - } - - /** - * Gets to - * - * @return string - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param string $to Phone number in e.164 format - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets omnimessageId - * - * @return string - */ - public function getOmnimessageId() - { - return $this->container['omnimessageId']; - } - - /** - * Sets omnimessageId - * - * @param string $omnimessageId Unique identifier for the omnimessage - * - * @return self - */ - public function setOmnimessageId($omnimessageId) - { - if (is_null($omnimessageId)) { - throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); - } - $this->container['omnimessageId'] = $omnimessageId; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Omnimessage.php b/lib/Model/Omnimessage.php deleted file mode 100644 index 873874f..0000000 --- a/lib/Model/Omnimessage.php +++ /dev/null @@ -1,587 +0,0 @@ - - */ -class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Omnimessage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'to' => 'string', - 'messages' => '\Messente\Api\Model\OmnimessageMessagesInner[]', - 'dlrUrl' => 'string', - 'textStore' => '\Messente\Api\Model\TextStore', - 'timeToSend' => '\DateTime', - 'priority' => '\Messente\Api\Model\Priority' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'to' => null, - 'messages' => null, - 'dlrUrl' => 'url', - 'textStore' => null, - 'timeToSend' => 'date-time', - 'priority' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'to' => false, - 'messages' => false, - 'dlrUrl' => false, - 'textStore' => false, - 'timeToSend' => false, - 'priority' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'to' => 'to', - 'messages' => 'messages', - 'dlrUrl' => 'dlr_url', - 'textStore' => 'text_store', - 'timeToSend' => 'time_to_send', - 'priority' => 'priority' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'to' => 'setTo', - 'messages' => 'setMessages', - 'dlrUrl' => 'setDlrUrl', - 'textStore' => 'setTextStore', - 'timeToSend' => 'setTimeToSend', - 'priority' => 'setPriority' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'to' => 'getTo', - 'messages' => 'getMessages', - 'dlrUrl' => 'getDlrUrl', - 'textStore' => 'getTextStore', - 'timeToSend' => 'getTimeToSend', - 'priority' => 'getPriority' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('messages', $data ?? [], null); - $this->setIfExists('dlrUrl', $data ?? [], null); - $this->setIfExists('textStore', $data ?? [], null); - $this->setIfExists('timeToSend', $data ?? [], null); - $this->setIfExists('priority', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - if ($this->container['messages'] === null) { - $invalidProperties[] = "'messages' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets to - * - * @return string - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param string $to Phone number in e.164 format - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets messages - * - * @return \Messente\Api\Model\OmnimessageMessagesInner[] - */ - public function getMessages() - { - return $this->container['messages']; - } - - /** - * Sets messages - * - * @param \Messente\Api\Model\OmnimessageMessagesInner[] $messages An array of messages - * - * @return self - */ - public function setMessages($messages) - { - if (is_null($messages)) { - throw new \InvalidArgumentException('non-nullable messages cannot be null'); - } - $this->container['messages'] = $messages; - - return $this; - } - - /** - * Gets dlrUrl - * - * @return string|null - */ - public function getDlrUrl() - { - return $this->container['dlrUrl']; - } - - /** - * Sets dlrUrl - * - * @param string|null $dlrUrl URL where the delivery report will be sent - * - * @return self - */ - public function setDlrUrl($dlrUrl) - { - if (is_null($dlrUrl)) { - throw new \InvalidArgumentException('non-nullable dlrUrl cannot be null'); - } - $this->container['dlrUrl'] = $dlrUrl; - - return $this; - } - - /** - * Gets textStore - * - * @return \Messente\Api\Model\TextStore|null - */ - public function getTextStore() - { - return $this->container['textStore']; - } - - /** - * Sets textStore - * - * @param \Messente\Api\Model\TextStore|null $textStore textStore - * - * @return self - */ - public function setTextStore($textStore) - { - if (is_null($textStore)) { - throw new \InvalidArgumentException('non-nullable textStore cannot be null'); - } - $this->container['textStore'] = $textStore; - - return $this; - } - - /** - * Gets timeToSend - * - * @return \DateTime|null - */ - public function getTimeToSend() - { - return $this->container['timeToSend']; - } - - /** - * Sets timeToSend - * - * @param \DateTime|null $timeToSend Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) - * - * @return self - */ - public function setTimeToSend($timeToSend) - { - if (is_null($timeToSend)) { - throw new \InvalidArgumentException('non-nullable timeToSend cannot be null'); - } - $this->container['timeToSend'] = $timeToSend; - - return $this; - } - - /** - * Gets priority - * - * @return \Messente\Api\Model\Priority|null - */ - public function getPriority() - { - return $this->container['priority']; - } - - /** - * Sets priority - * - * @param \Messente\Api\Model\Priority|null $priority priority - * - * @return self - */ - public function setPriority($priority) - { - if (is_null($priority)) { - throw new \InvalidArgumentException('non-nullable priority cannot be null'); - } - $this->container['priority'] = $priority; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/OmnimessageMessagesInner.php b/lib/Model/OmnimessageMessagesInner.php deleted file mode 100644 index efdac3d..0000000 --- a/lib/Model/OmnimessageMessagesInner.php +++ /dev/null @@ -1,889 +0,0 @@ - - */ -class OmnimessageMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Omnimessage_messages_inner'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'sender' => 'string', - 'validity' => 'int', - 'ttl' => 'int', - 'text' => 'string', - 'imageUrl' => 'string', - 'buttonUrl' => 'string', - 'buttonText' => 'string', - 'channel' => 'string', - 'autoconvert' => 'string', - 'udh' => 'string', - 'template' => '\Messente\Api\Model\WhatsAppTemplate', - 'documentUrl' => 'string', - 'audioUrl' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'sender' => null, - 'validity' => null, - 'ttl' => null, - 'text' => null, - 'imageUrl' => null, - 'buttonUrl' => null, - 'buttonText' => null, - 'channel' => null, - 'autoconvert' => null, - 'udh' => null, - 'template' => null, - 'documentUrl' => null, - 'audioUrl' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'text' => false, - 'imageUrl' => false, - 'buttonUrl' => false, - 'buttonText' => false, - 'channel' => false, - 'autoconvert' => false, - 'udh' => false, - 'template' => false, - 'documentUrl' => false, - 'audioUrl' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sender' => 'sender', - 'validity' => 'validity', - 'ttl' => 'ttl', - 'text' => 'text', - 'imageUrl' => 'image_url', - 'buttonUrl' => 'button_url', - 'buttonText' => 'button_text', - 'channel' => 'channel', - 'autoconvert' => 'autoconvert', - 'udh' => 'udh', - 'template' => 'template', - 'documentUrl' => 'document_url', - 'audioUrl' => 'audio_url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'ttl' => 'setTtl', - 'text' => 'setText', - 'imageUrl' => 'setImageUrl', - 'buttonUrl' => 'setButtonUrl', - 'buttonText' => 'setButtonText', - 'channel' => 'setChannel', - 'autoconvert' => 'setAutoconvert', - 'udh' => 'setUdh', - 'template' => 'setTemplate', - 'documentUrl' => 'setDocumentUrl', - 'audioUrl' => 'setAudioUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'ttl' => 'getTtl', - 'text' => 'getText', - 'imageUrl' => 'getImageUrl', - 'buttonUrl' => 'getButtonUrl', - 'buttonText' => 'getButtonText', - 'channel' => 'getChannel', - 'autoconvert' => 'getAutoconvert', - 'udh' => 'getUdh', - 'template' => 'getTemplate', - 'documentUrl' => 'getDocumentUrl', - 'audioUrl' => 'getAudioUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const CHANNEL_TELEGRAM = 'telegram'; - public const AUTOCONVERT_FULL = 'full'; - public const AUTOCONVERT_ON = 'on'; - public const AUTOCONVERT_OFF = 'off'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_TELEGRAM, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getAutoconvertAllowableValues() - { - return [ - self::AUTOCONVERT_FULL, - self::AUTOCONVERT_ON, - self::AUTOCONVERT_OFF, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('buttonUrl', $data ?? [], null); - $this->setIfExists('buttonText', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'telegram'); - $this->setIfExists('autoconvert', $data ?? [], null); - $this->setIfExists('udh', $data ?? [], null); - $this->setIfExists('template', $data ?? [], null); - $this->setIfExists('documentUrl', $data ?? [], null); - $this->setIfExists('audioUrl', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'autoconvert', must be one of '%s'", - $this->container['autoconvert'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets ttl - * - * @return int|null - */ - public function getTtl() - { - return $this->container['ttl']; - } - - /** - * Sets ttl - * - * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setTtl($ttl) - { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } - $this->container['ttl'] = $ttl; - - return $this; - } - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text Plaintext content for Telegram - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets imageUrl - * - * @return string|null - */ - public function getImageUrl() - { - return $this->container['imageUrl']; - } - - /** - * Sets imageUrl - * - * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" - * - * @return self - */ - public function setImageUrl($imageUrl) - { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } - $this->container['imageUrl'] = $imageUrl; - - return $this; - } - - /** - * Gets buttonUrl - * - * @return string|null - */ - public function getButtonUrl() - { - return $this->container['buttonUrl']; - } - - /** - * Sets buttonUrl - * - * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) - * - * @return self - */ - public function setButtonUrl($buttonUrl) - { - if (is_null($buttonUrl)) { - throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); - } - $this->container['buttonUrl'] = $buttonUrl; - - return $this; - } - - /** - * Gets buttonText - * - * @return string|null - */ - public function getButtonText() - { - return $this->container['buttonText']; - } - - /** - * Sets buttonText - * - * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) - * - * @return self - */ - public function setButtonText($buttonText) - { - if (is_null($buttonText)) { - throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); - } - $this->container['buttonText'] = $buttonText; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - - /** - * Gets autoconvert - * - * @return string|null - */ - public function getAutoconvert() - { - return $this->container['autoconvert']; - } - - /** - * Sets autoconvert - * - * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way - * - * @return self - */ - public function setAutoconvert($autoconvert) - { - if (is_null($autoconvert)) { - throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); - } - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!in_array($autoconvert, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'autoconvert', must be one of '%s'", - $autoconvert, - implode("', '", $allowedValues) - ) - ); - } - $this->container['autoconvert'] = $autoconvert; - - return $this; - } - - /** - * Gets udh - * - * @return string|null - */ - public function getUdh() - { - return $this->container['udh']; - } - - /** - * Sets udh - * - * @param string|null $udh hex-encoded string containing SMS UDH - * - * @return self - */ - public function setUdh($udh) - { - if (is_null($udh)) { - throw new \InvalidArgumentException('non-nullable udh cannot be null'); - } - $this->container['udh'] = $udh; - - return $this; - } - - /** - * Gets template - * - * @return \Messente\Api\Model\WhatsAppTemplate|null - */ - public function getTemplate() - { - return $this->container['template']; - } - - /** - * Sets template - * - * @param \Messente\Api\Model\WhatsAppTemplate|null $template template - * - * @return self - */ - public function setTemplate($template) - { - if (is_null($template)) { - throw new \InvalidArgumentException('non-nullable template cannot be null'); - } - $this->container['template'] = $template; - - return $this; - } - - /** - * Gets documentUrl - * - * @return string|null - */ - public function getDocumentUrl() - { - return $this->container['documentUrl']; - } - - /** - * Sets documentUrl - * - * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" - * - * @return self - */ - public function setDocumentUrl($documentUrl) - { - if (is_null($documentUrl)) { - throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); - } - $this->container['documentUrl'] = $documentUrl; - - return $this; - } - - /** - * Gets audioUrl - * - * @return string|null - */ - public function getAudioUrl() - { - return $this->container['audioUrl']; - } - - /** - * Sets audioUrl - * - * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" - * - * @return self - */ - public function setAudioUrl($audioUrl) - { - if (is_null($audioUrl)) { - throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); - } - $this->container['audioUrl'] = $audioUrl; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Priority.php b/lib/Model/Priority.php deleted file mode 100644 index 716c782..0000000 --- a/lib/Model/Priority.php +++ /dev/null @@ -1,67 +0,0 @@ - - */ -class SMS implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SMS'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'text' => 'string', - 'sender' => 'string', - 'validity' => 'int', - 'ttl' => 'int', - 'autoconvert' => 'string', - 'udh' => 'string', - 'channel' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'text' => null, - 'sender' => null, - 'validity' => null, - 'ttl' => null, - 'autoconvert' => null, - 'udh' => null, - 'channel' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'text' => false, - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'autoconvert' => false, - 'udh' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'text' => 'text', - 'sender' => 'sender', - 'validity' => 'validity', - 'ttl' => 'ttl', - 'autoconvert' => 'autoconvert', - 'udh' => 'udh', - 'channel' => 'channel' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'text' => 'setText', - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'ttl' => 'setTtl', - 'autoconvert' => 'setAutoconvert', - 'udh' => 'setUdh', - 'channel' => 'setChannel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'text' => 'getText', - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'ttl' => 'getTtl', - 'autoconvert' => 'getAutoconvert', - 'udh' => 'getUdh', - 'channel' => 'getChannel' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const AUTOCONVERT_FULL = 'full'; - public const AUTOCONVERT_ON = 'on'; - public const AUTOCONVERT_OFF = 'off'; - public const CHANNEL_SMS = 'sms'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getAutoconvertAllowableValues() - { - return [ - self::AUTOCONVERT_FULL, - self::AUTOCONVERT_ON, - self::AUTOCONVERT_OFF, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_SMS, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('autoconvert', $data ?? [], null); - $this->setIfExists('udh', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'sms'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'autoconvert', must be one of '%s'", - $this->container['autoconvert'], - implode("', '", $allowedValues) - ); - } - - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text Text content of the SMS - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets ttl - * - * @return int|null - */ - public function getTtl() - { - return $this->container['ttl']; - } - - /** - * Sets ttl - * - * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setTtl($ttl) - { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } - $this->container['ttl'] = $ttl; - - return $this; - } - - /** - * Gets autoconvert - * - * @return string|null - */ - public function getAutoconvert() - { - return $this->container['autoconvert']; - } - - /** - * Sets autoconvert - * - * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way - * - * @return self - */ - public function setAutoconvert($autoconvert) - { - if (is_null($autoconvert)) { - throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); - } - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!in_array($autoconvert, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'autoconvert', must be one of '%s'", - $autoconvert, - implode("', '", $allowedValues) - ) - ); - } - $this->container['autoconvert'] = $autoconvert; - - return $this; - } - - /** - * Gets udh - * - * @return string|null - */ - public function getUdh() - { - return $this->container['udh']; - } - - /** - * Sets udh - * - * @param string|null $udh hex-encoded string containing SMS UDH - * - * @return self - */ - public function setUdh($udh) - { - if (is_null($udh)) { - throw new \InvalidArgumentException('non-nullable udh cannot be null'); - } - $this->container['udh'] = $udh; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/StatisticsReport.php b/lib/Model/StatisticsReport.php deleted file mode 100644 index 92e1647..0000000 --- a/lib/Model/StatisticsReport.php +++ /dev/null @@ -1,488 +0,0 @@ - - */ -class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'StatisticsReport'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'totalMessages' => 'int', - 'totalPrice' => 'string', - 'country' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'totalMessages' => null, - 'totalPrice' => null, - 'country' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'totalMessages' => false, - 'totalPrice' => false, - 'country' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'totalMessages' => 'total_messages', - 'totalPrice' => 'total_price', - 'country' => 'country' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'totalMessages' => 'setTotalMessages', - 'totalPrice' => 'setTotalPrice', - 'country' => 'setCountry' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'totalMessages' => 'getTotalMessages', - 'totalPrice' => 'getTotalPrice', - 'country' => 'getCountry' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('totalMessages', $data ?? [], null); - $this->setIfExists('totalPrice', $data ?? [], null); - $this->setIfExists('country', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['totalMessages'] === null) { - $invalidProperties[] = "'totalMessages' can't be null"; - } - if ($this->container['totalPrice'] === null) { - $invalidProperties[] = "'totalPrice' can't be null"; - } - if ($this->container['country'] === null) { - $invalidProperties[] = "'country' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets totalMessages - * - * @return int - */ - public function getTotalMessages() - { - return $this->container['totalMessages']; - } - - /** - * Sets totalMessages - * - * @param int $totalMessages Sum of all messages - * - * @return self - */ - public function setTotalMessages($totalMessages) - { - if (is_null($totalMessages)) { - throw new \InvalidArgumentException('non-nullable totalMessages cannot be null'); - } - $this->container['totalMessages'] = $totalMessages; - - return $this; - } - - /** - * Gets totalPrice - * - * @return string - */ - public function getTotalPrice() - { - return $this->container['totalPrice']; - } - - /** - * Sets totalPrice - * - * @param string $totalPrice Price for all messages - * - * @return self - */ - public function setTotalPrice($totalPrice) - { - if (is_null($totalPrice)) { - throw new \InvalidArgumentException('non-nullable totalPrice cannot be null'); - } - $this->container['totalPrice'] = $totalPrice; - - return $this; - } - - /** - * Gets country - * - * @return string - */ - public function getCountry() - { - return $this->container['country']; - } - - /** - * Sets country - * - * @param string $country Target country of all messages - * - * @return self - */ - public function setCountry($country) - { - if (is_null($country)) { - throw new \InvalidArgumentException('non-nullable country cannot be null'); - } - $this->container['country'] = $country; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/StatisticsReportSettings.php b/lib/Model/StatisticsReportSettings.php deleted file mode 100644 index 3d6ab50..0000000 --- a/lib/Model/StatisticsReportSettings.php +++ /dev/null @@ -1,485 +0,0 @@ - - */ -class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'StatisticsReportSettings'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'startDate' => '\DateTime', - 'endDate' => '\DateTime', - 'messageTypes' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'startDate' => 'date', - 'endDate' => 'date', - 'messageTypes' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'startDate' => false, - 'endDate' => false, - 'messageTypes' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'startDate' => 'start_date', - 'endDate' => 'end_date', - 'messageTypes' => 'message_types' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'startDate' => 'setStartDate', - 'endDate' => 'setEndDate', - 'messageTypes' => 'setMessageTypes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'startDate' => 'getStartDate', - 'endDate' => 'getEndDate', - 'messageTypes' => 'getMessageTypes' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('startDate', $data ?? [], null); - $this->setIfExists('endDate', $data ?? [], null); - $this->setIfExists('messageTypes', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['startDate'] === null) { - $invalidProperties[] = "'startDate' can't be null"; - } - if ($this->container['endDate'] === null) { - $invalidProperties[] = "'endDate' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets startDate - * - * @return \DateTime - */ - public function getStartDate() - { - return $this->container['startDate']; - } - - /** - * Sets startDate - * - * @param \DateTime $startDate Start date for the report - * - * @return self - */ - public function setStartDate($startDate) - { - if (is_null($startDate)) { - throw new \InvalidArgumentException('non-nullable startDate cannot be null'); - } - $this->container['startDate'] = $startDate; - - return $this; - } - - /** - * Gets endDate - * - * @return \DateTime - */ - public function getEndDate() - { - return $this->container['endDate']; - } - - /** - * Sets endDate - * - * @param \DateTime $endDate End date for the report - * - * @return self - */ - public function setEndDate($endDate) - { - if (is_null($endDate)) { - throw new \InvalidArgumentException('non-nullable endDate cannot be null'); - } - $this->container['endDate'] = $endDate; - - return $this; - } - - /** - * Gets messageTypes - * - * @return string[]|null - */ - public function getMessageTypes() - { - return $this->container['messageTypes']; - } - - /** - * Sets messageTypes - * - * @param string[]|null $messageTypes Optional list of message types (sms, viber, whatsapp, hlr, telegram) - * - * @return self - */ - public function setMessageTypes($messageTypes) - { - if (is_null($messageTypes)) { - throw new \InvalidArgumentException('non-nullable messageTypes cannot be null'); - } - $this->container['messageTypes'] = $messageTypes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/StatisticsReportSuccess.php b/lib/Model/StatisticsReportSuccess.php deleted file mode 100644 index 9fd94d0..0000000 --- a/lib/Model/StatisticsReportSuccess.php +++ /dev/null @@ -1,414 +0,0 @@ - - */ -class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'StatisticsReportSuccess'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'reports' => '\Messente\Api\Model\StatisticsReport[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'reports' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'reports' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'reports' => 'reports' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'reports' => 'setReports' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'reports' => 'getReports' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('reports', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['reports'] === null) { - $invalidProperties[] = "'reports' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets reports - * - * @return \Messente\Api\Model\StatisticsReport[] - */ - public function getReports() - { - return $this->container['reports']; - } - - /** - * Sets reports - * - * @param \Messente\Api\Model\StatisticsReport[] $reports Array of report objects - * - * @return self - */ - public function setReports($reports) - { - if (is_null($reports)) { - throw new \InvalidArgumentException('non-nullable reports cannot be null'); - } - $this->container['reports'] = $reports; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Status.php b/lib/Model/Status.php deleted file mode 100644 index 1fd018f..0000000 --- a/lib/Model/Status.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ -class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SyncNumberLookupResult'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'number' => 'string', - 'roaming' => 'bool', - 'ported' => 'bool', - 'roamingNetwork' => '\Messente\Api\Model\MobileNetwork', - 'currentNetwork' => '\Messente\Api\Model\MobileNetwork', - 'originalNetwork' => '\Messente\Api\Model\MobileNetwork', - 'portedNetwork' => '\Messente\Api\Model\MobileNetwork', - 'status' => 'string', - 'error' => 'mixed' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'number' => null, - 'roaming' => null, - 'ported' => null, - 'roamingNetwork' => null, - 'currentNetwork' => null, - 'originalNetwork' => null, - 'portedNetwork' => null, - 'status' => null, - 'error' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'number' => false, - 'roaming' => true, - 'ported' => true, - 'roamingNetwork' => true, - 'currentNetwork' => true, - 'originalNetwork' => true, - 'portedNetwork' => true, - 'status' => false, - 'error' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'number' => 'number', - 'roaming' => 'roaming', - 'ported' => 'ported', - 'roamingNetwork' => 'roamingNetwork', - 'currentNetwork' => 'currentNetwork', - 'originalNetwork' => 'originalNetwork', - 'portedNetwork' => 'portedNetwork', - 'status' => 'status', - 'error' => 'error' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'number' => 'setNumber', - 'roaming' => 'setRoaming', - 'ported' => 'setPorted', - 'roamingNetwork' => 'setRoamingNetwork', - 'currentNetwork' => 'setCurrentNetwork', - 'originalNetwork' => 'setOriginalNetwork', - 'portedNetwork' => 'setPortedNetwork', - 'status' => 'setStatus', - 'error' => 'setError' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'number' => 'getNumber', - 'roaming' => 'getRoaming', - 'ported' => 'getPorted', - 'roamingNetwork' => 'getRoamingNetwork', - 'currentNetwork' => 'getCurrentNetwork', - 'originalNetwork' => 'getOriginalNetwork', - 'portedNetwork' => 'getPortedNetwork', - 'status' => 'getStatus', - 'error' => 'getError' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const STATUS_ON = 'ON'; - public const STATUS_OFF = 'OFF'; - public const STATUS_INVALID = 'INVALID'; - public const STATUS_UNKNOWN = 'UNKNOWN'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_ON, - self::STATUS_OFF, - self::STATUS_INVALID, - self::STATUS_UNKNOWN, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('number', $data ?? [], null); - $this->setIfExists('roaming', $data ?? [], null); - $this->setIfExists('ported', $data ?? [], null); - $this->setIfExists('roamingNetwork', $data ?? [], null); - $this->setIfExists('currentNetwork', $data ?? [], null); - $this->setIfExists('originalNetwork', $data ?? [], null); - $this->setIfExists('portedNetwork', $data ?? [], null); - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('error', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['number'] === null) { - $invalidProperties[] = "'number' can't be null"; - } - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets number - * - * @return string - */ - public function getNumber() - { - return $this->container['number']; - } - - /** - * Sets number - * - * @param string $number Phone number in e.164 format - * - * @return self - */ - public function setNumber($number) - { - if (is_null($number)) { - throw new \InvalidArgumentException('non-nullable number cannot be null'); - } - $this->container['number'] = $number; - - return $this; - } - - /** - * Gets roaming - * - * @return bool|null - */ - public function getRoaming() - { - return $this->container['roaming']; - } - - /** - * Sets roaming - * - * @param bool|null $roaming Indicates if a number is roaming - * - * @return self - */ - public function setRoaming($roaming) - { - if (is_null($roaming)) { - array_push($this->openAPINullablesSetToNull, 'roaming'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('roaming', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['roaming'] = $roaming; - - return $this; - } - - /** - * Gets ported - * - * @return bool|null - */ - public function getPorted() - { - return $this->container['ported']; - } - - /** - * Sets ported - * - * @param bool|null $ported Indicates if a number is ported - * - * @return self - */ - public function setPorted($ported) - { - if (is_null($ported)) { - array_push($this->openAPINullablesSetToNull, 'ported'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('ported', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['ported'] = $ported; - - return $this; - } - - /** - * Gets roamingNetwork - * - * @return \Messente\Api\Model\MobileNetwork|null - */ - public function getRoamingNetwork() - { - return $this->container['roamingNetwork']; - } - - /** - * Sets roamingNetwork - * - * @param \Messente\Api\Model\MobileNetwork|null $roamingNetwork roamingNetwork - * - * @return self - */ - public function setRoamingNetwork($roamingNetwork) - { - if (is_null($roamingNetwork)) { - array_push($this->openAPINullablesSetToNull, 'roamingNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('roamingNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['roamingNetwork'] = $roamingNetwork; - - return $this; - } - - /** - * Gets currentNetwork - * - * @return \Messente\Api\Model\MobileNetwork|null - */ - public function getCurrentNetwork() - { - return $this->container['currentNetwork']; - } - - /** - * Sets currentNetwork - * - * @param \Messente\Api\Model\MobileNetwork|null $currentNetwork currentNetwork - * - * @return self - */ - public function setCurrentNetwork($currentNetwork) - { - if (is_null($currentNetwork)) { - array_push($this->openAPINullablesSetToNull, 'currentNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('currentNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['currentNetwork'] = $currentNetwork; - - return $this; - } - - /** - * Gets originalNetwork - * - * @return \Messente\Api\Model\MobileNetwork|null - */ - public function getOriginalNetwork() - { - return $this->container['originalNetwork']; - } - - /** - * Sets originalNetwork - * - * @param \Messente\Api\Model\MobileNetwork|null $originalNetwork originalNetwork - * - * @return self - */ - public function setOriginalNetwork($originalNetwork) - { - if (is_null($originalNetwork)) { - array_push($this->openAPINullablesSetToNull, 'originalNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('originalNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['originalNetwork'] = $originalNetwork; - - return $this; - } - - /** - * Gets portedNetwork - * - * @return \Messente\Api\Model\MobileNetwork|null - */ - public function getPortedNetwork() - { - return $this->container['portedNetwork']; - } - - /** - * Sets portedNetwork - * - * @param \Messente\Api\Model\MobileNetwork|null $portedNetwork portedNetwork - * - * @return self - */ - public function setPortedNetwork($portedNetwork) - { - if (is_null($portedNetwork)) { - array_push($this->openAPINullablesSetToNull, 'portedNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('portedNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['portedNetwork'] = $portedNetwork; - - return $this; - } - - /** - * Gets status - * - * @return string|null - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string|null $status Status of the phone number - * - * @return self - */ - public function setStatus($status) - { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } - $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets error - * - * @return mixed|null - */ - public function getError() - { - return $this->container['error']; - } - - /** - * Sets error - * - * @param mixed|null $error Indicates if any error occurred while handling the request - * - * @return self - */ - public function setError($error) - { - if (is_null($error)) { - array_push($this->openAPINullablesSetToNull, 'error'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('error', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['error'] = $error; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/SyncNumberLookupSuccess.php b/lib/Model/SyncNumberLookupSuccess.php deleted file mode 100644 index 95b8e82..0000000 --- a/lib/Model/SyncNumberLookupSuccess.php +++ /dev/null @@ -1,451 +0,0 @@ - - */ -class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SyncNumberLookupSuccess'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'requestId' => 'string', - 'result' => '\Messente\Api\Model\SyncNumberLookupResult[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'requestId' => null, - 'result' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'requestId' => false, - 'result' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'requestId' => 'request_id', - 'result' => 'result' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'requestId' => 'setRequestId', - 'result' => 'setResult' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'requestId' => 'getRequestId', - 'result' => 'getResult' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('requestId', $data ?? [], null); - $this->setIfExists('result', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['requestId'] === null) { - $invalidProperties[] = "'requestId' can't be null"; - } - if ($this->container['result'] === null) { - $invalidProperties[] = "'result' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets requestId - * - * @return string - */ - public function getRequestId() - { - return $this->container['requestId']; - } - - /** - * Sets requestId - * - * @param string $requestId ID of the request - * - * @return self - */ - public function setRequestId($requestId) - { - if (is_null($requestId)) { - throw new \InvalidArgumentException('non-nullable requestId cannot be null'); - } - $this->container['requestId'] = $requestId; - - return $this; - } - - /** - * Gets result - * - * @return \Messente\Api\Model\SyncNumberLookupResult[] - */ - public function getResult() - { - return $this->container['result']; - } - - /** - * Sets result - * - * @param \Messente\Api\Model\SyncNumberLookupResult[] $result A container for phone number info objects - * - * @return self - */ - public function setResult($result) - { - if (is_null($result)) { - throw new \InvalidArgumentException('non-nullable result cannot be null'); - } - $this->container['result'] = $result; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Telegram.php b/lib/Model/Telegram.php deleted file mode 100644 index 438ca6f..0000000 --- a/lib/Model/Telegram.php +++ /dev/null @@ -1,647 +0,0 @@ - - */ -class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Telegram'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'sender' => 'string', - 'validity' => 'int', - 'text' => 'string', - 'imageUrl' => 'string', - 'documentUrl' => 'string', - 'audioUrl' => 'string', - 'channel' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'sender' => null, - 'validity' => null, - 'text' => null, - 'imageUrl' => null, - 'documentUrl' => null, - 'audioUrl' => null, - 'channel' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'text' => false, - 'imageUrl' => false, - 'documentUrl' => false, - 'audioUrl' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sender' => 'sender', - 'validity' => 'validity', - 'text' => 'text', - 'imageUrl' => 'image_url', - 'documentUrl' => 'document_url', - 'audioUrl' => 'audio_url', - 'channel' => 'channel' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'text' => 'setText', - 'imageUrl' => 'setImageUrl', - 'documentUrl' => 'setDocumentUrl', - 'audioUrl' => 'setAudioUrl', - 'channel' => 'setChannel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'text' => 'getText', - 'imageUrl' => 'getImageUrl', - 'documentUrl' => 'getDocumentUrl', - 'audioUrl' => 'getAudioUrl', - 'channel' => 'getChannel' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const CHANNEL_TELEGRAM = 'telegram'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_TELEGRAM, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('documentUrl', $data ?? [], null); - $this->setIfExists('audioUrl', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'telegram'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets text - * - * @return string|null - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string|null $text Plaintext content for Telegram - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets imageUrl - * - * @return string|null - */ - public function getImageUrl() - { - return $this->container['imageUrl']; - } - - /** - * Sets imageUrl - * - * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" - * - * @return self - */ - public function setImageUrl($imageUrl) - { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } - $this->container['imageUrl'] = $imageUrl; - - return $this; - } - - /** - * Gets documentUrl - * - * @return string|null - */ - public function getDocumentUrl() - { - return $this->container['documentUrl']; - } - - /** - * Sets documentUrl - * - * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" - * - * @return self - */ - public function setDocumentUrl($documentUrl) - { - if (is_null($documentUrl)) { - throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); - } - $this->container['documentUrl'] = $documentUrl; - - return $this; - } - - /** - * Gets audioUrl - * - * @return string|null - */ - public function getAudioUrl() - { - return $this->container['audioUrl']; - } - - /** - * Sets audioUrl - * - * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" - * - * @return self - */ - public function setAudioUrl($audioUrl) - { - if (is_null($audioUrl)) { - throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); - } - $this->container['audioUrl'] = $audioUrl; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/TextStore.php b/lib/Model/TextStore.php deleted file mode 100644 index ad7e107..0000000 --- a/lib/Model/TextStore.php +++ /dev/null @@ -1,67 +0,0 @@ - - */ -class Viber implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Viber'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'sender' => 'string', - 'validity' => 'int', - 'ttl' => 'int', - 'text' => 'string', - 'imageUrl' => 'string', - 'buttonUrl' => 'string', - 'buttonText' => 'string', - 'channel' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'sender' => null, - 'validity' => null, - 'ttl' => null, - 'text' => null, - 'imageUrl' => null, - 'buttonUrl' => null, - 'buttonText' => null, - 'channel' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'text' => false, - 'imageUrl' => false, - 'buttonUrl' => false, - 'buttonText' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sender' => 'sender', - 'validity' => 'validity', - 'ttl' => 'ttl', - 'text' => 'text', - 'imageUrl' => 'image_url', - 'buttonUrl' => 'button_url', - 'buttonText' => 'button_text', - 'channel' => 'channel' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'ttl' => 'setTtl', - 'text' => 'setText', - 'imageUrl' => 'setImageUrl', - 'buttonUrl' => 'setButtonUrl', - 'buttonText' => 'setButtonText', - 'channel' => 'setChannel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'ttl' => 'getTtl', - 'text' => 'getText', - 'imageUrl' => 'getImageUrl', - 'buttonUrl' => 'getButtonUrl', - 'buttonText' => 'getButtonText', - 'channel' => 'getChannel' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const CHANNEL_VIBER = 'viber'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_VIBER, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('buttonUrl', $data ?? [], null); - $this->setIfExists('buttonText', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'viber'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets ttl - * - * @return int|null - */ - public function getTtl() - { - return $this->container['ttl']; - } - - /** - * Sets ttl - * - * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setTtl($ttl) - { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } - $this->container['ttl'] = $ttl; - - return $this; - } - - /** - * Gets text - * - * @return string|null - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string|null $text Plaintext content for Viber - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets imageUrl - * - * @return string|null - */ - public function getImageUrl() - { - return $this->container['imageUrl']; - } - - /** - * Sets imageUrl - * - * @param string|null $imageUrl URL for the embedded image Valid combinations: 1) image_url, 2) text, image_url, button_url, button_text - * - * @return self - */ - public function setImageUrl($imageUrl) - { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } - $this->container['imageUrl'] = $imageUrl; - - return $this; - } - - /** - * Gets buttonUrl - * - * @return string|null - */ - public function getButtonUrl() - { - return $this->container['buttonUrl']; - } - - /** - * Sets buttonUrl - * - * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) - * - * @return self - */ - public function setButtonUrl($buttonUrl) - { - if (is_null($buttonUrl)) { - throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); - } - $this->container['buttonUrl'] = $buttonUrl; - - return $this; - } - - /** - * Gets buttonText - * - * @return string|null - */ - public function getButtonText() - { - return $this->container['buttonText']; - } - - /** - * Sets buttonText - * - * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) - * - * @return self - */ - public function setButtonText($buttonText) - { - if (is_null($buttonText)) { - throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); - } - $this->container['buttonText'] = $buttonText; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php deleted file mode 100644 index ae2ef73..0000000 --- a/lib/Model/WhatsApp.php +++ /dev/null @@ -1,579 +0,0 @@ - - */ -class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsApp'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'sender' => 'string', - 'validity' => 'int', - 'ttl' => 'int', - 'template' => '\Messente\Api\Model\WhatsAppTemplate', - 'channel' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'sender' => null, - 'validity' => null, - 'ttl' => null, - 'template' => null, - 'channel' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'template' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sender' => 'sender', - 'validity' => 'validity', - 'ttl' => 'ttl', - 'template' => 'template', - 'channel' => 'channel' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'ttl' => 'setTtl', - 'template' => 'setTemplate', - 'channel' => 'setChannel' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'ttl' => 'getTtl', - 'template' => 'getTemplate', - 'channel' => 'getChannel' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const CHANNEL_WHATSAPP = 'whatsapp'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_WHATSAPP, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('template', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'whatsapp'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets ttl - * - * @return int|null - */ - public function getTtl() - { - return $this->container['ttl']; - } - - /** - * Sets ttl - * - * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setTtl($ttl) - { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } - $this->container['ttl'] = $ttl; - - return $this; - } - - /** - * Gets template - * - * @return \Messente\Api\Model\WhatsAppTemplate|null - */ - public function getTemplate() - { - return $this->container['template']; - } - - /** - * Sets template - * - * @param \Messente\Api\Model\WhatsAppTemplate|null $template template - * - * @return self - */ - public function setTemplate($template) - { - if (is_null($template)) { - throw new \InvalidArgumentException('non-nullable template cannot be null'); - } - $this->container['template'] = $template; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppComponent.php b/lib/Model/WhatsAppComponent.php deleted file mode 100644 index 630b72b..0000000 --- a/lib/Model/WhatsAppComponent.php +++ /dev/null @@ -1,516 +0,0 @@ - - */ -class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppComponent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'subType' => 'string', - 'index' => 'int', - 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'subType' => null, - 'index' => null, - 'parameters' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'subType' => false, - 'index' => false, - 'parameters' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'subType' => 'sub_type', - 'index' => 'index', - 'parameters' => 'parameters' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'subType' => 'setSubType', - 'index' => 'setIndex', - 'parameters' => 'setParameters' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'subType' => 'getSubType', - 'index' => 'getIndex', - 'parameters' => 'getParameters' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('subType', $data ?? [], null); - $this->setIfExists('index', $data ?? [], null); - $this->setIfExists('parameters', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of the component - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets subType - * - * @return string|null - */ - public function getSubType() - { - return $this->container['subType']; - } - - /** - * Sets subType - * - * @param string|null $subType Sub-type of the component - * - * @return self - */ - public function setSubType($subType) - { - if (is_null($subType)) { - throw new \InvalidArgumentException('non-nullable subType cannot be null'); - } - $this->container['subType'] = $subType; - - return $this; - } - - /** - * Gets index - * - * @return int|null - */ - public function getIndex() - { - return $this->container['index']; - } - - /** - * Sets index - * - * @param int|null $index index used to position buttons - * - * @return self - */ - public function setIndex($index) - { - if (is_null($index)) { - throw new \InvalidArgumentException('non-nullable index cannot be null'); - } - $this->container['index'] = $index; - - return $this; - } - - /** - * Gets parameters - * - * @return \Messente\Api\Model\WhatsAppParameter[]|null - */ - public function getParameters() - { - return $this->container['parameters']; - } - - /** - * Sets parameters - * - * @param \Messente\Api\Model\WhatsAppParameter[]|null $parameters List of parameters for the component - * - * @return self - */ - public function setParameters($parameters) - { - if (is_null($parameters)) { - throw new \InvalidArgumentException('non-nullable parameters cannot be null'); - } - $this->container['parameters'] = $parameters; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppLanguage.php b/lib/Model/WhatsAppLanguage.php deleted file mode 100644 index 96e31e8..0000000 --- a/lib/Model/WhatsAppLanguage.php +++ /dev/null @@ -1,448 +0,0 @@ - - */ -class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppLanguage'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'code' => 'string', - 'policy' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'code' => null, - 'policy' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'code' => false, - 'policy' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'code' => 'code', - 'policy' => 'policy' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'code' => 'setCode', - 'policy' => 'setPolicy' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'code' => 'getCode', - 'policy' => 'getPolicy' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('policy', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets code - * - * @return string - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param string $code Language code - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets policy - * - * @return string|null - */ - public function getPolicy() - { - return $this->container['policy']; - } - - /** - * Sets policy - * - * @param string|null $policy Language policy - * - * @return self - */ - public function setPolicy($policy) - { - if (is_null($policy)) { - throw new \InvalidArgumentException('non-nullable policy cannot be null'); - } - $this->container['policy'] = $policy; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppParameter.php b/lib/Model/WhatsAppParameter.php deleted file mode 100644 index 68f7fe0..0000000 --- a/lib/Model/WhatsAppParameter.php +++ /dev/null @@ -1,618 +0,0 @@ - - */ -class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppParameter'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'text' => 'string', - 'currency' => 'object', - 'dateTime' => 'object', - 'image' => 'object', - 'document' => 'object', - 'video' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'text' => null, - 'currency' => null, - 'dateTime' => null, - 'image' => null, - 'document' => null, - 'video' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'text' => false, - 'currency' => false, - 'dateTime' => false, - 'image' => false, - 'document' => false, - 'video' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'text' => 'text', - 'currency' => 'currency', - 'dateTime' => 'date_time', - 'image' => 'image', - 'document' => 'document', - 'video' => 'video' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'text' => 'setText', - 'currency' => 'setCurrency', - 'dateTime' => 'setDateTime', - 'image' => 'setImage', - 'document' => 'setDocument', - 'video' => 'setVideo' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'text' => 'getText', - 'currency' => 'getCurrency', - 'dateTime' => 'getDateTime', - 'image' => 'getImage', - 'document' => 'getDocument', - 'video' => 'getVideo' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('dateTime', $data ?? [], null); - $this->setIfExists('image', $data ?? [], null); - $this->setIfExists('document', $data ?? [], null); - $this->setIfExists('video', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of the parameter - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets text - * - * @return string|null - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string|null $text A text - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets currency - * - * @return object|null - */ - public function getCurrency() - { - return $this->container['currency']; - } - - /** - * Sets currency - * - * @param object|null $currency A currency object - * - * @return self - */ - public function setCurrency($currency) - { - if (is_null($currency)) { - throw new \InvalidArgumentException('non-nullable currency cannot be null'); - } - $this->container['currency'] = $currency; - - return $this; - } - - /** - * Gets dateTime - * - * @return object|null - */ - public function getDateTime() - { - return $this->container['dateTime']; - } - - /** - * Sets dateTime - * - * @param object|null $dateTime A date_time object - * - * @return self - */ - public function setDateTime($dateTime) - { - if (is_null($dateTime)) { - throw new \InvalidArgumentException('non-nullable dateTime cannot be null'); - } - $this->container['dateTime'] = $dateTime; - - return $this; - } - - /** - * Gets image - * - * @return object|null - */ - public function getImage() - { - return $this->container['image']; - } - - /** - * Sets image - * - * @param object|null $image A media object of type image - * - * @return self - */ - public function setImage($image) - { - if (is_null($image)) { - throw new \InvalidArgumentException('non-nullable image cannot be null'); - } - $this->container['image'] = $image; - - return $this; - } - - /** - * Gets document - * - * @return object|null - */ - public function getDocument() - { - return $this->container['document']; - } - - /** - * Sets document - * - * @param object|null $document A media object of type document - * - * @return self - */ - public function setDocument($document) - { - if (is_null($document)) { - throw new \InvalidArgumentException('non-nullable document cannot be null'); - } - $this->container['document'] = $document; - - return $this; - } - - /** - * Gets video - * - * @return object|null - */ - public function getVideo() - { - return $this->container['video']; - } - - /** - * Sets video - * - * @param object|null $video A media object of type video - * - * @return self - */ - public function setVideo($video) - { - if (is_null($video)) { - throw new \InvalidArgumentException('non-nullable video cannot be null'); - } - $this->container['video'] = $video; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppTemplate.php b/lib/Model/WhatsAppTemplate.php deleted file mode 100644 index 06d3d7c..0000000 --- a/lib/Model/WhatsAppTemplate.php +++ /dev/null @@ -1,485 +0,0 @@ - - */ -class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppTemplate'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'name' => 'string', - 'language' => '\Messente\Api\Model\WhatsAppLanguage', - 'components' => '\Messente\Api\Model\WhatsAppComponent[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'name' => null, - 'language' => null, - 'components' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false, - 'language' => false, - 'components' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'name' => 'name', - 'language' => 'language', - 'components' => 'components' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'name' => 'setName', - 'language' => 'setLanguage', - 'components' => 'setComponents' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'name' => 'getName', - 'language' => 'getLanguage', - 'components' => 'getComponents' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('language', $data ?? [], null); - $this->setIfExists('components', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['language'] === null) { - $invalidProperties[] = "'language' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the template - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets language - * - * @return \Messente\Api\Model\WhatsAppLanguage - */ - public function getLanguage() - { - return $this->container['language']; - } - - /** - * Sets language - * - * @param \Messente\Api\Model\WhatsAppLanguage $language language - * - * @return self - */ - public function setLanguage($language) - { - if (is_null($language)) { - throw new \InvalidArgumentException('non-nullable language cannot be null'); - } - $this->container['language'] = $language; - - return $this; - } - - /** - * Gets components - * - * @return \Messente\Api\Model\WhatsAppComponent[]|null - */ - public function getComponents() - { - return $this->container['components']; - } - - /** - * Sets components - * - * @param \Messente\Api\Model\WhatsAppComponent[]|null $components List of template components - * - * @return self - */ - public function setComponents($components) - { - if (is_null($components)) { - throw new \InvalidArgumentException('non-nullable components cannot be null'); - } - $this->container['components'] = $components; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php deleted file mode 100644 index 6f7fd57..0000000 --- a/lib/ObjectSerializer.php +++ /dev/null @@ -1,609 +0,0 @@ -format('Y-m-d') : $data->format(self::$dateTimeFormat); - } - - if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - return $data; - } - - if (is_object($data)) { - $values = []; - if ($data instanceof ModelInterface) { - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - $callable = [$openAPIType, 'getAllowableEnumValues']; - if (is_callable($callable)) { - /** array $callable */ - $allowedEnumTypes = $callable(); - if (!in_array($value, $allowedEnumTypes, true)) { - $imploded = implode("', '", $allowedEnumTypes); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); - } - } - } - if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); - } - } - } else { - foreach($data as $property => $value) { - $values[$property] = self::sanitizeForSerialization($value); - } - } - return (object)$values; - } else { - return (string)$data; - } - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } else { - return $filename; - } - } - - /** - * Shorter timestamp microseconds to 6 digits length. - * - * @param string $timestamp Original timestamp - * - * @return string the shorten timestamp - */ - public static function sanitizeTimestamp($timestamp) - { - if (!is_string($timestamp)) return $timestamp; - - return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Checks if a value is empty, based on its OpenAPI type. - * - * @param mixed $value - * @param string $openApiType - * - * @return bool true if $value is empty - */ - private static function isEmptyValue($value, string $openApiType): bool - { - # If empty() returns false, it is not empty regardless of its type. - if (!empty($value)) { - return false; - } - - # Null is always empty, as we cannot send a real "null" value in a query parameter. - if ($value === null) { - return true; - } - - switch ($openApiType) { - # For numeric values, false and '' are considered empty. - # This comparison is safe for floating point values, since the previous call to empty() will - # filter out values that don't match 0. - case 'int': - case 'integer': - return $value !== 0; - - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; - - # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return !in_array($value, [false, 0], true); - - # For all the other types, any value at this point can be considered empty. - default: - return true; - } - } - - /** - * Take query parameter properties and turn it into an array suitable for - * native http_build_query or GuzzleHttp\Psr7\Query::build. - * - * @param mixed $value Parameter value - * @param string $paramName Parameter name - * @param string $openApiType OpenAPIType eg. array or object - * @param string $style Parameter serialization style - * @param bool $explode Parameter explode option - * @param bool $required Whether query param is required or not - * - * @return array - */ - public static function toQueryValue( - $value, - string $paramName, - string $openApiType = 'string', - string $style = 'form', - bool $explode = true, - bool $required = true - ): array { - - # Check if we should omit this parameter from the query. This should only happen when: - # - Parameter is NOT required; AND - # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For - # example, 0 as "int" or "boolean" is NOT an empty value. - if (self::isEmptyValue($value, $openApiType)) { - if ($required) { - return ["{$paramName}" => '']; - } else { - return []; - } - } - - # Handle DateTime objects in query - if($openApiType === "\\DateTime" && $value instanceof \DateTime) { - return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; - } - - $query = []; - $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; - - // since \GuzzleHttp\Psr7\Query::build fails with nested arrays - // need to flatten array first - $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { - if (!is_array($arr)) return $arr; - - foreach ($arr as $k => $v) { - $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; - - if (is_array($v)) { - $flattenArray($v, $prop, $result); - } else { - if ($style !== 'deepObject' && !$explode) { - // push key itself - $result[] = $prop; - } - $result[$prop] = $v; - } - } - return $result; - }; - - $value = $flattenArray($value, $paramName); - - if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { - return $value; - } - - if ('boolean' === $openApiType && is_bool($value)) { - $value = self::convertBoolToQueryStringFormat($value); - } - - // handle style in serializeCollection - $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); - - return $query; - } - - /** - * Convert boolean value to format for query string. - * - * @param bool $value Boolean value - * - * @return int|string Boolean value in format - */ - public static function convertBoolToQueryStringFormat(bool $value) - { - if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { - return $value ? 'true' : 'false'; - } - - return (int) $value; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - $callable = [$value, 'toHeaderValue']; - if (is_callable($callable)) { - return $callable(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * If it's a boolean, convert it to "true" or "false". - * - * @param float|int|bool|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } else { - return (string) $value; - } - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $style)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * - * @return object|array|null a single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } - - if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data) : $data; - - if (!is_array($data)) { - throw new \InvalidArgumentException("Invalid array '$class'"); - } - - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } - - if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array - $data = is_string($data) ? json_decode($data) : $data; - settype($data, 'array'); - $inner = substr($class, 4, -1); - $deserialized = []; - if (strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - return $deserialized; - } - - if ($class === 'object') { - settype($data, 'array'); - return $data; - } elseif ($class === 'mixed') { - settype($data, gettype($data)); - return $data; - } - - if ($class === '\DateTime') { - // Some APIs return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - try { - return new \DateTime($data); - } catch (\Exception $exception) { - // Some APIs return a date-time with too high nanosecond - // precision for php's DateTime to handle. - // With provided regexp 6 digits of microseconds saved - return new \DateTime(self::sanitizeTimestamp($data)); - } - } else { - return null; - } - } - - if ($class === '\SplFileObject') { - $data = Utils::streamFor($data); - - /** @var \Psr\Http\Message\StreamInterface $data */ - - // determine file name - if ( - is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) - && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) - ) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); - } else { - $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); - } - - $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); - } - fclose($file); - - return new \SplFileObject($filename, 'r'); - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - - - if (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - return $data; - } else { - $data = is_string($data) ? json_decode($data) : $data; - - if (is_array($data)) { - $data = (object)$data; - } - - // If a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = '\Messente\Api\Model\\' . $data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - } - } - - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::openAPITypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter)) { - continue; - } - - if (!isset($data->{$instance::attributeMap()[$property]})) { - if ($instance::isNullable($property)) { - $instance->$propertySetter(null); - } - - continue; - } - - if (isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - return $instance; - } - } - - /** - * Build a query string from an array of key value pairs. - * - * This function can use the return value of `parse()` to build a query - * string. This function does not modify the provided keys when an array is - * encountered (like `http_build_query()` would). - * - * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 - * with a modification which is described in https://github.com/guzzle/psr7/pull/603 - * - * @param array $params Query string parameters. - * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 - * to encode using RFC3986, or PHP_QUERY_RFC1738 - * to encode using RFC1738. - */ - public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function (string $str): string { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() - ? function ($v) { return (int) $v; } - : function ($v) { return $v ? 'true' : 'false'; }; - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? $castBool($v) : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? $castBool($vv) : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } -} diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index 485899a..0000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - ./lib/Api - ./lib/Model - - - - - ./test/Api - ./test/Model - - - - - - From 357d3e474b04bbb914b519e3612b3ac16f96fcff Mon Sep 17 00:00:00 2001 From: api-librarian Date: Mon, 1 Jul 2024 13:25:18 +0000 Subject: [PATCH 4/9] Travis update: Jul 2024 (Build 748) [skip ci] --- .gitignore | 15 + .openapi-generator-ignore | 23 + .openapi-generator/FILES | 135 + .openapi-generator/VERSION | 1 + .php-cs-fixer.dist.php | 29 + .travis.yml | 8 + README.md | 145 + composer.json | 35 + docs/Api/BlacklistApi.md | 245 ++ docs/Api/ContactsApi.md | 499 +++ docs/Api/DeliveryReportApi.md | 68 + docs/Api/GroupsApi.md | 310 ++ docs/Api/NumberLookupApi.md | 68 + docs/Api/OmnimessageApi.md | 129 + docs/Api/StatisticsApi.md | 68 + docs/Model/Channel.md | 8 + docs/Model/ContactEnvelope.md | 9 + docs/Model/ContactFields.md | 18 + docs/Model/ContactListEnvelope.md | 9 + docs/Model/ContactResponseFields.md | 19 + docs/Model/ContactUpdateFields.md | 17 + docs/Model/DeliveryReportResponse.md | 11 + docs/Model/DeliveryResult.md | 14 + docs/Model/ErrorCodeOmnichannel.md | 8 + docs/Model/ErrorCodeOmnichannelMachine.md | 8 + docs/Model/ErrorCodePhonebook.md | 8 + docs/Model/ErrorCodeStatistics.md | 8 + docs/Model/ErrorItemNumberLookup.md | 9 + docs/Model/ErrorItemNumberLookupError.md | 10 + docs/Model/ErrorItemOmnichannel.md | 12 + docs/Model/ErrorItemPhonebook.md | 11 + docs/Model/ErrorItemStatistics.md | 11 + docs/Model/ErrorNumberLookup.md | 9 + docs/Model/ErrorOmnichannel.md | 9 + docs/Model/ErrorPhonebook.md | 9 + docs/Model/ErrorStatistics.md | 9 + docs/Model/ErrorTitleOmnichannel.md | 8 + docs/Model/ErrorTitlePhonebook.md | 8 + docs/Model/FetchBlacklistSuccess.md | 9 + docs/Model/GroupEnvelope.md | 9 + docs/Model/GroupListEnvelope.md | 9 + docs/Model/GroupName.md | 9 + docs/Model/GroupResponseFields.md | 12 + docs/Model/MessageResult.md | 11 + docs/Model/MobileNetwork.md | 13 + docs/Model/NumberToBlacklist.md | 9 + docs/Model/NumbersToInvestigate.md | 9 + .../Model/OmniMessageCreateSuccessResponse.md | 11 + docs/Model/Omnimessage.md | 14 + docs/Model/OmnimessageMessagesInner.md | 21 + docs/Model/Priority.md | 8 + docs/Model/SMS.md | 15 + docs/Model/StatisticsReport.md | 11 + docs/Model/StatisticsReportSettings.md | 11 + docs/Model/StatisticsReportSuccess.md | 9 + docs/Model/Status.md | 8 + docs/Model/SyncNumberLookupResult.md | 17 + docs/Model/SyncNumberLookupSuccess.md | 10 + docs/Model/Telegram.md | 15 + docs/Model/TextStore.md | 8 + docs/Model/Viber.md | 16 + docs/Model/WhatsApp.md | 13 + docs/Model/WhatsAppComponent.md | 12 + docs/Model/WhatsAppCurrency.md | 11 + docs/Model/WhatsAppDatetime.md | 9 + docs/Model/WhatsAppLanguage.md | 10 + docs/Model/WhatsAppMedia.md | 12 + docs/Model/WhatsAppParameter.md | 15 + docs/Model/WhatsAppTemplate.md | 11 + git_push.sh | 57 + lib/Api/BlacklistApi.php | 1300 +++++++ lib/Api/ContactsApi.php | 3384 +++++++++++++++++ lib/Api/DeliveryReportApi.php | 525 +++ lib/Api/GroupsApi.php | 2040 ++++++++++ lib/Api/NumberLookupApi.php | 559 +++ lib/Api/OmnimessageApi.php | 908 +++++ lib/Api/StatisticsApi.php | 594 +++ lib/ApiException.php | 120 + lib/Configuration.php | 533 +++ lib/HeaderSelector.php | 246 ++ lib/Model/Channel.php | 70 + lib/Model/ContactEnvelope.php | 411 ++ lib/Model/ContactFields.php | 783 ++++ lib/Model/ContactListEnvelope.php | 413 ++ lib/Model/ContactResponseFields.php | 821 ++++ lib/Model/ContactUpdateFields.php | 746 ++++ lib/Model/DeliveryReportResponse.php | 488 +++ lib/Model/DeliveryResult.php | 588 +++ lib/Model/ErrorCodeOmnichannel.php | 79 + lib/Model/ErrorCodeOmnichannelMachine.php | 94 + lib/Model/ErrorCodePhonebook.php | 76 + lib/Model/ErrorCodeStatistics.php | 70 + lib/Model/ErrorItemNumberLookup.php | 414 ++ lib/Model/ErrorItemNumberLookupError.php | 467 +++ lib/Model/ErrorItemOmnichannel.php | 532 +++ lib/Model/ErrorItemPhonebook.php | 488 +++ lib/Model/ErrorItemStatistics.php | 488 +++ lib/Model/ErrorNumberLookup.php | 414 ++ lib/Model/ErrorOmnichannel.php | 414 ++ lib/Model/ErrorPhonebook.php | 414 ++ lib/Model/ErrorStatistics.php | 414 ++ lib/Model/ErrorTitleOmnichannel.php | 79 + lib/Model/ErrorTitlePhonebook.php | 76 + lib/Model/FetchBlacklistSuccess.php | 413 ++ lib/Model/GroupEnvelope.php | 411 ++ lib/Model/GroupListEnvelope.php | 413 ++ lib/Model/GroupName.php | 423 +++ lib/Model/GroupResponseFields.php | 529 +++ lib/Model/MessageResult.php | 488 +++ lib/Model/MobileNetwork.php | 547 +++ lib/Model/ModelInterface.php | 112 + lib/Model/NumberToBlacklist.php | 414 ++ lib/Model/NumbersToInvestigate.php | 429 +++ .../OmniMessageCreateSuccessResponse.php | 488 +++ lib/Model/Omnimessage.php | 587 +++ lib/Model/OmnimessageMessagesInner.php | 889 +++++ lib/Model/Priority.php | 67 + lib/Model/SMS.php | 686 ++++ lib/Model/StatisticsReport.php | 488 +++ lib/Model/StatisticsReportSettings.php | 485 +++ lib/Model/StatisticsReportSuccess.php | 414 ++ lib/Model/Status.php | 91 + lib/Model/SyncNumberLookupResult.php | 773 ++++ lib/Model/SyncNumberLookupSuccess.php | 451 +++ lib/Model/Telegram.php | 647 ++++ lib/Model/TextStore.php | 67 + lib/Model/Viber.php | 681 ++++ lib/Model/WhatsApp.php | 579 +++ lib/Model/WhatsAppComponent.php | 516 +++ lib/Model/WhatsAppCurrency.php | 488 +++ lib/Model/WhatsAppDatetime.php | 414 ++ lib/Model/WhatsAppLanguage.php | 448 +++ lib/Model/WhatsAppMedia.php | 513 +++ lib/Model/WhatsAppParameter.php | 618 +++ lib/Model/WhatsAppTemplate.php | 485 +++ lib/ObjectSerializer.php | 609 +++ phpunit.xml.dist | 18 + 137 files changed, 37163 insertions(+) create mode 100644 .gitignore create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 .php-cs-fixer.dist.php create mode 100644 .travis.yml create mode 100644 README.md create mode 100644 composer.json create mode 100644 docs/Api/BlacklistApi.md create mode 100644 docs/Api/ContactsApi.md create mode 100644 docs/Api/DeliveryReportApi.md create mode 100644 docs/Api/GroupsApi.md create mode 100644 docs/Api/NumberLookupApi.md create mode 100644 docs/Api/OmnimessageApi.md create mode 100644 docs/Api/StatisticsApi.md create mode 100644 docs/Model/Channel.md create mode 100644 docs/Model/ContactEnvelope.md create mode 100644 docs/Model/ContactFields.md create mode 100644 docs/Model/ContactListEnvelope.md create mode 100644 docs/Model/ContactResponseFields.md create mode 100644 docs/Model/ContactUpdateFields.md create mode 100644 docs/Model/DeliveryReportResponse.md create mode 100644 docs/Model/DeliveryResult.md create mode 100644 docs/Model/ErrorCodeOmnichannel.md create mode 100644 docs/Model/ErrorCodeOmnichannelMachine.md create mode 100644 docs/Model/ErrorCodePhonebook.md create mode 100644 docs/Model/ErrorCodeStatistics.md create mode 100644 docs/Model/ErrorItemNumberLookup.md create mode 100644 docs/Model/ErrorItemNumberLookupError.md create mode 100644 docs/Model/ErrorItemOmnichannel.md create mode 100644 docs/Model/ErrorItemPhonebook.md create mode 100644 docs/Model/ErrorItemStatistics.md create mode 100644 docs/Model/ErrorNumberLookup.md create mode 100644 docs/Model/ErrorOmnichannel.md create mode 100644 docs/Model/ErrorPhonebook.md create mode 100644 docs/Model/ErrorStatistics.md create mode 100644 docs/Model/ErrorTitleOmnichannel.md create mode 100644 docs/Model/ErrorTitlePhonebook.md create mode 100644 docs/Model/FetchBlacklistSuccess.md create mode 100644 docs/Model/GroupEnvelope.md create mode 100644 docs/Model/GroupListEnvelope.md create mode 100644 docs/Model/GroupName.md create mode 100644 docs/Model/GroupResponseFields.md create mode 100644 docs/Model/MessageResult.md create mode 100644 docs/Model/MobileNetwork.md create mode 100644 docs/Model/NumberToBlacklist.md create mode 100644 docs/Model/NumbersToInvestigate.md create mode 100644 docs/Model/OmniMessageCreateSuccessResponse.md create mode 100644 docs/Model/Omnimessage.md create mode 100644 docs/Model/OmnimessageMessagesInner.md create mode 100644 docs/Model/Priority.md create mode 100644 docs/Model/SMS.md create mode 100644 docs/Model/StatisticsReport.md create mode 100644 docs/Model/StatisticsReportSettings.md create mode 100644 docs/Model/StatisticsReportSuccess.md create mode 100644 docs/Model/Status.md create mode 100644 docs/Model/SyncNumberLookupResult.md create mode 100644 docs/Model/SyncNumberLookupSuccess.md create mode 100644 docs/Model/Telegram.md create mode 100644 docs/Model/TextStore.md create mode 100644 docs/Model/Viber.md create mode 100644 docs/Model/WhatsApp.md create mode 100644 docs/Model/WhatsAppComponent.md create mode 100644 docs/Model/WhatsAppCurrency.md create mode 100644 docs/Model/WhatsAppDatetime.md create mode 100644 docs/Model/WhatsAppLanguage.md create mode 100644 docs/Model/WhatsAppMedia.md create mode 100644 docs/Model/WhatsAppParameter.md create mode 100644 docs/Model/WhatsAppTemplate.md create mode 100644 git_push.sh create mode 100644 lib/Api/BlacklistApi.php create mode 100644 lib/Api/ContactsApi.php create mode 100644 lib/Api/DeliveryReportApi.php create mode 100644 lib/Api/GroupsApi.php create mode 100644 lib/Api/NumberLookupApi.php create mode 100644 lib/Api/OmnimessageApi.php create mode 100644 lib/Api/StatisticsApi.php create mode 100644 lib/ApiException.php create mode 100644 lib/Configuration.php create mode 100644 lib/HeaderSelector.php create mode 100644 lib/Model/Channel.php create mode 100644 lib/Model/ContactEnvelope.php create mode 100644 lib/Model/ContactFields.php create mode 100644 lib/Model/ContactListEnvelope.php create mode 100644 lib/Model/ContactResponseFields.php create mode 100644 lib/Model/ContactUpdateFields.php create mode 100644 lib/Model/DeliveryReportResponse.php create mode 100644 lib/Model/DeliveryResult.php create mode 100644 lib/Model/ErrorCodeOmnichannel.php create mode 100644 lib/Model/ErrorCodeOmnichannelMachine.php create mode 100644 lib/Model/ErrorCodePhonebook.php create mode 100644 lib/Model/ErrorCodeStatistics.php create mode 100644 lib/Model/ErrorItemNumberLookup.php create mode 100644 lib/Model/ErrorItemNumberLookupError.php create mode 100644 lib/Model/ErrorItemOmnichannel.php create mode 100644 lib/Model/ErrorItemPhonebook.php create mode 100644 lib/Model/ErrorItemStatistics.php create mode 100644 lib/Model/ErrorNumberLookup.php create mode 100644 lib/Model/ErrorOmnichannel.php create mode 100644 lib/Model/ErrorPhonebook.php create mode 100644 lib/Model/ErrorStatistics.php create mode 100644 lib/Model/ErrorTitleOmnichannel.php create mode 100644 lib/Model/ErrorTitlePhonebook.php create mode 100644 lib/Model/FetchBlacklistSuccess.php create mode 100644 lib/Model/GroupEnvelope.php create mode 100644 lib/Model/GroupListEnvelope.php create mode 100644 lib/Model/GroupName.php create mode 100644 lib/Model/GroupResponseFields.php create mode 100644 lib/Model/MessageResult.php create mode 100644 lib/Model/MobileNetwork.php create mode 100644 lib/Model/ModelInterface.php create mode 100644 lib/Model/NumberToBlacklist.php create mode 100644 lib/Model/NumbersToInvestigate.php create mode 100644 lib/Model/OmniMessageCreateSuccessResponse.php create mode 100644 lib/Model/Omnimessage.php create mode 100644 lib/Model/OmnimessageMessagesInner.php create mode 100644 lib/Model/Priority.php create mode 100644 lib/Model/SMS.php create mode 100644 lib/Model/StatisticsReport.php create mode 100644 lib/Model/StatisticsReportSettings.php create mode 100644 lib/Model/StatisticsReportSuccess.php create mode 100644 lib/Model/Status.php create mode 100644 lib/Model/SyncNumberLookupResult.php create mode 100644 lib/Model/SyncNumberLookupSuccess.php create mode 100644 lib/Model/Telegram.php create mode 100644 lib/Model/TextStore.php create mode 100644 lib/Model/Viber.php create mode 100644 lib/Model/WhatsApp.php create mode 100644 lib/Model/WhatsAppComponent.php create mode 100644 lib/Model/WhatsAppCurrency.php create mode 100644 lib/Model/WhatsAppDatetime.php create mode 100644 lib/Model/WhatsAppLanguage.php create mode 100644 lib/Model/WhatsAppMedia.php create mode 100644 lib/Model/WhatsAppParameter.php create mode 100644 lib/Model/WhatsAppTemplate.php create mode 100644 lib/ObjectSerializer.php create mode 100644 phpunit.xml.dist diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f1681c --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +# composer.lock + +# php-cs-fixer cache +.php_cs.cache +.php-cs-fixer.cache + +# PHPUnit cache +.phpunit.result.cache diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..0f2a994 --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,135 @@ +.gitignore +.openapi-generator-ignore +.php-cs-fixer.dist.php +.travis.yml +README.md +composer.json +docs/Api/BlacklistApi.md +docs/Api/ContactsApi.md +docs/Api/DeliveryReportApi.md +docs/Api/GroupsApi.md +docs/Api/NumberLookupApi.md +docs/Api/OmnimessageApi.md +docs/Api/StatisticsApi.md +docs/Model/Channel.md +docs/Model/ContactEnvelope.md +docs/Model/ContactFields.md +docs/Model/ContactListEnvelope.md +docs/Model/ContactResponseFields.md +docs/Model/ContactUpdateFields.md +docs/Model/DeliveryReportResponse.md +docs/Model/DeliveryResult.md +docs/Model/ErrorCodeOmnichannel.md +docs/Model/ErrorCodeOmnichannelMachine.md +docs/Model/ErrorCodePhonebook.md +docs/Model/ErrorCodeStatistics.md +docs/Model/ErrorItemNumberLookup.md +docs/Model/ErrorItemNumberLookupError.md +docs/Model/ErrorItemOmnichannel.md +docs/Model/ErrorItemPhonebook.md +docs/Model/ErrorItemStatistics.md +docs/Model/ErrorNumberLookup.md +docs/Model/ErrorOmnichannel.md +docs/Model/ErrorPhonebook.md +docs/Model/ErrorStatistics.md +docs/Model/ErrorTitleOmnichannel.md +docs/Model/ErrorTitlePhonebook.md +docs/Model/FetchBlacklistSuccess.md +docs/Model/GroupEnvelope.md +docs/Model/GroupListEnvelope.md +docs/Model/GroupName.md +docs/Model/GroupResponseFields.md +docs/Model/MessageResult.md +docs/Model/MobileNetwork.md +docs/Model/NumberToBlacklist.md +docs/Model/NumbersToInvestigate.md +docs/Model/OmniMessageCreateSuccessResponse.md +docs/Model/Omnimessage.md +docs/Model/OmnimessageMessagesInner.md +docs/Model/Priority.md +docs/Model/SMS.md +docs/Model/StatisticsReport.md +docs/Model/StatisticsReportSettings.md +docs/Model/StatisticsReportSuccess.md +docs/Model/Status.md +docs/Model/SyncNumberLookupResult.md +docs/Model/SyncNumberLookupSuccess.md +docs/Model/Telegram.md +docs/Model/TextStore.md +docs/Model/Viber.md +docs/Model/WhatsApp.md +docs/Model/WhatsAppComponent.md +docs/Model/WhatsAppCurrency.md +docs/Model/WhatsAppDatetime.md +docs/Model/WhatsAppLanguage.md +docs/Model/WhatsAppMedia.md +docs/Model/WhatsAppParameter.md +docs/Model/WhatsAppTemplate.md +git_push.sh +lib/Api/BlacklistApi.php +lib/Api/ContactsApi.php +lib/Api/DeliveryReportApi.php +lib/Api/GroupsApi.php +lib/Api/NumberLookupApi.php +lib/Api/OmnimessageApi.php +lib/Api/StatisticsApi.php +lib/ApiException.php +lib/Configuration.php +lib/HeaderSelector.php +lib/Model/Channel.php +lib/Model/ContactEnvelope.php +lib/Model/ContactFields.php +lib/Model/ContactListEnvelope.php +lib/Model/ContactResponseFields.php +lib/Model/ContactUpdateFields.php +lib/Model/DeliveryReportResponse.php +lib/Model/DeliveryResult.php +lib/Model/ErrorCodeOmnichannel.php +lib/Model/ErrorCodeOmnichannelMachine.php +lib/Model/ErrorCodePhonebook.php +lib/Model/ErrorCodeStatistics.php +lib/Model/ErrorItemNumberLookup.php +lib/Model/ErrorItemNumberLookupError.php +lib/Model/ErrorItemOmnichannel.php +lib/Model/ErrorItemPhonebook.php +lib/Model/ErrorItemStatistics.php +lib/Model/ErrorNumberLookup.php +lib/Model/ErrorOmnichannel.php +lib/Model/ErrorPhonebook.php +lib/Model/ErrorStatistics.php +lib/Model/ErrorTitleOmnichannel.php +lib/Model/ErrorTitlePhonebook.php +lib/Model/FetchBlacklistSuccess.php +lib/Model/GroupEnvelope.php +lib/Model/GroupListEnvelope.php +lib/Model/GroupName.php +lib/Model/GroupResponseFields.php +lib/Model/MessageResult.php +lib/Model/MobileNetwork.php +lib/Model/ModelInterface.php +lib/Model/NumberToBlacklist.php +lib/Model/NumbersToInvestigate.php +lib/Model/OmniMessageCreateSuccessResponse.php +lib/Model/Omnimessage.php +lib/Model/OmnimessageMessagesInner.php +lib/Model/Priority.php +lib/Model/SMS.php +lib/Model/StatisticsReport.php +lib/Model/StatisticsReportSettings.php +lib/Model/StatisticsReportSuccess.php +lib/Model/Status.php +lib/Model/SyncNumberLookupResult.php +lib/Model/SyncNumberLookupSuccess.php +lib/Model/Telegram.php +lib/Model/TextStore.php +lib/Model/Viber.php +lib/Model/WhatsApp.php +lib/Model/WhatsAppComponent.php +lib/Model/WhatsAppCurrency.php +lib/Model/WhatsAppDatetime.php +lib/Model/WhatsAppLanguage.php +lib/Model/WhatsAppMedia.php +lib/Model/WhatsAppParameter.php +lib/Model/WhatsAppTemplate.php +lib/ObjectSerializer.php +phpunit.xml.dist diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..93c8dda --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.6.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..667b815 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php +# Bionic environment has preinstalled PHP from 7.1 to 7.4 +# https://docs.travis-ci.com/user/reference/bionic/#php-support +dist: bionic +php: + - 7.4 +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ad019b --- /dev/null +++ b/README.md @@ -0,0 +1,145 @@ +# Messente API Library + +- Messente API version: 2.0.0 +- PHP artifact version: 3.0.0 + +[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. + +## Installation + +Install Messente API library with `composer require messente/messente-api-php`. + +## Features + +Messente API has the following features: + +- Omnichannel ([external docs](https://messente.com/documentation/omnichannel-api)), +- Phonebook ([external docs](https://messente.com/documentation/phonebook-api)). + +Messente API Library provides the operations described below to access the features. + +### BlacklistApi + +1. Adds a phone number to the blacklist [`addToBlacklist`](docs/Api/BlacklistApi.md#addtoblacklist) +1. Deletes a phone number from the blacklist [`deleteFromBlacklist`](docs/Api/BlacklistApi.md#deletefromblacklist) +1. Returns all blacklisted phone numbers [`fetchBlacklist`](docs/Api/BlacklistApi.md#fetchblacklist) +1. Checks if a phone number is blacklisted [`isBlacklisted`](docs/Api/BlacklistApi.md#isblacklisted) + +### ContactsApi + +1. Adds a contact to a group [`addContactToGroup`](docs/Api/ContactsApi.md#addcontacttogroup) +1. Creates a new contact [`createContact`](docs/Api/ContactsApi.md#createcontact) +1. Deletes a contact [`deleteContact`](docs/Api/ContactsApi.md#deletecontact) +1. Lists a contact [`fetchContact`](docs/Api/ContactsApi.md#fetchcontact) +1. Lists groups of a contact [`fetchContactGroups`](docs/Api/ContactsApi.md#fetchcontactgroups) +1. Returns all contacts [`fetchContacts`](docs/Api/ContactsApi.md#fetchcontacts) +1. Removes a contact from a group [`removeContactFromGroup`](docs/Api/ContactsApi.md#removecontactfromgroup) +1. Updates a contact [`updateContact`](docs/Api/ContactsApi.md#updatecontact) + +### DeliveryReportApi + +1. Retrieves the delivery report for the Omnimessage [`retrieveDeliveryReport`](docs/Api/DeliveryReportApi.md#retrievedeliveryreport) + +### GroupsApi + +1. Creates a new group with the provided name [`createGroup`](docs/Api/GroupsApi.md#creategroup) +1. Deletes a group [`deleteGroup`](docs/Api/GroupsApi.md#deletegroup) +1. Lists a group [`fetchGroup`](docs/Api/GroupsApi.md#fetchgroup) +1. Returns all groups [`fetchGroups`](docs/Api/GroupsApi.md#fetchgroups) +1. Updates a group with the provided name [`updateGroup`](docs/Api/GroupsApi.md#updategroup) + +### NumberLookupApi + +1. Requests info about phone numbers [`fetchInfo`](docs/Api/NumberLookupApi.md#fetchinfo) + +### OmnimessageApi + +1. Cancels a scheduled Omnimessage [`cancelScheduledMessage`](docs/Api/OmnimessageApi.md#cancelscheduledmessage) +1. Sends an Omnimessage [`sendOmnimessage`](docs/Api/OmnimessageApi.md#sendomnimessage) + +### StatisticsApi + +1. Requests statistics reports for each country [`createStatisticsReport`](docs/Api/StatisticsApi.md#createstatisticsreport) + +## Auth + +**Type**: HTTP basic authentication + +Read the [external getting-started article](https://messente.com/documentation/getting-started) which explains API keys and Sender ID logic. + +## Getting started: sending an omnimessage + +```php +setUsername('') + ->setPassword(''); + +$apiInstance = new OmnimessageApi( + new GuzzleHttp\Client(), + $config +); + +$omnimessage = new Omnimessage([ + "to" => "" +]); + +$viber = new Viber( + ["text" => "Hello Viber!", "sender" => "MyViberSender"] +); + +$sms = new SMS( + ["text" => "Hello SMS!", "sender" => "MySmsSender"] +); + +$whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; +$whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); +$whatsAppLanguage = new WhatsAppLanguage(['code' => '']); +$whatsAppTemplate = new WhatsAppTemplate( + [ + 'name'=> '', + 'language'=> $whatsAppLanguage, + 'components' => [$whatsAppComponent] + ] +); + +$whatsapp = new WhatsApp( + [ + 'sender' => '', + 'template' => $whatsAppTemplate, + ] +); + +$omnimessage->setMessages([$whatsapp, $viber, $sms]); + + +try { + $result = $apiInstance->sendOmnimessage($omnimessage); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL; +} +?> + +``` + +## License + +[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0.html) + +## Terms + +[https://messente.com/terms-and-conditions](https://messente.com/terms-and-conditions) diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..9985e13 --- /dev/null +++ b/composer.json @@ -0,0 +1,35 @@ +{ + "name": "messente/messente-api-php", + "version": "3.0.0", + "description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.", + "keywords": ["viber", "telegram", "sms", "whatsapp", "phonebook", "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://messente.com", + "license": "unlicense", + "authors": [ + { + "name": "Messente", + "homepage": "https://messente.com" + } + ], + "require": { + "php": ">=7.1", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2 || ^7.0", + "guzzlehttp/psr7": "^1.8" + }, + "autoload": { + "psr-4": { "Messente\\Api\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "Messente\\Api\\Test\\" : "test/" } + } +} diff --git a/docs/Api/BlacklistApi.md b/docs/Api/BlacklistApi.md new file mode 100644 index 0000000..26c6414 --- /dev/null +++ b/docs/Api/BlacklistApi.md @@ -0,0 +1,245 @@ +# Messente\Api\BlacklistApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist | +| [**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist | +| [**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers | +| [**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted | + + +## `addToBlacklist()` + +```php +addToBlacklist($numberToBlacklist) +``` + +Adds a phone number to the blacklist + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\BlacklistApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$numberToBlacklist = {"phoneNumber":"+37251000000"}; // \Messente\Api\Model\NumberToBlacklist | Phone number to be blacklisted + +try { + $apiInstance->addToBlacklist($numberToBlacklist); +} catch (Exception $e) { + echo 'Exception when calling BlacklistApi->addToBlacklist: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteFromBlacklist()` + +```php +deleteFromBlacklist($phone) +``` + +Deletes a phone number from the blacklist + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\BlacklistApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number + +try { + $apiInstance->deleteFromBlacklist($phone); +} catch (Exception $e) { + echo 'Exception when calling BlacklistApi->deleteFromBlacklist: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchBlacklist()` + +```php +fetchBlacklist(): \Messente\Api\Model\FetchBlacklistSuccess +``` + +Returns all blacklisted phone numbers + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\BlacklistApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->fetchBlacklist(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BlacklistApi->fetchBlacklist: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Messente\Api\Model\FetchBlacklistSuccess**](../Model/FetchBlacklistSuccess.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `isBlacklisted()` + +```php +isBlacklisted($phone) +``` + +Checks if a phone number is blacklisted + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\BlacklistApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number + +try { + $apiInstance->isBlacklisted($phone); +} catch (Exception $e) { + echo 'Exception when calling BlacklistApi->isBlacklisted: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md new file mode 100644 index 0000000..a99a3ad --- /dev/null +++ b/docs/Api/ContactsApi.md @@ -0,0 +1,499 @@ +# Messente\Api\ContactsApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group | +| [**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact | +| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact | +| [**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact | +| [**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact | +| [**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts | +| [**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group | +| [**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact | + + +## `addContactToGroup()` + +```php +addContactToGroup($groupId, $phone): object +``` + +Adds a contact to a group + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format +$phone = +37251000000; // string | A phone number + +try { + $result = $apiInstance->addContactToGroup($groupId, $phone); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->addContactToGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | + +### Return type + +**object** + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `createContact()` + +```php +createContact($contactFields): \Messente\Api\Model\ContactEnvelope +``` + +Creates a new contact + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$contactFields = {"phoneNumber":"+37251000000","email":"anyone@messente.com","firstName":"Any","lastName":"One","company":"Messente","title":"Sir","custom":"Any custom","custom2":"Any custom two","custom3":"Any custom three","custom4":"Any custom four"}; // \Messente\Api\Model\ContactFields + +try { + $result = $apiInstance->createContact($contactFields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->createContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | | + +### Return type + +[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteContact()` + +```php +deleteContact($phone) +``` + +Deletes a contact + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number + +try { + $apiInstance->deleteContact($phone); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->deleteContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchContact()` + +```php +fetchContact($phone): \Messente\Api\Model\ContactEnvelope +``` + +Lists a contact + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number + +try { + $result = $apiInstance->fetchContact($phone); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->fetchContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | + +### Return type + +[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchContactGroups()` + +```php +fetchContactGroups($phone): \Messente\Api\Model\GroupListEnvelope +``` + +Lists groups of a contact + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number + +try { + $result = $apiInstance->fetchContactGroups($phone); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->fetchContactGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | + +### Return type + +[**\Messente\Api\Model\GroupListEnvelope**](../Model/GroupListEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchContacts()` + +```php +fetchContacts($groupIds): \Messente\Api\Model\ContactListEnvelope +``` + +Returns all contacts + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupIds = ["5792a02a-e5c2-422b-a0a0-0ae65d814663","4792a02a-e5c2-422b-a0a0-0ae65d814662"]; // string[] | Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" + +try { + $result = $apiInstance->fetchContacts($groupIds); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->fetchContacts: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] | + +### Return type + +[**\Messente\Api\Model\ContactListEnvelope**](../Model/ContactListEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `removeContactFromGroup()` + +```php +removeContactFromGroup($groupId, $phone) +``` + +Removes a contact from a group + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format +$phone = +37251000000; // string | A phone number + +try { + $apiInstance->removeContactFromGroup($groupId, $phone); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->removeContactFromGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateContact()` + +```php +updateContact($phone, $contactUpdateFields): \Messente\Api\Model\ContactEnvelope +``` + +Updates a contact + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\ContactsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$phone = +37251000000; // string | A phone number +$contactUpdateFields = {"email":"anyone@messente.com","firstName":"Any","lastName":"One","company":"Messente","title":"Sir","custom":"Any custom","custom2":"Any custom two","custom3":"Any custom three","custom4":"Any custom four"}; // \Messente\Api\Model\ContactUpdateFields + +try { + $result = $apiInstance->updateContact($phone, $contactUpdateFields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling ContactsApi->updateContact: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | +| **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | | + +### Return type + +[**\Messente\Api\Model\ContactEnvelope**](../Model/ContactEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/DeliveryReportApi.md b/docs/Api/DeliveryReportApi.md new file mode 100644 index 0000000..622fe6f --- /dev/null +++ b/docs/Api/DeliveryReportApi.md @@ -0,0 +1,68 @@ +# Messente\Api\DeliveryReportApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage | + + +## `retrieveDeliveryReport()` + +```php +retrieveDeliveryReport($omnimessageId): \Messente\Api\Model\DeliveryReportResponse +``` + +Retrieves the delivery report for the Omnimessage + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\DeliveryReportApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$omnimessageId = 'omnimessageId_example'; // string | UUID of the omnimessage to for which the delivery report is to be retrieved + +try { + $result = $apiInstance->retrieveDeliveryReport($omnimessageId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DeliveryReportApi->retrieveDeliveryReport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | | + +### Return type + +[**\Messente\Api\Model\DeliveryReportResponse**](../Model/DeliveryReportResponse.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/GroupsApi.md b/docs/Api/GroupsApi.md new file mode 100644 index 0000000..8ad8bb9 --- /dev/null +++ b/docs/Api/GroupsApi.md @@ -0,0 +1,310 @@ +# Messente\Api\GroupsApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name | +| [**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group | +| [**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group | +| [**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups | +| [**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name | + + +## `createGroup()` + +```php +createGroup($groupName): \Messente\Api\Model\GroupEnvelope +``` + +Creates a new group with the provided name + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\GroupsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupName = {"name":"Any group name"}; // \Messente\Api\Model\GroupName + +try { + $result = $apiInstance->createGroup($groupName); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupsApi->createGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | + +### Return type + +[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `deleteGroup()` + +```php +deleteGroup($groupId) +``` + +Deletes a group + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\GroupsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format + +try { + $apiInstance->deleteGroup($groupId); +} catch (Exception $e) { + echo 'Exception when calling GroupsApi->deleteGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | + +### Return type + +void (empty response body) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchGroup()` + +```php +fetchGroup($groupId): \Messente\Api\Model\GroupEnvelope +``` + +Lists a group + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\GroupsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format + +try { + $result = $apiInstance->fetchGroup($groupId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupsApi->fetchGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | + +### Return type + +[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `fetchGroups()` + +```php +fetchGroups(): \Messente\Api\Model\GroupListEnvelope +``` + +Returns all groups + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\GroupsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->fetchGroups(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupsApi->fetchGroups: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Messente\Api\Model\GroupListEnvelope**](../Model/GroupListEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `updateGroup()` + +```php +updateGroup($groupId, $groupName): \Messente\Api\Model\GroupEnvelope +``` + +Updates a group with the provided name + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\GroupsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$groupId = 5792a02a-e5c2-422b-a0a0-0ae65d814663; // string | String in UUID format +$groupName = {"name":"Any group name"}; // \Messente\Api\Model\GroupName + +try { + $result = $apiInstance->updateGroup($groupId, $groupName); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling GroupsApi->updateGroup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | + +### Return type + +[**\Messente\Api\Model\GroupEnvelope**](../Model/GroupEnvelope.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/NumberLookupApi.md b/docs/Api/NumberLookupApi.md new file mode 100644 index 0000000..01fa35c --- /dev/null +++ b/docs/Api/NumberLookupApi.md @@ -0,0 +1,68 @@ +# Messente\Api\NumberLookupApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers | + + +## `fetchInfo()` + +```php +fetchInfo($numbersToInvestigate): \Messente\Api\Model\SyncNumberLookupSuccess +``` + +Requests info about phone numbers + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\NumberLookupApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$numbersToInvestigate = {"numbers":["+37251000000","+37251000001"]}; // \Messente\Api\Model\NumbersToInvestigate | Numbers for lookup + +try { + $result = $apiInstance->fetchInfo($numbersToInvestigate); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling NumberLookupApi->fetchInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | | + +### Return type + +[**\Messente\Api\Model\SyncNumberLookupSuccess**](../Model/SyncNumberLookupSuccess.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md new file mode 100644 index 0000000..b4317da --- /dev/null +++ b/docs/Api/OmnimessageApi.md @@ -0,0 +1,129 @@ +# Messente\Api\OmnimessageApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | +| [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | + + +## `cancelScheduledMessage()` + +```php +cancelScheduledMessage($omnimessageId): object +``` + +Cancels a scheduled Omnimessage + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\OmnimessageApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$omnimessageId = 'omnimessageId_example'; // string | UUID of the scheduled omnimessage to be cancelled + +try { + $result = $apiInstance->cancelScheduledMessage($omnimessageId); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OmnimessageApi->cancelScheduledMessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | | + +### Return type + +**object** + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `sendOmnimessage()` + +```php +sendOmnimessage($omnimessage): \Messente\Api\Model\OmniMessageCreateSuccessResponse +``` + +Sends an Omnimessage + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\OmnimessageApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$omnimessage = new \Messente\Api\Model\Omnimessage(); // \Messente\Api\Model\Omnimessage | Omnimessage to be sent + +try { + $result = $apiInstance->sendOmnimessage($omnimessage); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OmnimessageApi->sendOmnimessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | | + +### Return type + +[**\Messente\Api\Model\OmniMessageCreateSuccessResponse**](../Model/OmniMessageCreateSuccessResponse.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md new file mode 100644 index 0000000..be19360 --- /dev/null +++ b/docs/Api/StatisticsApi.md @@ -0,0 +1,68 @@ +# Messente\Api\StatisticsApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country | + + +## `createStatisticsReport()` + +```php +createStatisticsReport($statisticsReportSettings): \Messente\Api\Model\StatisticsReportSuccess +``` + +Requests statistics reports for each country + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\StatisticsApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$statisticsReportSettings = {"start_date":"2017-01-01","end_date":"2019-06-20","message_types":["sms"]}; // \Messente\Api\Model\StatisticsReportSettings | Settings for statistics report + +try { + $result = $apiInstance->createStatisticsReport($statisticsReportSettings); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StatisticsApi->createStatisticsReport: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | | + +### Return type + +[**\Messente\Api\Model\StatisticsReportSuccess**](../Model/StatisticsReportSuccess.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Model/Channel.md b/docs/Model/Channel.md new file mode 100644 index 0000000..866cd4a --- /dev/null +++ b/docs/Model/Channel.md @@ -0,0 +1,8 @@ +# # Channel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactEnvelope.md b/docs/Model/ContactEnvelope.md new file mode 100644 index 0000000..c86b00d --- /dev/null +++ b/docs/Model/ContactEnvelope.md @@ -0,0 +1,9 @@ +# # ContactEnvelope + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contact** | [**\Messente\Api\Model\ContactResponseFields**](ContactResponseFields.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactFields.md b/docs/Model/ContactFields.md new file mode 100644 index 0000000..5f5e1a3 --- /dev/null +++ b/docs/Model/ContactFields.md @@ -0,0 +1,18 @@ +# # ContactFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phoneNumber** | **string** | Phone number in e.164 format | +**email** | **string** | The email of the contact | [optional] +**firstName** | **string** | The first name of the contact | [optional] +**lastName** | **string** | The last name of the contact | [optional] +**company** | **string** | The company of the contact | [optional] +**title** | **string** | The title of the contact | [optional] +**custom** | **string** | The first custom field | [optional] +**custom2** | **string** | The second custom field | [optional] +**custom3** | **string** | The third custom field | [optional] +**custom4** | **string** | The fourth custom field | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactListEnvelope.md b/docs/Model/ContactListEnvelope.md new file mode 100644 index 0000000..0ad220a --- /dev/null +++ b/docs/Model/ContactListEnvelope.md @@ -0,0 +1,9 @@ +# # ContactListEnvelope + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contacts** | [**\Messente\Api\Model\ContactResponseFields[]**](ContactResponseFields.md) | An array of contacts | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactResponseFields.md b/docs/Model/ContactResponseFields.md new file mode 100644 index 0000000..d9ed0a8 --- /dev/null +++ b/docs/Model/ContactResponseFields.md @@ -0,0 +1,19 @@ +# # ContactResponseFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phoneNumber** | **string** | Phone number in e.164 format | [optional] +**email** | **string** | The email of the contact | [optional] +**firstName** | **string** | The first name of the contact | [optional] +**lastName** | **string** | The last name of the contact | [optional] +**company** | **string** | The company of the contact | [optional] +**title** | **string** | The title of the contact | [optional] +**custom** | **string** | The first custom field | [optional] +**custom2** | **string** | The second custom field | [optional] +**custom3** | **string** | The third custom field | [optional] +**custom4** | **string** | The fourth custom field | [optional] +**scheduledDeletionDate** | **\DateTime** | The date in ISO 8601 format, YYYY-MM-DD, on which the contact is going to be deleted because it has not belonged to a group for 30 days | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ContactUpdateFields.md b/docs/Model/ContactUpdateFields.md new file mode 100644 index 0000000..1110f27 --- /dev/null +++ b/docs/Model/ContactUpdateFields.md @@ -0,0 +1,17 @@ +# # ContactUpdateFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**email** | **string** | The email of the contact | [optional] +**firstName** | **string** | The first name of the contact | [optional] +**lastName** | **string** | The last name of the contact | [optional] +**company** | **string** | The company of the contact | [optional] +**title** | **string** | The title of the contact | [optional] +**custom** | **string** | The first custom field | [optional] +**custom2** | **string** | The second custom field | [optional] +**custom3** | **string** | The third custom field | [optional] +**custom4** | **string** | The fourth custom field | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeliveryReportResponse.md b/docs/Model/DeliveryReportResponse.md new file mode 100644 index 0000000..0dc0688 --- /dev/null +++ b/docs/Model/DeliveryReportResponse.md @@ -0,0 +1,11 @@ +# # DeliveryReportResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**statuses** | [**\Messente\Api\Model\DeliveryResult[]**](DeliveryResult.md) | Contains the delivery reports for each channel, ordered by send order | +**to** | **string** | Phone number in e.164 format | +**omnimessageId** | **string** | Unique identifier for the omnimessage | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/DeliveryResult.md b/docs/Model/DeliveryResult.md new file mode 100644 index 0000000..427c9f2 --- /dev/null +++ b/docs/Model/DeliveryResult.md @@ -0,0 +1,14 @@ +# # DeliveryResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | [**\Messente\Api\Model\Status**](Status.md) | | [optional] +**channel** | [**\Messente\Api\Model\Channel**](Channel.md) | | [optional] +**messageId** | **string** | Unique identifier for the message | [optional] +**error** | **string** | Human-readable description of what went wrong, *null* in case of success or if the message has not been processed yet | [optional] +**err** | [**\Messente\Api\Model\ErrorCodeOmnichannelMachine**](ErrorCodeOmnichannelMachine.md) | | [optional] +**timestamp** | **\DateTime** | When this status was received by Omnichannel API | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeOmnichannel.md b/docs/Model/ErrorCodeOmnichannel.md new file mode 100644 index 0000000..667281b --- /dev/null +++ b/docs/Model/ErrorCodeOmnichannel.md @@ -0,0 +1,8 @@ +# # ErrorCodeOmnichannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeOmnichannelMachine.md b/docs/Model/ErrorCodeOmnichannelMachine.md new file mode 100644 index 0000000..da84b2d --- /dev/null +++ b/docs/Model/ErrorCodeOmnichannelMachine.md @@ -0,0 +1,8 @@ +# # ErrorCodeOmnichannelMachine + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodePhonebook.md b/docs/Model/ErrorCodePhonebook.md new file mode 100644 index 0000000..d7fe431 --- /dev/null +++ b/docs/Model/ErrorCodePhonebook.md @@ -0,0 +1,8 @@ +# # ErrorCodePhonebook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorCodeStatistics.md b/docs/Model/ErrorCodeStatistics.md new file mode 100644 index 0000000..3ba4cf6 --- /dev/null +++ b/docs/Model/ErrorCodeStatistics.md @@ -0,0 +1,8 @@ +# # ErrorCodeStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemNumberLookup.md b/docs/Model/ErrorItemNumberLookup.md new file mode 100644 index 0000000..c923237 --- /dev/null +++ b/docs/Model/ErrorItemNumberLookup.md @@ -0,0 +1,9 @@ +# # ErrorItemNumberLookup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**error** | [**\Messente\Api\Model\ErrorItemNumberLookupError**](ErrorItemNumberLookupError.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemNumberLookupError.md b/docs/Model/ErrorItemNumberLookupError.md new file mode 100644 index 0000000..dab852b --- /dev/null +++ b/docs/Model/ErrorItemNumberLookupError.md @@ -0,0 +1,10 @@ +# # ErrorItemNumberLookupError + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **string** | Error description | +**code** | **int** | Matches the following error title. This field is a constant * 101 - Unauthorized * 102 - Invalid arguments or parameters * 103 - Server error * 104 - Crediting error #1 * 105 - Crediting error #2 * 106 - Client error | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemOmnichannel.md b/docs/Model/ErrorItemOmnichannel.md new file mode 100644 index 0000000..64aec57 --- /dev/null +++ b/docs/Model/ErrorItemOmnichannel.md @@ -0,0 +1,12 @@ +# # ErrorItemOmnichannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | [**\Messente\Api\Model\ErrorTitleOmnichannel**](ErrorTitleOmnichannel.md) | | +**detail** | **string** | Free form more detailed description of the error | +**code** | [**\Messente\Api\Model\ErrorCodeOmnichannel**](ErrorCodeOmnichannel.md) | | +**source** | **string** | Describes which field is causing the issue in the payload, null for non 400 status code responses | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemPhonebook.md b/docs/Model/ErrorItemPhonebook.md new file mode 100644 index 0000000..8ca8880 --- /dev/null +++ b/docs/Model/ErrorItemPhonebook.md @@ -0,0 +1,11 @@ +# # ErrorItemPhonebook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | [**\Messente\Api\Model\ErrorTitlePhonebook**](ErrorTitlePhonebook.md) | | +**detail** | **string** | Free form more detailed description of the error | +**code** | [**\Messente\Api\Model\ErrorCodePhonebook**](ErrorCodePhonebook.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorItemStatistics.md b/docs/Model/ErrorItemStatistics.md new file mode 100644 index 0000000..62d0e8a --- /dev/null +++ b/docs/Model/ErrorItemStatistics.md @@ -0,0 +1,11 @@ +# # ErrorItemStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | Error title | +**details** | **string** | Error details | +**code** | [**\Messente\Api\Model\ErrorCodeStatistics**](ErrorCodeStatistics.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorNumberLookup.md b/docs/Model/ErrorNumberLookup.md new file mode 100644 index 0000000..d8116b4 --- /dev/null +++ b/docs/Model/ErrorNumberLookup.md @@ -0,0 +1,9 @@ +# # ErrorNumberLookup + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**errors** | [**\Messente\Api\Model\ErrorItemNumberLookup[]**](ErrorItemNumberLookup.md) | An array of errors | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorOmnichannel.md b/docs/Model/ErrorOmnichannel.md new file mode 100644 index 0000000..fe59aea --- /dev/null +++ b/docs/Model/ErrorOmnichannel.md @@ -0,0 +1,9 @@ +# # ErrorOmnichannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**errors** | [**\Messente\Api\Model\ErrorItemOmnichannel[]**](ErrorItemOmnichannel.md) | An array of errors | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorPhonebook.md b/docs/Model/ErrorPhonebook.md new file mode 100644 index 0000000..0345c9e --- /dev/null +++ b/docs/Model/ErrorPhonebook.md @@ -0,0 +1,9 @@ +# # ErrorPhonebook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**errors** | [**\Messente\Api\Model\ErrorItemPhonebook[]**](ErrorItemPhonebook.md) | An array of errors | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorStatistics.md b/docs/Model/ErrorStatistics.md new file mode 100644 index 0000000..3dba2a6 --- /dev/null +++ b/docs/Model/ErrorStatistics.md @@ -0,0 +1,9 @@ +# # ErrorStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**errors** | [**\Messente\Api\Model\ErrorItemStatistics[]**](ErrorItemStatistics.md) | An array of errors | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorTitleOmnichannel.md b/docs/Model/ErrorTitleOmnichannel.md new file mode 100644 index 0000000..25938a8 --- /dev/null +++ b/docs/Model/ErrorTitleOmnichannel.md @@ -0,0 +1,8 @@ +# # ErrorTitleOmnichannel + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ErrorTitlePhonebook.md b/docs/Model/ErrorTitlePhonebook.md new file mode 100644 index 0000000..9f4f024 --- /dev/null +++ b/docs/Model/ErrorTitlePhonebook.md @@ -0,0 +1,8 @@ +# # ErrorTitlePhonebook + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/FetchBlacklistSuccess.md b/docs/Model/FetchBlacklistSuccess.md new file mode 100644 index 0000000..36a7fef --- /dev/null +++ b/docs/Model/FetchBlacklistSuccess.md @@ -0,0 +1,9 @@ +# # FetchBlacklistSuccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phoneNumbers** | **string[]** | Array of unique phone numbers | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupEnvelope.md b/docs/Model/GroupEnvelope.md new file mode 100644 index 0000000..ed34926 --- /dev/null +++ b/docs/Model/GroupEnvelope.md @@ -0,0 +1,9 @@ +# # GroupEnvelope + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**group** | [**\Messente\Api\Model\GroupResponseFields**](GroupResponseFields.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupListEnvelope.md b/docs/Model/GroupListEnvelope.md new file mode 100644 index 0000000..7244a7a --- /dev/null +++ b/docs/Model/GroupListEnvelope.md @@ -0,0 +1,9 @@ +# # GroupListEnvelope + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**groups** | [**\Messente\Api\Model\GroupResponseFields[]**](GroupResponseFields.md) | An array of groups | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupName.md b/docs/Model/GroupName.md new file mode 100644 index 0000000..d97a1f0 --- /dev/null +++ b/docs/Model/GroupName.md @@ -0,0 +1,9 @@ +# # GroupName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the group | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/GroupResponseFields.md b/docs/Model/GroupResponseFields.md new file mode 100644 index 0000000..c08e03e --- /dev/null +++ b/docs/Model/GroupResponseFields.md @@ -0,0 +1,12 @@ +# # GroupResponseFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Id string in UUID format | +**name** | **string** | The name of the group | +**createdOn** | **string** | When the group was created | [optional] +**contactsCount** | **int** | The count of contacts in the group | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MessageResult.md b/docs/Model/MessageResult.md new file mode 100644 index 0000000..b8a4036 --- /dev/null +++ b/docs/Model/MessageResult.md @@ -0,0 +1,11 @@ +# # MessageResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messageId** | **string** | Unique identifier for the message | +**channel** | [**\Messente\Api\Model\Channel**](Channel.md) | | +**sender** | **string** | Sender that was used for the message | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/MobileNetwork.md b/docs/Model/MobileNetwork.md new file mode 100644 index 0000000..f0529f2 --- /dev/null +++ b/docs/Model/MobileNetwork.md @@ -0,0 +1,13 @@ +# # MobileNetwork + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mccmnc** | **string** | Mobile country and mobile network code | [optional] +**networkName** | **string** | Mobile network name | [optional] +**countryName** | **string** | Country name | [optional] +**countryPrefix** | **string** | Country prefix | [optional] +**countryCode** | **string** | Country code | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NumberToBlacklist.md b/docs/Model/NumberToBlacklist.md new file mode 100644 index 0000000..6b1906a --- /dev/null +++ b/docs/Model/NumberToBlacklist.md @@ -0,0 +1,9 @@ +# # NumberToBlacklist + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**phoneNumber** | **string** | Phone number in e.164 format | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/NumbersToInvestigate.md b/docs/Model/NumbersToInvestigate.md new file mode 100644 index 0000000..705faae --- /dev/null +++ b/docs/Model/NumbersToInvestigate.md @@ -0,0 +1,9 @@ +# # NumbersToInvestigate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**numbers** | **string[]** | A list of phone numbers. Max 10 numbers per request | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OmniMessageCreateSuccessResponse.md b/docs/Model/OmniMessageCreateSuccessResponse.md new file mode 100644 index 0000000..6177048 --- /dev/null +++ b/docs/Model/OmniMessageCreateSuccessResponse.md @@ -0,0 +1,11 @@ +# # OmniMessageCreateSuccessResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**\Messente\Api\Model\MessageResult[]**](MessageResult.md) | List of messages that compose the omnimessage | +**to** | **string** | Phone number in e.164 format | +**omnimessageId** | **string** | Unique identifier for the omnimessage | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Omnimessage.md b/docs/Model/Omnimessage.md new file mode 100644 index 0000000..b5d8079 --- /dev/null +++ b/docs/Model/Omnimessage.md @@ -0,0 +1,14 @@ +# # Omnimessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**to** | **string** | Phone number in e.164 format | +**messages** | [**\Messente\Api\Model\OmnimessageMessagesInner[]**](OmnimessageMessagesInner.md) | An array of messages | +**dlrUrl** | **string** | URL where the delivery report will be sent | [optional] +**textStore** | [**\Messente\Api\Model\TextStore**](TextStore.md) | | [optional] +**timeToSend** | **\DateTime** | Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) | [optional] +**priority** | [**\Messente\Api\Model\Priority**](Priority.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/OmnimessageMessagesInner.md b/docs/Model/OmnimessageMessagesInner.md new file mode 100644 index 0000000..fa0bdf7 --- /dev/null +++ b/docs/Model/OmnimessageMessagesInner.md @@ -0,0 +1,21 @@ +# # OmnimessageMessagesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**text** | **string** | Plaintext content for Telegram | +**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] +**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] +**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] +**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] +**udh** | **string** | hex-encoded string containing SMS UDH | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] +**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Priority.md b/docs/Model/Priority.md new file mode 100644 index 0000000..552ead2 --- /dev/null +++ b/docs/Model/Priority.md @@ -0,0 +1,8 @@ +# # Priority + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SMS.md b/docs/Model/SMS.md new file mode 100644 index 0000000..3558995 --- /dev/null +++ b/docs/Model/SMS.md @@ -0,0 +1,15 @@ +# # SMS + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**text** | **string** | Text content of the SMS | +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] +**udh** | **string** | hex-encoded string containing SMS UDH | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'sms'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReport.md b/docs/Model/StatisticsReport.md new file mode 100644 index 0000000..283b6b7 --- /dev/null +++ b/docs/Model/StatisticsReport.md @@ -0,0 +1,11 @@ +# # StatisticsReport + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totalMessages** | **int** | Sum of all messages | +**totalPrice** | **string** | Price for all messages | +**country** | **string** | Target country of all messages | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReportSettings.md b/docs/Model/StatisticsReportSettings.md new file mode 100644 index 0000000..dc51d8b --- /dev/null +++ b/docs/Model/StatisticsReportSettings.md @@ -0,0 +1,11 @@ +# # StatisticsReportSettings + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**startDate** | **\DateTime** | Start date for the report | +**endDate** | **\DateTime** | End date for the report | +**messageTypes** | **string[]** | Optional list of message types (sms, viber, whatsapp, hlr, telegram) | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/StatisticsReportSuccess.md b/docs/Model/StatisticsReportSuccess.md new file mode 100644 index 0000000..0f78d80 --- /dev/null +++ b/docs/Model/StatisticsReportSuccess.md @@ -0,0 +1,9 @@ +# # StatisticsReportSuccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**reports** | [**\Messente\Api\Model\StatisticsReport[]**](StatisticsReport.md) | Array of report objects | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Status.md b/docs/Model/Status.md new file mode 100644 index 0000000..c462142 --- /dev/null +++ b/docs/Model/Status.md @@ -0,0 +1,8 @@ +# # Status + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SyncNumberLookupResult.md b/docs/Model/SyncNumberLookupResult.md new file mode 100644 index 0000000..38ba91f --- /dev/null +++ b/docs/Model/SyncNumberLookupResult.md @@ -0,0 +1,17 @@ +# # SyncNumberLookupResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**number** | **string** | Phone number in e.164 format | +**roaming** | **bool** | Indicates if a number is roaming | [optional] +**ported** | **bool** | Indicates if a number is ported | [optional] +**roamingNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] +**currentNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] +**originalNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] +**portedNetwork** | [**\Messente\Api\Model\MobileNetwork**](MobileNetwork.md) | | [optional] +**status** | **string** | Status of the phone number | [optional] +**error** | **mixed** | Indicates if any error occurred while handling the request | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SyncNumberLookupSuccess.md b/docs/Model/SyncNumberLookupSuccess.md new file mode 100644 index 0000000..debed8f --- /dev/null +++ b/docs/Model/SyncNumberLookupSuccess.md @@ -0,0 +1,10 @@ +# # SyncNumberLookupSuccess + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**requestId** | **string** | ID of the request | +**result** | [**\Messente\Api\Model\SyncNumberLookupResult[]**](SyncNumberLookupResult.md) | A container for phone number info objects | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Telegram.md b/docs/Model/Telegram.md new file mode 100644 index 0000000..1debeb9 --- /dev/null +++ b/docs/Model/Telegram.md @@ -0,0 +1,15 @@ +# # Telegram + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] +**text** | **string** | Plaintext content for Telegram | [optional] +**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] +**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] +**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/TextStore.md b/docs/Model/TextStore.md new file mode 100644 index 0000000..3b2f6f1 --- /dev/null +++ b/docs/Model/TextStore.md @@ -0,0 +1,8 @@ +# # TextStore + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Viber.md b/docs/Model/Viber.md new file mode 100644 index 0000000..b771b22 --- /dev/null +++ b/docs/Model/Viber.md @@ -0,0 +1,16 @@ +# # Viber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**text** | **string** | Plaintext content for Viber | [optional] +**imageUrl** | **string** | URL for the embedded image Valid combinations: 1) image_url, 2) text, image_url, button_url, button_text | [optional] +**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] +**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'viber'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsApp.md b/docs/Model/WhatsApp.md new file mode 100644 index 0000000..ae5bbdd --- /dev/null +++ b/docs/Model/WhatsApp.md @@ -0,0 +1,13 @@ +# # WhatsApp + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'whatsapp'] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppComponent.md b/docs/Model/WhatsAppComponent.md new file mode 100644 index 0000000..8e0104c --- /dev/null +++ b/docs/Model/WhatsAppComponent.md @@ -0,0 +1,12 @@ +# # WhatsAppComponent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of the component | +**subType** | **string** | Sub-type of the component | [optional] +**index** | **int** | index used to position buttons | [optional] +**parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppCurrency.md b/docs/Model/WhatsAppCurrency.md new file mode 100644 index 0000000..660a79e --- /dev/null +++ b/docs/Model/WhatsAppCurrency.md @@ -0,0 +1,11 @@ +# # WhatsAppCurrency + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fallbackValue** | **string** | Default text if localization fails. | +**code** | **string** | Currency code as defined in ISO 4217. | +**amount1000** | **string** | Amount multiplied by 1000. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppDatetime.md b/docs/Model/WhatsAppDatetime.md new file mode 100644 index 0000000..571a030 --- /dev/null +++ b/docs/Model/WhatsAppDatetime.md @@ -0,0 +1,9 @@ +# # WhatsAppDatetime + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**fallbackValue** | **string** | Default text. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppLanguage.md b/docs/Model/WhatsAppLanguage.md new file mode 100644 index 0000000..d202598 --- /dev/null +++ b/docs/Model/WhatsAppLanguage.md @@ -0,0 +1,10 @@ +# # WhatsAppLanguage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Language code | +**policy** | **string** | Language policy | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppMedia.md b/docs/Model/WhatsAppMedia.md new file mode 100644 index 0000000..085f11c --- /dev/null +++ b/docs/Model/WhatsAppMedia.md @@ -0,0 +1,12 @@ +# # WhatsAppMedia + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The media object ID. Do not use this field when message type is set to text. | [optional] +**link** | **string** | The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. | [optional] +**caption** | **string** | Media asset caption. Do not use with audio or sticker media. | [optional] +**filename** | **string** | Describes the filename for the specific document. Use only with document media. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppParameter.md b/docs/Model/WhatsAppParameter.md new file mode 100644 index 0000000..6cbabae --- /dev/null +++ b/docs/Model/WhatsAppParameter.md @@ -0,0 +1,15 @@ +# # WhatsAppParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of the parameter. | +**text** | **string** | A text. | [optional] +**currency** | [**\Messente\Api\Model\WhatsAppCurrency**](WhatsAppCurrency.md) | | [optional] +**dateTime** | [**\Messente\Api\Model\WhatsAppDatetime**](WhatsAppDatetime.md) | | [optional] +**image** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] +**document** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] +**video** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppTemplate.md b/docs/Model/WhatsAppTemplate.md new file mode 100644 index 0000000..a63f2a3 --- /dev/null +++ b/docs/Model/WhatsAppTemplate.md @@ -0,0 +1,11 @@ +# # WhatsAppTemplate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the template | +**language** | [**\Messente\Api\Model\WhatsAppLanguage**](WhatsAppLanguage.md) | | +**components** | [**\Messente\Api\Model\WhatsAppComponent[]**](WhatsAppComponent.md) | List of template components | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..14bad7f --- /dev/null +++ b/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="messente" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="messente-api-php" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/lib/Api/BlacklistApi.php b/lib/Api/BlacklistApi.php new file mode 100644 index 0000000..bec68a5 --- /dev/null +++ b/lib/Api/BlacklistApi.php @@ -0,0 +1,1300 @@ + [ + 'application/json', + ], + 'deleteFromBlacklist' => [ + 'application/json', + ], + 'fetchBlacklist' => [ + 'application/json', + ], + 'isBlacklisted' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation addToBlacklist + * + * Adds a phone number to the blacklist + * + * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function addToBlacklist($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + { + $this->addToBlacklistWithHttpInfo($numberToBlacklist, $contentType); + } + + /** + * Operation addToBlacklistWithHttpInfo + * + * Adds a phone number to the blacklist + * + * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + { + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addToBlacklistAsync + * + * Adds a phone number to the blacklist + * + * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addToBlacklistAsync($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + { + return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addToBlacklistAsyncWithHttpInfo + * + * Adds a phone number to the blacklist + * + * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + { + $returnType = ''; + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addToBlacklist' + * + * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addToBlacklistRequest($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + { + + // verify the required parameter 'numberToBlacklist' is set + if ($numberToBlacklist === null || (is_array($numberToBlacklist) && count($numberToBlacklist) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $numberToBlacklist when calling addToBlacklist' + ); + } + + + $resourcePath = '/phonebook/blacklist'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($numberToBlacklist)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); + } else { + $httpBody = $numberToBlacklist; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteFromBlacklist + * + * Deletes a phone number from the blacklist + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteFromBlacklist($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + { + $this->deleteFromBlacklistWithHttpInfo($phone, $contentType); + } + + /** + * Operation deleteFromBlacklistWithHttpInfo + * + * Deletes a phone number from the blacklist + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + { + $request = $this->deleteFromBlacklistRequest($phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteFromBlacklistAsync + * + * Deletes a phone number from the blacklist + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteFromBlacklistAsync($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + { + return $this->deleteFromBlacklistAsyncWithHttpInfo($phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteFromBlacklistAsyncWithHttpInfo + * + * Deletes a phone number from the blacklist + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteFromBlacklistAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + { + $returnType = ''; + $request = $this->deleteFromBlacklistRequest($phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteFromBlacklist' + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteFromBlacklistRequest($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling deleteFromBlacklist' + ); + } + + + $resourcePath = '/phonebook/blacklist/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchBlacklist + * + * Returns all blacklisted phone numbers + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchBlacklist(string $contentType = self::contentTypes['fetchBlacklist'][0]) + { + list($response) = $this->fetchBlacklistWithHttpInfo($contentType); + return $response; + } + + /** + * Operation fetchBlacklistWithHttpInfo + * + * Returns all blacklisted phone numbers + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) + { + $request = $this->fetchBlacklistRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\FetchBlacklistSuccess' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\FetchBlacklistSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\FetchBlacklistSuccess', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\FetchBlacklistSuccess', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchBlacklistAsync + * + * Returns all blacklisted phone numbers + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchBlacklistAsync(string $contentType = self::contentTypes['fetchBlacklist'][0]) + { + return $this->fetchBlacklistAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchBlacklistAsyncWithHttpInfo + * + * Returns all blacklisted phone numbers + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchBlacklistAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) + { + $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; + $request = $this->fetchBlacklistRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchBlacklist' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchBlacklistRequest(string $contentType = self::contentTypes['fetchBlacklist'][0]) + { + + + $resourcePath = '/phonebook/blacklist'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation isBlacklisted + * + * Checks if a phone number is blacklisted + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function isBlacklisted($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + { + $this->isBlacklistedWithHttpInfo($phone, $contentType); + } + + /** + * Operation isBlacklistedWithHttpInfo + * + * Checks if a phone number is blacklisted + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function isBlacklistedWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + { + $request = $this->isBlacklistedRequest($phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation isBlacklistedAsync + * + * Checks if a phone number is blacklisted + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function isBlacklistedAsync($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + { + return $this->isBlacklistedAsyncWithHttpInfo($phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation isBlacklistedAsyncWithHttpInfo + * + * Checks if a phone number is blacklisted + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function isBlacklistedAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + { + $returnType = ''; + $request = $this->isBlacklistedRequest($phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'isBlacklisted' + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function isBlacklistedRequest($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling isBlacklisted' + ); + } + + + $resourcePath = '/phonebook/blacklist/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php new file mode 100644 index 0000000..4b8ca37 --- /dev/null +++ b/lib/Api/ContactsApi.php @@ -0,0 +1,3384 @@ + [ + 'application/json', + ], + 'createContact' => [ + 'application/json', + ], + 'deleteContact' => [ + 'application/json', + ], + 'fetchContact' => [ + 'application/json', + ], + 'fetchContactGroups' => [ + 'application/json', + ], + 'fetchContacts' => [ + 'application/json', + ], + 'removeContactFromGroup' => [ + 'application/json', + ], + 'updateContact' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation addContactToGroup + * + * Adds a contact to a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function addContactToGroup($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + { + list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone, $contentType); + return $response; + } + + /** + * Operation addContactToGroupWithHttpInfo + * + * Adds a contact to a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + { + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation addContactToGroupAsync + * + * Adds a contact to a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToGroupAsync($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + { + return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation addContactToGroupAsyncWithHttpInfo + * + * Adds a contact to a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function addContactToGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + { + $returnType = 'object'; + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'addContactToGroup' + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function addContactToGroupRequest($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + { + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupId when calling addContactToGroup' + ); + } + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling addContactToGroup' + ); + } + + + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($groupId !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), + $resourcePath + ); + } + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createContact + * + * Creates a new contact + * + * @param \Messente\Api\Model\ContactFields $contactFields contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function createContact($contactFields, string $contentType = self::contentTypes['createContact'][0]) + { + list($response) = $this->createContactWithHttpInfo($contactFields, $contentType); + return $response; + } + + /** + * Operation createContactWithHttpInfo + * + * Creates a new contact + * + * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function createContactWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) + { + $request = $this->createContactRequest($contactFields, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\ContactEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ContactEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createContactAsync + * + * Creates a new contact + * + * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsync($contactFields, string $contentType = self::contentTypes['createContact'][0]) + { + return $this->createContactAsyncWithHttpInfo($contactFields, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createContactAsyncWithHttpInfo + * + * Creates a new contact + * + * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createContactAsyncWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) + { + $returnType = '\Messente\Api\Model\ContactEnvelope'; + $request = $this->createContactRequest($contactFields, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createContact' + * + * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createContactRequest($contactFields, string $contentType = self::contentTypes['createContact'][0]) + { + + // verify the required parameter 'contactFields' is set + if ($contactFields === null || (is_array($contactFields) && count($contactFields) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contactFields when calling createContact' + ); + } + + + $resourcePath = '/phonebook/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($contactFields)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactFields)); + } else { + $httpBody = $contactFields; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteContact + * + * Deletes a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteContact($phone, string $contentType = self::contentTypes['deleteContact'][0]) + { + $this->deleteContactWithHttpInfo($phone, $contentType); + } + + /** + * Operation deleteContactWithHttpInfo + * + * Deletes a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteContactWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) + { + $request = $this->deleteContactRequest($phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteContactAsync + * + * Deletes a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsync($phone, string $contentType = self::contentTypes['deleteContact'][0]) + { + return $this->deleteContactAsyncWithHttpInfo($phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteContactAsyncWithHttpInfo + * + * Deletes a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) + { + $returnType = ''; + $request = $this->deleteContactRequest($phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteContact' + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteContactRequest($phone, string $contentType = self::contentTypes['deleteContact'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling deleteContact' + ); + } + + + $resourcePath = '/phonebook/contacts/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchContact + * + * Lists a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchContact($phone, string $contentType = self::contentTypes['fetchContact'][0]) + { + list($response) = $this->fetchContactWithHttpInfo($phone, $contentType); + return $response; + } + + /** + * Operation fetchContactWithHttpInfo + * + * Lists a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchContactWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) + { + $request = $this->fetchContactRequest($phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\ContactEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ContactEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchContactAsync + * + * Lists a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactAsync($phone, string $contentType = self::contentTypes['fetchContact'][0]) + { + return $this->fetchContactAsyncWithHttpInfo($phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchContactAsyncWithHttpInfo + * + * Lists a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) + { + $returnType = '\Messente\Api\Model\ContactEnvelope'; + $request = $this->fetchContactRequest($phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchContact' + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchContactRequest($phone, string $contentType = self::contentTypes['fetchContact'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling fetchContact' + ); + } + + + $resourcePath = '/phonebook/contacts/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchContactGroups + * + * Lists groups of a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchContactGroups($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + { + list($response) = $this->fetchContactGroupsWithHttpInfo($phone, $contentType); + return $response; + } + + /** + * Operation fetchContactGroupsWithHttpInfo + * + * Lists groups of a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchContactGroupsWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + { + $request = $this->fetchContactGroupsRequest($phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\GroupListEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupListEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\GroupListEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\GroupListEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchContactGroupsAsync + * + * Lists groups of a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactGroupsAsync($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + { + return $this->fetchContactGroupsAsyncWithHttpInfo($phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchContactGroupsAsyncWithHttpInfo + * + * Lists groups of a contact + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactGroupsAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + { + $returnType = '\Messente\Api\Model\GroupListEnvelope'; + $request = $this->fetchContactGroupsRequest($phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchContactGroups' + * + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchContactGroupsRequest($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling fetchContactGroups' + ); + } + + + $resourcePath = '/phonebook/contacts/{phone}/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchContacts + * + * Returns all contacts + * + * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchContacts($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + { + list($response) = $this->fetchContactsWithHttpInfo($groupIds, $contentType); + return $response; + } + + /** + * Operation fetchContactsWithHttpInfo + * + * Returns all contacts + * + * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchContactsWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + { + $request = $this->fetchContactsRequest($groupIds, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\ContactListEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactListEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\ContactListEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ContactListEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchContactsAsync + * + * Returns all contacts + * + * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactsAsync($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + { + return $this->fetchContactsAsyncWithHttpInfo($groupIds, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchContactsAsyncWithHttpInfo + * + * Returns all contacts + * + * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchContactsAsyncWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + { + $returnType = '\Messente\Api\Model\ContactListEnvelope'; + $request = $this->fetchContactsRequest($groupIds, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchContacts' + * + * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchContactsRequest($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + { + + + + $resourcePath = '/phonebook/contacts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $groupIds, + 'groupIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation removeContactFromGroup + * + * Removes a contact from a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function removeContactFromGroup($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + { + $this->removeContactFromGroupWithHttpInfo($groupId, $phone, $contentType); + } + + /** + * Operation removeContactFromGroupWithHttpInfo + * + * Removes a contact from a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + { + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation removeContactFromGroupAsync + * + * Removes a contact from a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromGroupAsync($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + { + return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation removeContactFromGroupAsyncWithHttpInfo + * + * Removes a contact from a group + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + { + $returnType = ''; + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'removeContactFromGroup' + * + * @param string $groupId String in UUID format (required) + * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function removeContactFromGroupRequest($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + { + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupId when calling removeContactFromGroup' + ); + } + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling removeContactFromGroup' + ); + } + + + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($groupId !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), + $resourcePath + ); + } + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateContact + * + * Updates a contact + * + * @param string $phone A phone number (required) + * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function updateContact($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + { + list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields, $contentType); + return $response; + } + + /** + * Operation updateContactWithHttpInfo + * + * Updates a contact + * + * @param string $phone A phone number (required) + * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + { + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\ContactEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ContactEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\ContactEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ContactEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateContactAsync + * + * Updates a contact + * + * @param string $phone A phone number (required) + * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateContactAsync($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + { + return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateContactAsyncWithHttpInfo + * + * Updates a contact + * + * @param string $phone A phone number (required) + * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + { + $returnType = '\Messente\Api\Model\ContactEnvelope'; + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateContact' + * + * @param string $phone A phone number (required) + * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateContactRequest($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + { + + // verify the required parameter 'phone' is set + if ($phone === null || (is_array($phone) && count($phone) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $phone when calling updateContact' + ); + } + + // verify the required parameter 'contactUpdateFields' is set + if ($contactUpdateFields === null || (is_array($contactUpdateFields) && count($contactUpdateFields) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $contactUpdateFields when calling updateContact' + ); + } + + + $resourcePath = '/phonebook/contacts/{phone}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($phone !== null) { + $resourcePath = str_replace( + '{' . 'phone' . '}', + ObjectSerializer::toPathValue($phone), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($contactUpdateFields)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); + } else { + $httpBody = $contactUpdateFields; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/DeliveryReportApi.php b/lib/Api/DeliveryReportApi.php new file mode 100644 index 0000000..037e7ff --- /dev/null +++ b/lib/Api/DeliveryReportApi.php @@ -0,0 +1,525 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation retrieveDeliveryReport + * + * Retrieves the delivery report for the Omnimessage + * + * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel + */ + public function retrieveDeliveryReport($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + { + list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId, $contentType); + return $response; + } + + /** + * Operation retrieveDeliveryReportWithHttpInfo + * + * Retrieves the delivery report for the Omnimessage + * + * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) + */ + public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + { + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\DeliveryReportResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\DeliveryReportResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\DeliveryReportResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\DeliveryReportResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\DeliveryReportResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation retrieveDeliveryReportAsync + * + * Retrieves the delivery report for the Omnimessage + * + * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function retrieveDeliveryReportAsync($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + { + return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation retrieveDeliveryReportAsyncWithHttpInfo + * + * Retrieves the delivery report for the Omnimessage + * + * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + { + $returnType = '\Messente\Api\Model\DeliveryReportResponse'; + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'retrieveDeliveryReport' + * + * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function retrieveDeliveryReportRequest($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + { + + // verify the required parameter 'omnimessageId' is set + if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $omnimessageId when calling retrieveDeliveryReport' + ); + } + + + $resourcePath = '/omnimessage/{omnimessageId}/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($omnimessageId !== null) { + $resourcePath = str_replace( + '{' . 'omnimessageId' . '}', + ObjectSerializer::toPathValue($omnimessageId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/GroupsApi.php b/lib/Api/GroupsApi.php new file mode 100644 index 0000000..0b4c8e5 --- /dev/null +++ b/lib/Api/GroupsApi.php @@ -0,0 +1,2040 @@ + [ + 'application/json', + ], + 'deleteGroup' => [ + 'application/json', + ], + 'fetchGroup' => [ + 'application/json', + ], + 'fetchGroups' => [ + 'application/json', + ], + 'updateGroup' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createGroup + * + * Creates a new group with the provided name + * + * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function createGroup($groupName, string $contentType = self::contentTypes['createGroup'][0]) + { + list($response) = $this->createGroupWithHttpInfo($groupName, $contentType); + return $response; + } + + /** + * Operation createGroupWithHttpInfo + * + * Creates a new group with the provided name + * + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function createGroupWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) + { + $request = $this->createGroupRequest($groupName, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\GroupEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\GroupEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createGroupAsync + * + * Creates a new group with the provided name + * + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createGroupAsync($groupName, string $contentType = self::contentTypes['createGroup'][0]) + { + return $this->createGroupAsyncWithHttpInfo($groupName, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createGroupAsyncWithHttpInfo + * + * Creates a new group with the provided name + * + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createGroupAsyncWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) + { + $returnType = '\Messente\Api\Model\GroupEnvelope'; + $request = $this->createGroupRequest($groupName, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createGroup' + * + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createGroupRequest($groupName, string $contentType = self::contentTypes['createGroup'][0]) + { + + // verify the required parameter 'groupName' is set + if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupName when calling createGroup' + ); + } + + + $resourcePath = '/phonebook/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($groupName)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); + } else { + $httpBody = $groupName; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteGroup + * + * Deletes a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function deleteGroup($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $this->deleteGroupWithHttpInfo($groupId, $contentType); + } + + /** + * Operation deleteGroupWithHttpInfo + * + * Deletes a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $request = $this->deleteGroupRequest($groupId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteGroupAsync + * + * Deletes a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteGroupAsync($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + { + return $this->deleteGroupAsyncWithHttpInfo($groupId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteGroupAsyncWithHttpInfo + * + * Deletes a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + { + $returnType = ''; + $request = $this->deleteGroupRequest($groupId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteGroup' + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteGroupRequest($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + { + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupId when calling deleteGroup' + ); + } + + + $resourcePath = '/phonebook/groups/{groupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($groupId !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchGroup + * + * Lists a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchGroup($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + { + list($response) = $this->fetchGroupWithHttpInfo($groupId, $contentType); + return $response; + } + + /** + * Operation fetchGroupWithHttpInfo + * + * Lists a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + { + $request = $this->fetchGroupRequest($groupId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\GroupEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\GroupEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchGroupAsync + * + * Lists a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchGroupAsync($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + { + return $this->fetchGroupAsyncWithHttpInfo($groupId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchGroupAsyncWithHttpInfo + * + * Lists a group + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + { + $returnType = '\Messente\Api\Model\GroupEnvelope'; + $request = $this->fetchGroupRequest($groupId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchGroup' + * + * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchGroupRequest($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + { + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupId when calling fetchGroup' + ); + } + + + $resourcePath = '/phonebook/groups/{groupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($groupId !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fetchGroups + * + * Returns all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function fetchGroups(string $contentType = self::contentTypes['fetchGroups'][0]) + { + list($response) = $this->fetchGroupsWithHttpInfo($contentType); + return $response; + } + + /** + * Operation fetchGroupsWithHttpInfo + * + * Returns all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) + { + $request = $this->fetchGroupsRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\GroupListEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupListEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\GroupListEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\GroupListEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchGroupsAsync + * + * Returns all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchGroupsAsync(string $contentType = self::contentTypes['fetchGroups'][0]) + { + return $this->fetchGroupsAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchGroupsAsyncWithHttpInfo + * + * Returns all groups + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) + { + $returnType = '\Messente\Api\Model\GroupListEnvelope'; + $request = $this->fetchGroupsRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchGroups' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchGroupsRequest(string $contentType = self::contentTypes['fetchGroups'][0]) + { + + + $resourcePath = '/phonebook/groups'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateGroup + * + * Updates a group with the provided name + * + * @param string $groupId String in UUID format (required) + * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook + */ + public function updateGroup($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + { + list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName, $contentType); + return $response; + } + + /** + * Operation updateGroupWithHttpInfo + * + * Updates a group with the provided name + * + * @param string $groupId String in UUID format (required) + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) + */ + public function updateGroupWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + { + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\GroupEnvelope' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\GroupEnvelope', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + default: + if ('\Messente\Api\Model\ErrorPhonebook' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorPhonebook', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\GroupEnvelope'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\GroupEnvelope', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorPhonebook', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateGroupAsync + * + * Updates a group with the provided name + * + * @param string $groupId String in UUID format (required) + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateGroupAsync($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + { + return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateGroupAsyncWithHttpInfo + * + * Updates a group with the provided name + * + * @param string $groupId String in UUID format (required) + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateGroupAsyncWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + { + $returnType = '\Messente\Api\Model\GroupEnvelope'; + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateGroup' + * + * @param string $groupId String in UUID format (required) + * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateGroupRequest($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + { + + // verify the required parameter 'groupId' is set + if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupId when calling updateGroup' + ); + } + + // verify the required parameter 'groupName' is set + if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $groupName when calling updateGroup' + ); + } + + + $resourcePath = '/phonebook/groups/{groupId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($groupId !== null) { + $resourcePath = str_replace( + '{' . 'groupId' . '}', + ObjectSerializer::toPathValue($groupId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($groupName)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); + } else { + $httpBody = $groupName; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/NumberLookupApi.php b/lib/Api/NumberLookupApi.php new file mode 100644 index 0000000..4bea0f0 --- /dev/null +++ b/lib/Api/NumberLookupApi.php @@ -0,0 +1,559 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation fetchInfo + * + * Requests info about phone numbers + * + * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup + */ + public function fetchInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + { + list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate, $contentType); + return $response; + } + + /** + * Operation fetchInfoWithHttpInfo + * + * Requests info about phone numbers + * + * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup, HTTP status code, HTTP response headers (array of strings) + */ + public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + { + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\SyncNumberLookupSuccess' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\SyncNumberLookupSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\SyncNumberLookupSuccess', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 402: + if ('\Messente\Api\Model\ErrorNumberLookup' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorNumberLookup', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\SyncNumberLookupSuccess', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorNumberLookup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorNumberLookup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 402: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorNumberLookup', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fetchInfoAsync + * + * Requests info about phone numbers + * + * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchInfoAsync($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + { + return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fetchInfoAsyncWithHttpInfo + * + * Requests info about phone numbers + * + * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + { + $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fetchInfo' + * + * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function fetchInfoRequest($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + { + + // verify the required parameter 'numbersToInvestigate' is set + if ($numbersToInvestigate === null || (is_array($numbersToInvestigate) && count($numbersToInvestigate) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $numbersToInvestigate when calling fetchInfo' + ); + } + + + $resourcePath = '/hlr/sync'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($numbersToInvestigate)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); + } else { + $httpBody = $numbersToInvestigate; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php new file mode 100644 index 0000000..1cc0442 --- /dev/null +++ b/lib/Api/OmnimessageApi.php @@ -0,0 +1,908 @@ + [ + 'application/json', + ], + 'sendOmnimessage' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation cancelScheduledMessage + * + * Cancels a scheduled Omnimessage + * + * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel + */ + public function cancelScheduledMessage($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + { + list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId, $contentType); + return $response; + } + + /** + * Operation cancelScheduledMessageWithHttpInfo + * + * Cancels a scheduled Omnimessage + * + * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) + */ + public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + { + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 202: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cancelScheduledMessageAsync + * + * Cancels a scheduled Omnimessage + * + * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelScheduledMessageAsync($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + { + return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cancelScheduledMessageAsyncWithHttpInfo + * + * Cancels a scheduled Omnimessage + * + * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + { + $returnType = 'object'; + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cancelScheduledMessage' + * + * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function cancelScheduledMessageRequest($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + { + + // verify the required parameter 'omnimessageId' is set + if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $omnimessageId when calling cancelScheduledMessage' + ); + } + + + $resourcePath = '/omnimessage/{omnimessageId}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($omnimessageId !== null) { + $resourcePath = str_replace( + '{' . 'omnimessageId' . '}', + ObjectSerializer::toPathValue($omnimessageId), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation sendOmnimessage + * + * Sends an Omnimessage + * + * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel + */ + public function sendOmnimessage($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + { + list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage, $contentType); + return $response; + } + + /** + * Operation sendOmnimessageWithHttpInfo + * + * Sends an Omnimessage + * + * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) + */ + public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + { + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\OmniMessageCreateSuccessResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\OmniMessageCreateSuccessResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendOmnimessageAsync + * + * Sends an Omnimessage + * + * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendOmnimessageAsync($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + { + return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendOmnimessageAsyncWithHttpInfo + * + * Sends an Omnimessage + * + * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendOmnimessageAsyncWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + { + $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendOmnimessage' + * + * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendOmnimessageRequest($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + { + + // verify the required parameter 'omnimessage' is set + if ($omnimessage === null || (is_array($omnimessage) && count($omnimessage) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $omnimessage when calling sendOmnimessage' + ); + } + + + $resourcePath = '/omnimessage'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($omnimessage)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omnimessage)); + } else { + $httpBody = $omnimessage; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/StatisticsApi.php b/lib/Api/StatisticsApi.php new file mode 100644 index 0000000..0d70d5a --- /dev/null +++ b/lib/Api/StatisticsApi.php @@ -0,0 +1,594 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createStatisticsReport + * + * Requests statistics reports for each country + * + * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics + */ + public function createStatisticsReport($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + { + list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings, $contentType); + return $response; + } + + /** + * Operation createStatisticsReportWithHttpInfo + * + * Requests statistics reports for each country + * + * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics, HTTP status code, HTTP response headers (array of strings) + */ + public function createStatisticsReportWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + { + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Messente\Api\Model\StatisticsReportSuccess' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\StatisticsReportSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\StatisticsReportSuccess', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 500: + if ('\Messente\Api\Model\ErrorStatistics' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorStatistics', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\StatisticsReportSuccess', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 500: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorStatistics', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createStatisticsReportAsync + * + * Requests statistics reports for each country + * + * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createStatisticsReportAsync($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + { + return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createStatisticsReportAsyncWithHttpInfo + * + * Requests statistics reports for each country + * + * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + { + $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createStatisticsReport' + * + * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createStatisticsReportRequest($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + { + + // verify the required parameter 'statisticsReportSettings' is set + if ($statisticsReportSettings === null || (is_array($statisticsReportSettings) && count($statisticsReportSettings) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $statisticsReportSettings when calling createStatisticsReport' + ); + } + + + $resourcePath = '/statistics/reports'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($statisticsReportSettings)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); + } else { + $httpBody = $statisticsReportSettings; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..a61f0f5 --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,120 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..a4a08cd --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,533 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Messente\Api) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "https://api.messente.com/v1", + "description" => "No description provided", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..d28cb40 --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,246 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php new file mode 100644 index 0000000..e48e7d4 --- /dev/null +++ b/lib/Model/Channel.php @@ -0,0 +1,70 @@ + + */ +class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactEnvelope'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contact' => '\Messente\Api\Model\ContactResponseFields' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contact' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contact' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'contact' => 'contact' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contact' => 'setContact' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contact' => 'getContact' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contact', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets contact + * + * @return \Messente\Api\Model\ContactResponseFields|null + */ + public function getContact() + { + return $this->container['contact']; + } + + /** + * Sets contact + * + * @param \Messente\Api\Model\ContactResponseFields|null $contact contact + * + * @return self + */ + public function setContact($contact) + { + if (is_null($contact)) { + throw new \InvalidArgumentException('non-nullable contact cannot be null'); + } + $this->container['contact'] = $contact; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ContactFields.php b/lib/Model/ContactFields.php new file mode 100644 index 0000000..971bc81 --- /dev/null +++ b/lib/Model/ContactFields.php @@ -0,0 +1,783 @@ + + */ +class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactFields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phoneNumber' => 'string', + 'email' => 'string', + 'firstName' => 'string', + 'lastName' => 'string', + 'company' => 'string', + 'title' => 'string', + 'custom' => 'string', + 'custom2' => 'string', + 'custom3' => 'string', + 'custom4' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phoneNumber' => null, + 'email' => null, + 'firstName' => null, + 'lastName' => null, + 'company' => null, + 'title' => null, + 'custom' => null, + 'custom2' => null, + 'custom3' => null, + 'custom4' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phoneNumber' => 'phoneNumber', + 'email' => 'email', + 'firstName' => 'firstName', + 'lastName' => 'lastName', + 'company' => 'company', + 'title' => 'title', + 'custom' => 'custom', + 'custom2' => 'custom2', + 'custom3' => 'custom3', + 'custom4' => 'custom4' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phoneNumber' => 'setPhoneNumber', + 'email' => 'setEmail', + 'firstName' => 'setFirstName', + 'lastName' => 'setLastName', + 'company' => 'setCompany', + 'title' => 'setTitle', + 'custom' => 'setCustom', + 'custom2' => 'setCustom2', + 'custom3' => 'setCustom3', + 'custom4' => 'setCustom4' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phoneNumber' => 'getPhoneNumber', + 'email' => 'getEmail', + 'firstName' => 'getFirstName', + 'lastName' => 'getLastName', + 'company' => 'getCompany', + 'title' => 'getTitle', + 'custom' => 'getCustom', + 'custom2' => 'getCustom2', + 'custom3' => 'getCustom3', + 'custom4' => 'getCustom4' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['phoneNumber'] === null) { + $invalidProperties[] = "'phoneNumber' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phoneNumber + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phoneNumber']; + } + + /** + * Sets phoneNumber + * + * @param string $phoneNumber Phone number in e.164 format + * + * @return self + */ + public function setPhoneNumber($phoneNumber) + { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } + $this->container['phoneNumber'] = $phoneNumber; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email of the contact + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets firstName + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['firstName']; + } + + /** + * Sets firstName + * + * @param string|null $firstName The first name of the contact + * + * @return self + */ + public function setFirstName($firstName) + { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['firstName'] = $firstName; + + return $this; + } + + /** + * Gets lastName + * + * @return string|null + */ + public function getLastName() + { + return $this->container['lastName']; + } + + /** + * Sets lastName + * + * @param string|null $lastName The last name of the contact + * + * @return self + */ + public function setLastName($lastName) + { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lastName'] = $lastName; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company The company of the contact + * + * @return self + */ + public function setCompany($company) + { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the contact + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets custom + * + * @return string|null + */ + public function getCustom() + { + return $this->container['custom']; + } + + /** + * Sets custom + * + * @param string|null $custom The first custom field + * + * @return self + */ + public function setCustom($custom) + { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom'] = $custom; + + return $this; + } + + /** + * Gets custom2 + * + * @return string|null + */ + public function getCustom2() + { + return $this->container['custom2']; + } + + /** + * Sets custom2 + * + * @param string|null $custom2 The second custom field + * + * @return self + */ + public function setCustom2($custom2) + { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom2'] = $custom2; + + return $this; + } + + /** + * Gets custom3 + * + * @return string|null + */ + public function getCustom3() + { + return $this->container['custom3']; + } + + /** + * Sets custom3 + * + * @param string|null $custom3 The third custom field + * + * @return self + */ + public function setCustom3($custom3) + { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom3'] = $custom3; + + return $this; + } + + /** + * Gets custom4 + * + * @return string|null + */ + public function getCustom4() + { + return $this->container['custom4']; + } + + /** + * Sets custom4 + * + * @param string|null $custom4 The fourth custom field + * + * @return self + */ + public function setCustom4($custom4) + { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom4'] = $custom4; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ContactListEnvelope.php b/lib/Model/ContactListEnvelope.php new file mode 100644 index 0000000..81b91ea --- /dev/null +++ b/lib/Model/ContactListEnvelope.php @@ -0,0 +1,413 @@ + + */ +class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactListEnvelope'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contacts' => '\Messente\Api\Model\ContactResponseFields[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contacts' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contacts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'contacts' => 'contacts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contacts' => 'setContacts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contacts' => 'getContacts' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contacts', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets contacts + * + * @return \Messente\Api\Model\ContactResponseFields[]|null + */ + public function getContacts() + { + return $this->container['contacts']; + } + + /** + * Sets contacts + * + * @param \Messente\Api\Model\ContactResponseFields[]|null $contacts An array of contacts + * + * @return self + */ + public function setContacts($contacts) + { + if (is_null($contacts)) { + throw new \InvalidArgumentException('non-nullable contacts cannot be null'); + } + + + $this->container['contacts'] = $contacts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ContactResponseFields.php b/lib/Model/ContactResponseFields.php new file mode 100644 index 0000000..06a560d --- /dev/null +++ b/lib/Model/ContactResponseFields.php @@ -0,0 +1,821 @@ + + */ +class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactResponseFields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phoneNumber' => 'string', + 'email' => 'string', + 'firstName' => 'string', + 'lastName' => 'string', + 'company' => 'string', + 'title' => 'string', + 'custom' => 'string', + 'custom2' => 'string', + 'custom3' => 'string', + 'custom4' => 'string', + 'scheduledDeletionDate' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phoneNumber' => null, + 'email' => null, + 'firstName' => null, + 'lastName' => null, + 'company' => null, + 'title' => null, + 'custom' => null, + 'custom2' => null, + 'custom3' => null, + 'custom4' => null, + 'scheduledDeletionDate' => 'date' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true, + 'scheduledDeletionDate' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phoneNumber' => 'phoneNumber', + 'email' => 'email', + 'firstName' => 'firstName', + 'lastName' => 'lastName', + 'company' => 'company', + 'title' => 'title', + 'custom' => 'custom', + 'custom2' => 'custom2', + 'custom3' => 'custom3', + 'custom4' => 'custom4', + 'scheduledDeletionDate' => 'scheduledDeletionDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phoneNumber' => 'setPhoneNumber', + 'email' => 'setEmail', + 'firstName' => 'setFirstName', + 'lastName' => 'setLastName', + 'company' => 'setCompany', + 'title' => 'setTitle', + 'custom' => 'setCustom', + 'custom2' => 'setCustom2', + 'custom3' => 'setCustom3', + 'custom4' => 'setCustom4', + 'scheduledDeletionDate' => 'setScheduledDeletionDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phoneNumber' => 'getPhoneNumber', + 'email' => 'getEmail', + 'firstName' => 'getFirstName', + 'lastName' => 'getLastName', + 'company' => 'getCompany', + 'title' => 'getTitle', + 'custom' => 'getCustom', + 'custom2' => 'getCustom2', + 'custom3' => 'getCustom3', + 'custom4' => 'getCustom4', + 'scheduledDeletionDate' => 'getScheduledDeletionDate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + $this->setIfExists('scheduledDeletionDate', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phoneNumber + * + * @return string|null + */ + public function getPhoneNumber() + { + return $this->container['phoneNumber']; + } + + /** + * Sets phoneNumber + * + * @param string|null $phoneNumber Phone number in e.164 format + * + * @return self + */ + public function setPhoneNumber($phoneNumber) + { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } + $this->container['phoneNumber'] = $phoneNumber; + + return $this; + } + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email of the contact + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets firstName + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['firstName']; + } + + /** + * Sets firstName + * + * @param string|null $firstName The first name of the contact + * + * @return self + */ + public function setFirstName($firstName) + { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['firstName'] = $firstName; + + return $this; + } + + /** + * Gets lastName + * + * @return string|null + */ + public function getLastName() + { + return $this->container['lastName']; + } + + /** + * Sets lastName + * + * @param string|null $lastName The last name of the contact + * + * @return self + */ + public function setLastName($lastName) + { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lastName'] = $lastName; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company The company of the contact + * + * @return self + */ + public function setCompany($company) + { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the contact + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets custom + * + * @return string|null + */ + public function getCustom() + { + return $this->container['custom']; + } + + /** + * Sets custom + * + * @param string|null $custom The first custom field + * + * @return self + */ + public function setCustom($custom) + { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom'] = $custom; + + return $this; + } + + /** + * Gets custom2 + * + * @return string|null + */ + public function getCustom2() + { + return $this->container['custom2']; + } + + /** + * Sets custom2 + * + * @param string|null $custom2 The second custom field + * + * @return self + */ + public function setCustom2($custom2) + { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom2'] = $custom2; + + return $this; + } + + /** + * Gets custom3 + * + * @return string|null + */ + public function getCustom3() + { + return $this->container['custom3']; + } + + /** + * Sets custom3 + * + * @param string|null $custom3 The third custom field + * + * @return self + */ + public function setCustom3($custom3) + { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom3'] = $custom3; + + return $this; + } + + /** + * Gets custom4 + * + * @return string|null + */ + public function getCustom4() + { + return $this->container['custom4']; + } + + /** + * Sets custom4 + * + * @param string|null $custom4 The fourth custom field + * + * @return self + */ + public function setCustom4($custom4) + { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom4'] = $custom4; + + return $this; + } + + /** + * Gets scheduledDeletionDate + * + * @return \DateTime|null + */ + public function getScheduledDeletionDate() + { + return $this->container['scheduledDeletionDate']; + } + + /** + * Sets scheduledDeletionDate + * + * @param \DateTime|null $scheduledDeletionDate The date in ISO 8601 format, YYYY-MM-DD, on which the contact is going to be deleted because it has not belonged to a group for 30 days + * + * @return self + */ + public function setScheduledDeletionDate($scheduledDeletionDate) + { + if (is_null($scheduledDeletionDate)) { + array_push($this->openAPINullablesSetToNull, 'scheduledDeletionDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scheduledDeletionDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['scheduledDeletionDate'] = $scheduledDeletionDate; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ContactUpdateFields.php b/lib/Model/ContactUpdateFields.php new file mode 100644 index 0000000..8f2b5a5 --- /dev/null +++ b/lib/Model/ContactUpdateFields.php @@ -0,0 +1,746 @@ + + */ +class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ContactUpdateFields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'email' => 'string', + 'firstName' => 'string', + 'lastName' => 'string', + 'company' => 'string', + 'title' => 'string', + 'custom' => 'string', + 'custom2' => 'string', + 'custom3' => 'string', + 'custom4' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'email' => null, + 'firstName' => null, + 'lastName' => null, + 'company' => null, + 'title' => null, + 'custom' => null, + 'custom2' => null, + 'custom3' => null, + 'custom4' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'email' => 'email', + 'firstName' => 'firstName', + 'lastName' => 'lastName', + 'company' => 'company', + 'title' => 'title', + 'custom' => 'custom', + 'custom2' => 'custom2', + 'custom3' => 'custom3', + 'custom4' => 'custom4' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'email' => 'setEmail', + 'firstName' => 'setFirstName', + 'lastName' => 'setLastName', + 'company' => 'setCompany', + 'title' => 'setTitle', + 'custom' => 'setCustom', + 'custom2' => 'setCustom2', + 'custom3' => 'setCustom3', + 'custom4' => 'setCustom4' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'email' => 'getEmail', + 'firstName' => 'getFirstName', + 'lastName' => 'getLastName', + 'company' => 'getCompany', + 'title' => 'getTitle', + 'custom' => 'getCustom', + 'custom2' => 'getCustom2', + 'custom3' => 'getCustom3', + 'custom4' => 'getCustom4' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets email + * + * @return string|null + */ + public function getEmail() + { + return $this->container['email']; + } + + /** + * Sets email + * + * @param string|null $email The email of the contact + * + * @return self + */ + public function setEmail($email) + { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['email'] = $email; + + return $this; + } + + /** + * Gets firstName + * + * @return string|null + */ + public function getFirstName() + { + return $this->container['firstName']; + } + + /** + * Sets firstName + * + * @param string|null $firstName The first name of the contact + * + * @return self + */ + public function setFirstName($firstName) + { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['firstName'] = $firstName; + + return $this; + } + + /** + * Gets lastName + * + * @return string|null + */ + public function getLastName() + { + return $this->container['lastName']; + } + + /** + * Sets lastName + * + * @param string|null $lastName The last name of the contact + * + * @return self + */ + public function setLastName($lastName) + { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['lastName'] = $lastName; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company The company of the contact + * + * @return self + */ + public function setCompany($company) + { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title The title of the contact + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets custom + * + * @return string|null + */ + public function getCustom() + { + return $this->container['custom']; + } + + /** + * Sets custom + * + * @param string|null $custom The first custom field + * + * @return self + */ + public function setCustom($custom) + { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom'] = $custom; + + return $this; + } + + /** + * Gets custom2 + * + * @return string|null + */ + public function getCustom2() + { + return $this->container['custom2']; + } + + /** + * Sets custom2 + * + * @param string|null $custom2 The second custom field + * + * @return self + */ + public function setCustom2($custom2) + { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom2'] = $custom2; + + return $this; + } + + /** + * Gets custom3 + * + * @return string|null + */ + public function getCustom3() + { + return $this->container['custom3']; + } + + /** + * Sets custom3 + * + * @param string|null $custom3 The third custom field + * + * @return self + */ + public function setCustom3($custom3) + { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom3'] = $custom3; + + return $this; + } + + /** + * Gets custom4 + * + * @return string|null + */ + public function getCustom4() + { + return $this->container['custom4']; + } + + /** + * Sets custom4 + * + * @param string|null $custom4 The fourth custom field + * + * @return self + */ + public function setCustom4($custom4) + { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['custom4'] = $custom4; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/DeliveryReportResponse.php b/lib/Model/DeliveryReportResponse.php new file mode 100644 index 0000000..39c14ed --- /dev/null +++ b/lib/Model/DeliveryReportResponse.php @@ -0,0 +1,488 @@ + + */ +class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeliveryReportResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'statuses' => '\Messente\Api\Model\DeliveryResult[]', + 'to' => 'string', + 'omnimessageId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'statuses' => null, + 'to' => null, + 'omnimessageId' => 'UUID' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'statuses' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'statuses' => 'statuses', + 'to' => 'to', + 'omnimessageId' => 'omnimessage_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'statuses' => 'setStatuses', + 'to' => 'setTo', + 'omnimessageId' => 'setOmnimessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'statuses' => 'getStatuses', + 'to' => 'getTo', + 'omnimessageId' => 'getOmnimessageId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('statuses', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['statuses'] === null) { + $invalidProperties[] = "'statuses' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['omnimessageId'] === null) { + $invalidProperties[] = "'omnimessageId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets statuses + * + * @return \Messente\Api\Model\DeliveryResult[] + */ + public function getStatuses() + { + return $this->container['statuses']; + } + + /** + * Sets statuses + * + * @param \Messente\Api\Model\DeliveryResult[] $statuses Contains the delivery reports for each channel, ordered by send order + * + * @return self + */ + public function setStatuses($statuses) + { + if (is_null($statuses)) { + throw new \InvalidArgumentException('non-nullable statuses cannot be null'); + } + $this->container['statuses'] = $statuses; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Phone number in e.164 format + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets omnimessageId + * + * @return string + */ + public function getOmnimessageId() + { + return $this->container['omnimessageId']; + } + + /** + * Sets omnimessageId + * + * @param string $omnimessageId Unique identifier for the omnimessage + * + * @return self + */ + public function setOmnimessageId($omnimessageId) + { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } + $this->container['omnimessageId'] = $omnimessageId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/DeliveryResult.php b/lib/Model/DeliveryResult.php new file mode 100644 index 0000000..09858a8 --- /dev/null +++ b/lib/Model/DeliveryResult.php @@ -0,0 +1,588 @@ + + */ +class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DeliveryResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => '\Messente\Api\Model\Status', + 'channel' => '\Messente\Api\Model\Channel', + 'messageId' => 'string', + 'error' => 'string', + 'err' => '\Messente\Api\Model\ErrorCodeOmnichannelMachine', + 'timestamp' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'channel' => null, + 'messageId' => 'UUID', + 'error' => null, + 'err' => null, + 'timestamp' => 'date-time' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'channel' => false, + 'messageId' => false, + 'error' => true, + 'err' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'channel' => 'channel', + 'messageId' => 'message_id', + 'error' => 'error', + 'err' => 'err', + 'timestamp' => 'timestamp' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'channel' => 'setChannel', + 'messageId' => 'setMessageId', + 'error' => 'setError', + 'err' => 'setErr', + 'timestamp' => 'setTimestamp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'channel' => 'getChannel', + 'messageId' => 'getMessageId', + 'error' => 'getError', + 'err' => 'getErr', + 'timestamp' => 'getTimestamp' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('err', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets status + * + * @return \Messente\Api\Model\Status|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param \Messente\Api\Model\Status|null $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets channel + * + * @return \Messente\Api\Model\Channel|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Messente\Api\Model\Channel|null $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets messageId + * + * @return string|null + */ + public function getMessageId() + { + return $this->container['messageId']; + } + + /** + * Sets messageId + * + * @param string|null $messageId Unique identifier for the message + * + * @return self + */ + public function setMessageId($messageId) + { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } + $this->container['messageId'] = $messageId; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Human-readable description of what went wrong, *null* in case of success or if the message has not been processed yet + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + + /** + * Gets err + * + * @return \Messente\Api\Model\ErrorCodeOmnichannelMachine|null + */ + public function getErr() + { + return $this->container['err']; + } + + /** + * Sets err + * + * @param \Messente\Api\Model\ErrorCodeOmnichannelMachine|null $err err + * + * @return self + */ + public function setErr($err) + { + if (is_null($err)) { + throw new \InvalidArgumentException('non-nullable err cannot be null'); + } + $this->container['err'] = $err; + + return $this; + } + + /** + * Gets timestamp + * + * @return \DateTime|null + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param \DateTime|null $timestamp When this status was received by Omnichannel API + * + * @return self + */ + public function setTimestamp($timestamp) + { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } + $this->container['timestamp'] = $timestamp; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorCodeOmnichannel.php b/lib/Model/ErrorCodeOmnichannel.php new file mode 100644 index 0000000..51e6e9c --- /dev/null +++ b/lib/Model/ErrorCodeOmnichannel.php @@ -0,0 +1,79 @@ + + */ +class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorItemNumberLookup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'error' => '\Messente\Api\Model\ErrorItemNumberLookupError' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['error'] === null) { + $invalidProperties[] = "'error' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets error + * + * @return \Messente\Api\Model\ErrorItemNumberLookupError + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param \Messente\Api\Model\ErrorItemNumberLookupError $error error + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorItemNumberLookupError.php b/lib/Model/ErrorItemNumberLookupError.php new file mode 100644 index 0000000..54436a2 --- /dev/null +++ b/lib/Model/ErrorItemNumberLookupError.php @@ -0,0 +1,467 @@ + + */ +class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorItemNumberLookup_error'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'description' => 'string', + 'code' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'description' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'description' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if (($this->container['code'] > 106)) { + $invalidProperties[] = "invalid value for 'code', must be smaller than or equal to 106."; + } + + if (($this->container['code'] < 101)) { + $invalidProperties[] = "invalid value for 'code', must be bigger than or equal to 101."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description Error description + * + * @return self + */ + public function setDescription($description) + { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets code + * + * @return int + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param int $code Matches the following error title. This field is a constant * 101 - Unauthorized * 102 - Invalid arguments or parameters * 103 - Server error * 104 - Crediting error #1 * 105 - Crediting error #2 * 106 - Client error + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + + if (($code > 106)) { + throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be smaller than or equal to 106.'); + } + if (($code < 101)) { + throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be bigger than or equal to 101.'); + } + + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorItemOmnichannel.php b/lib/Model/ErrorItemOmnichannel.php new file mode 100644 index 0000000..afd0fc5 --- /dev/null +++ b/lib/Model/ErrorItemOmnichannel.php @@ -0,0 +1,532 @@ + + */ +class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorItemOmnichannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => '\Messente\Api\Model\ErrorTitleOmnichannel', + 'detail' => 'string', + 'code' => '\Messente\Api\Model\ErrorCodeOmnichannel', + 'source' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'detail' => null, + 'code' => null, + 'source' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false, + 'source' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'title' => 'title', + 'detail' => 'detail', + 'code' => 'code', + 'source' => 'source' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'detail' => 'setDetail', + 'code' => 'setCode', + 'source' => 'setSource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'detail' => 'getDetail', + 'code' => 'getCode', + 'source' => 'getSource' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['detail'] === null) { + $invalidProperties[] = "'detail' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['source'] === null) { + $invalidProperties[] = "'source' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return \Messente\Api\Model\ErrorTitleOmnichannel + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param \Messente\Api\Model\ErrorTitleOmnichannel $title title + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets detail + * + * @return string + */ + public function getDetail() + { + return $this->container['detail']; + } + + /** + * Sets detail + * + * @param string $detail Free form more detailed description of the error + * + * @return self + */ + public function setDetail($detail) + { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } + $this->container['detail'] = $detail; + + return $this; + } + + /** + * Gets code + * + * @return \Messente\Api\Model\ErrorCodeOmnichannel + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param \Messente\Api\Model\ErrorCodeOmnichannel $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets source + * + * @return string + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string $source Describes which field is causing the issue in the payload, null for non 400 status code responses + * + * @return self + */ + public function setSource($source) + { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['source'] = $source; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorItemPhonebook.php b/lib/Model/ErrorItemPhonebook.php new file mode 100644 index 0000000..2a3b976 --- /dev/null +++ b/lib/Model/ErrorItemPhonebook.php @@ -0,0 +1,488 @@ + + */ +class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorItemPhonebook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => '\Messente\Api\Model\ErrorTitlePhonebook', + 'detail' => 'string', + 'code' => '\Messente\Api\Model\ErrorCodePhonebook' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'detail' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'title' => 'title', + 'detail' => 'detail', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'detail' => 'setDetail', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'detail' => 'getDetail', + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['detail'] === null) { + $invalidProperties[] = "'detail' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return \Messente\Api\Model\ErrorTitlePhonebook + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param \Messente\Api\Model\ErrorTitlePhonebook $title title + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets detail + * + * @return string + */ + public function getDetail() + { + return $this->container['detail']; + } + + /** + * Sets detail + * + * @param string $detail Free form more detailed description of the error + * + * @return self + */ + public function setDetail($detail) + { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } + $this->container['detail'] = $detail; + + return $this; + } + + /** + * Gets code + * + * @return \Messente\Api\Model\ErrorCodePhonebook + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param \Messente\Api\Model\ErrorCodePhonebook $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorItemStatistics.php b/lib/Model/ErrorItemStatistics.php new file mode 100644 index 0000000..d01b438 --- /dev/null +++ b/lib/Model/ErrorItemStatistics.php @@ -0,0 +1,488 @@ + + */ +class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorItemStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'title' => 'string', + 'details' => 'string', + 'code' => '\Messente\Api\Model\ErrorCodeStatistics' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'title' => null, + 'details' => null, + 'code' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'details' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'title' => 'title', + 'details' => 'details', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'details' => 'setDetails', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'details' => 'getDetails', + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['title'] === null) { + $invalidProperties[] = "'title' can't be null"; + } + if ($this->container['details'] === null) { + $invalidProperties[] = "'details' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string $title Error title + * + * @return self + */ + public function setTitle($title) + { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets details + * + * @return string + */ + public function getDetails() + { + return $this->container['details']; + } + + /** + * Sets details + * + * @param string $details Error details + * + * @return self + */ + public function setDetails($details) + { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } + $this->container['details'] = $details; + + return $this; + } + + /** + * Gets code + * + * @return \Messente\Api\Model\ErrorCodeStatistics + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param \Messente\Api\Model\ErrorCodeStatistics $code code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorNumberLookup.php b/lib/Model/ErrorNumberLookup.php new file mode 100644 index 0000000..fce5576 --- /dev/null +++ b/lib/Model/ErrorNumberLookup.php @@ -0,0 +1,414 @@ + + */ +class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorNumberLookup'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errors' => '\Messente\Api\Model\ErrorItemNumberLookup[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets errors + * + * @return \Messente\Api\Model\ErrorItemNumberLookup[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Messente\Api\Model\ErrorItemNumberLookup[] $errors An array of errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorOmnichannel.php b/lib/Model/ErrorOmnichannel.php new file mode 100644 index 0000000..d613256 --- /dev/null +++ b/lib/Model/ErrorOmnichannel.php @@ -0,0 +1,414 @@ + + */ +class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorOmnichannel'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errors' => '\Messente\Api\Model\ErrorItemOmnichannel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets errors + * + * @return \Messente\Api\Model\ErrorItemOmnichannel[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Messente\Api\Model\ErrorItemOmnichannel[] $errors An array of errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorPhonebook.php b/lib/Model/ErrorPhonebook.php new file mode 100644 index 0000000..4a42fb3 --- /dev/null +++ b/lib/Model/ErrorPhonebook.php @@ -0,0 +1,414 @@ + + */ +class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorPhonebook'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errors' => '\Messente\Api\Model\ErrorItemPhonebook[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets errors + * + * @return \Messente\Api\Model\ErrorItemPhonebook[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Messente\Api\Model\ErrorItemPhonebook[] $errors An array of errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorStatistics.php b/lib/Model/ErrorStatistics.php new file mode 100644 index 0000000..1c49519 --- /dev/null +++ b/lib/Model/ErrorStatistics.php @@ -0,0 +1,414 @@ + + */ +class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorStatistics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'errors' => '\Messente\Api\Model\ErrorItemStatistics[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets errors + * + * @return \Messente\Api\Model\ErrorItemStatistics[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Messente\Api\Model\ErrorItemStatistics[] $errors An array of errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ErrorTitleOmnichannel.php b/lib/Model/ErrorTitleOmnichannel.php new file mode 100644 index 0000000..2538506 --- /dev/null +++ b/lib/Model/ErrorTitleOmnichannel.php @@ -0,0 +1,79 @@ + + */ +class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'FetchBlacklistSuccess'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phoneNumbers' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phoneNumbers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phoneNumbers' => 'phoneNumbers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phoneNumbers' => 'setPhoneNumbers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phoneNumbers' => 'getPhoneNumbers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phoneNumbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phoneNumbers + * + * @return string[]|null + */ + public function getPhoneNumbers() + { + return $this->container['phoneNumbers']; + } + + /** + * Sets phoneNumbers + * + * @param string[]|null $phoneNumbers Array of unique phone numbers + * + * @return self + */ + public function setPhoneNumbers($phoneNumbers) + { + if (is_null($phoneNumbers)) { + throw new \InvalidArgumentException('non-nullable phoneNumbers cannot be null'); + } + + + $this->container['phoneNumbers'] = $phoneNumbers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/GroupEnvelope.php b/lib/Model/GroupEnvelope.php new file mode 100644 index 0000000..60a9d7b --- /dev/null +++ b/lib/Model/GroupEnvelope.php @@ -0,0 +1,411 @@ + + */ +class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupEnvelope'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'group' => '\Messente\Api\Model\GroupResponseFields' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'group' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'group' => 'group' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'group' => 'setGroup' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'group' => 'getGroup' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('group', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets group + * + * @return \Messente\Api\Model\GroupResponseFields|null + */ + public function getGroup() + { + return $this->container['group']; + } + + /** + * Sets group + * + * @param \Messente\Api\Model\GroupResponseFields|null $group group + * + * @return self + */ + public function setGroup($group) + { + if (is_null($group)) { + throw new \InvalidArgumentException('non-nullable group cannot be null'); + } + $this->container['group'] = $group; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/GroupListEnvelope.php b/lib/Model/GroupListEnvelope.php new file mode 100644 index 0000000..b0fc28c --- /dev/null +++ b/lib/Model/GroupListEnvelope.php @@ -0,0 +1,413 @@ + + */ +class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupListEnvelope'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'groups' => '\Messente\Api\Model\GroupResponseFields[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'groups' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'groups' => 'groups' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'groups' => 'setGroups' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'groups' => 'getGroups' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets groups + * + * @return \Messente\Api\Model\GroupResponseFields[]|null + */ + public function getGroups() + { + return $this->container['groups']; + } + + /** + * Sets groups + * + * @param \Messente\Api\Model\GroupResponseFields[]|null $groups An array of groups + * + * @return self + */ + public function setGroups($groups) + { + if (is_null($groups)) { + throw new \InvalidArgumentException('non-nullable groups cannot be null'); + } + + + $this->container['groups'] = $groups; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/GroupName.php b/lib/Model/GroupName.php new file mode 100644 index 0000000..17725d9 --- /dev/null +++ b/lib/Model/GroupName.php @@ -0,0 +1,423 @@ + + */ +class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupName'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ((mb_strlen($this->container['name']) < 1)) { + $invalidProperties[] = "invalid value for 'name', the character length must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the group + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + + if ((mb_strlen($name) < 1)) { + throw new \InvalidArgumentException('invalid length for $name when calling GroupName., must be bigger than or equal to 1.'); + } + + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/GroupResponseFields.php b/lib/Model/GroupResponseFields.php new file mode 100644 index 0000000..e2632ba --- /dev/null +++ b/lib/Model/GroupResponseFields.php @@ -0,0 +1,529 @@ + + */ +class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'GroupResponseFields'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'name' => 'string', + 'createdOn' => 'string', + 'contactsCount' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'name' => null, + 'createdOn' => '%Y-%m-%dT%H:%M:%S.%fZ', + 'contactsCount' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'createdOn' => true, + 'contactsCount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'name' => 'name', + 'createdOn' => 'createdOn', + 'contactsCount' => 'contactsCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'name' => 'setName', + 'createdOn' => 'setCreatedOn', + 'contactsCount' => 'setContactsCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'name' => 'getName', + 'createdOn' => 'getCreatedOn', + 'contactsCount' => 'getContactsCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdOn', $data ?? [], null); + $this->setIfExists('contactsCount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['contactsCount'] === null) { + $invalidProperties[] = "'contactsCount' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id Id string in UUID format + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name The name of the group + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets createdOn + * + * @return string|null + */ + public function getCreatedOn() + { + return $this->container['createdOn']; + } + + /** + * Sets createdOn + * + * @param string|null $createdOn When the group was created + * + * @return self + */ + public function setCreatedOn($createdOn) + { + if (is_null($createdOn)) { + array_push($this->openAPINullablesSetToNull, 'createdOn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdOn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['createdOn'] = $createdOn; + + return $this; + } + + /** + * Gets contactsCount + * + * @return int + */ + public function getContactsCount() + { + return $this->container['contactsCount']; + } + + /** + * Sets contactsCount + * + * @param int $contactsCount The count of contacts in the group + * + * @return self + */ + public function setContactsCount($contactsCount) + { + if (is_null($contactsCount)) { + throw new \InvalidArgumentException('non-nullable contactsCount cannot be null'); + } + $this->container['contactsCount'] = $contactsCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/MessageResult.php b/lib/Model/MessageResult.php new file mode 100644 index 0000000..1aa0a00 --- /dev/null +++ b/lib/Model/MessageResult.php @@ -0,0 +1,488 @@ + + */ +class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MessageResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'messageId' => 'string', + 'channel' => '\Messente\Api\Model\Channel', + 'sender' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'messageId' => 'UUID', + 'channel' => null, + 'sender' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messageId' => false, + 'channel' => false, + 'sender' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'messageId' => 'message_id', + 'channel' => 'channel', + 'sender' => 'sender' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'messageId' => 'setMessageId', + 'channel' => 'setChannel', + 'sender' => 'setSender' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'messageId' => 'getMessageId', + 'channel' => 'getChannel', + 'sender' => 'getSender' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['messageId'] === null) { + $invalidProperties[] = "'messageId' can't be null"; + } + if ($this->container['channel'] === null) { + $invalidProperties[] = "'channel' can't be null"; + } + if ($this->container['sender'] === null) { + $invalidProperties[] = "'sender' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets messageId + * + * @return string + */ + public function getMessageId() + { + return $this->container['messageId']; + } + + /** + * Sets messageId + * + * @param string $messageId Unique identifier for the message + * + * @return self + */ + public function setMessageId($messageId) + { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } + $this->container['messageId'] = $messageId; + + return $this; + } + + /** + * Gets channel + * + * @return \Messente\Api\Model\Channel + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param \Messente\Api\Model\Channel $channel channel + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets sender + * + * @return string + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string $sender Sender that was used for the message + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/MobileNetwork.php b/lib/Model/MobileNetwork.php new file mode 100644 index 0000000..009d7f5 --- /dev/null +++ b/lib/Model/MobileNetwork.php @@ -0,0 +1,547 @@ + + */ +class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'MobileNetwork'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'mccmnc' => 'string', + 'networkName' => 'string', + 'countryName' => 'string', + 'countryPrefix' => 'string', + 'countryCode' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'mccmnc' => null, + 'networkName' => null, + 'countryName' => null, + 'countryPrefix' => null, + 'countryCode' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mccmnc' => false, + 'networkName' => false, + 'countryName' => false, + 'countryPrefix' => false, + 'countryCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'mccmnc' => 'mccmnc', + 'networkName' => 'networkName', + 'countryName' => 'countryName', + 'countryPrefix' => 'countryPrefix', + 'countryCode' => 'countryCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'mccmnc' => 'setMccmnc', + 'networkName' => 'setNetworkName', + 'countryName' => 'setCountryName', + 'countryPrefix' => 'setCountryPrefix', + 'countryCode' => 'setCountryCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'mccmnc' => 'getMccmnc', + 'networkName' => 'getNetworkName', + 'countryName' => 'getCountryName', + 'countryPrefix' => 'getCountryPrefix', + 'countryCode' => 'getCountryCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('mccmnc', $data ?? [], null); + $this->setIfExists('networkName', $data ?? [], null); + $this->setIfExists('countryName', $data ?? [], null); + $this->setIfExists('countryPrefix', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets mccmnc + * + * @return string|null + */ + public function getMccmnc() + { + return $this->container['mccmnc']; + } + + /** + * Sets mccmnc + * + * @param string|null $mccmnc Mobile country and mobile network code + * + * @return self + */ + public function setMccmnc($mccmnc) + { + if (is_null($mccmnc)) { + throw new \InvalidArgumentException('non-nullable mccmnc cannot be null'); + } + $this->container['mccmnc'] = $mccmnc; + + return $this; + } + + /** + * Gets networkName + * + * @return string|null + */ + public function getNetworkName() + { + return $this->container['networkName']; + } + + /** + * Sets networkName + * + * @param string|null $networkName Mobile network name + * + * @return self + */ + public function setNetworkName($networkName) + { + if (is_null($networkName)) { + throw new \InvalidArgumentException('non-nullable networkName cannot be null'); + } + $this->container['networkName'] = $networkName; + + return $this; + } + + /** + * Gets countryName + * + * @return string|null + */ + public function getCountryName() + { + return $this->container['countryName']; + } + + /** + * Sets countryName + * + * @param string|null $countryName Country name + * + * @return self + */ + public function setCountryName($countryName) + { + if (is_null($countryName)) { + throw new \InvalidArgumentException('non-nullable countryName cannot be null'); + } + $this->container['countryName'] = $countryName; + + return $this; + } + + /** + * Gets countryPrefix + * + * @return string|null + */ + public function getCountryPrefix() + { + return $this->container['countryPrefix']; + } + + /** + * Sets countryPrefix + * + * @param string|null $countryPrefix Country prefix + * + * @return self + */ + public function setCountryPrefix($countryPrefix) + { + if (is_null($countryPrefix)) { + throw new \InvalidArgumentException('non-nullable countryPrefix cannot be null'); + } + $this->container['countryPrefix'] = $countryPrefix; + + return $this; + } + + /** + * Gets countryCode + * + * @return string|null + */ + public function getCountryCode() + { + return $this->container['countryCode']; + } + + /** + * Sets countryCode + * + * @param string|null $countryCode Country code + * + * @return self + */ + public function setCountryCode($countryCode) + { + if (is_null($countryCode)) { + throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); + } + $this->container['countryCode'] = $countryCode; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..da1a39e --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,112 @@ + + */ +class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NumberToBlacklist'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'phoneNumber' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'phoneNumber' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'phoneNumber' => 'phoneNumber' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'phoneNumber' => 'setPhoneNumber' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'phoneNumber' => 'getPhoneNumber' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('phoneNumber', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['phoneNumber'] === null) { + $invalidProperties[] = "'phoneNumber' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets phoneNumber + * + * @return string + */ + public function getPhoneNumber() + { + return $this->container['phoneNumber']; + } + + /** + * Sets phoneNumber + * + * @param string $phoneNumber Phone number in e.164 format + * + * @return self + */ + public function setPhoneNumber($phoneNumber) + { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } + $this->container['phoneNumber'] = $phoneNumber; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/NumbersToInvestigate.php b/lib/Model/NumbersToInvestigate.php new file mode 100644 index 0000000..fcdb632 --- /dev/null +++ b/lib/Model/NumbersToInvestigate.php @@ -0,0 +1,429 @@ + + */ +class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'NumbersToInvestigate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'numbers' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'numbers' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'numbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'numbers' => 'numbers' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'numbers' => 'setNumbers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'numbers' => 'getNumbers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('numbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['numbers'] === null) { + $invalidProperties[] = "'numbers' can't be null"; + } + if ((count($this->container['numbers']) > 10)) { + $invalidProperties[] = "invalid value for 'numbers', number of items must be less than or equal to 10."; + } + + if ((count($this->container['numbers']) < 1)) { + $invalidProperties[] = "invalid value for 'numbers', number of items must be greater than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets numbers + * + * @return string[] + */ + public function getNumbers() + { + return $this->container['numbers']; + } + + /** + * Sets numbers + * + * @param string[] $numbers A list of phone numbers. Max 10 numbers per request + * + * @return self + */ + public function setNumbers($numbers) + { + if (is_null($numbers)) { + throw new \InvalidArgumentException('non-nullable numbers cannot be null'); + } + + if ((count($numbers) > 10)) { + throw new \InvalidArgumentException('invalid value for $numbers when calling NumbersToInvestigate., number of items must be less than or equal to 10.'); + } + if ((count($numbers) < 1)) { + throw new \InvalidArgumentException('invalid length for $numbers when calling NumbersToInvestigate., number of items must be greater than or equal to 1.'); + } + $this->container['numbers'] = $numbers; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OmniMessageCreateSuccessResponse.php b/lib/Model/OmniMessageCreateSuccessResponse.php new file mode 100644 index 0000000..51f9bf1 --- /dev/null +++ b/lib/Model/OmniMessageCreateSuccessResponse.php @@ -0,0 +1,488 @@ + + */ +class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'OmniMessageCreateSuccessResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'messages' => '\Messente\Api\Model\MessageResult[]', + 'to' => 'string', + 'omnimessageId' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'messages' => null, + 'to' => null, + 'omnimessageId' => 'UUID' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'messages' => 'messages', + 'to' => 'to', + 'omnimessageId' => 'omnimessage_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'messages' => 'setMessages', + 'to' => 'setTo', + 'omnimessageId' => 'setOmnimessageId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'messages' => 'getMessages', + 'to' => 'getTo', + 'omnimessageId' => 'getOmnimessageId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['messages'] === null) { + $invalidProperties[] = "'messages' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['omnimessageId'] === null) { + $invalidProperties[] = "'omnimessageId' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets messages + * + * @return \Messente\Api\Model\MessageResult[] + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Messente\Api\Model\MessageResult[] $messages List of messages that compose the omnimessage + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Phone number in e.164 format + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets omnimessageId + * + * @return string + */ + public function getOmnimessageId() + { + return $this->container['omnimessageId']; + } + + /** + * Sets omnimessageId + * + * @param string $omnimessageId Unique identifier for the omnimessage + * + * @return self + */ + public function setOmnimessageId($omnimessageId) + { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } + $this->container['omnimessageId'] = $omnimessageId; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Omnimessage.php b/lib/Model/Omnimessage.php new file mode 100644 index 0000000..873874f --- /dev/null +++ b/lib/Model/Omnimessage.php @@ -0,0 +1,587 @@ + + */ +class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Omnimessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'to' => 'string', + 'messages' => '\Messente\Api\Model\OmnimessageMessagesInner[]', + 'dlrUrl' => 'string', + 'textStore' => '\Messente\Api\Model\TextStore', + 'timeToSend' => '\DateTime', + 'priority' => '\Messente\Api\Model\Priority' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'to' => null, + 'messages' => null, + 'dlrUrl' => 'url', + 'textStore' => null, + 'timeToSend' => 'date-time', + 'priority' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to' => false, + 'messages' => false, + 'dlrUrl' => false, + 'textStore' => false, + 'timeToSend' => false, + 'priority' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'to' => 'to', + 'messages' => 'messages', + 'dlrUrl' => 'dlr_url', + 'textStore' => 'text_store', + 'timeToSend' => 'time_to_send', + 'priority' => 'priority' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'to' => 'setTo', + 'messages' => 'setMessages', + 'dlrUrl' => 'setDlrUrl', + 'textStore' => 'setTextStore', + 'timeToSend' => 'setTimeToSend', + 'priority' => 'setPriority' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'to' => 'getTo', + 'messages' => 'getMessages', + 'dlrUrl' => 'getDlrUrl', + 'textStore' => 'getTextStore', + 'timeToSend' => 'getTimeToSend', + 'priority' => 'getPriority' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('dlrUrl', $data ?? [], null); + $this->setIfExists('textStore', $data ?? [], null); + $this->setIfExists('timeToSend', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['messages'] === null) { + $invalidProperties[] = "'messages' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets to + * + * @return string + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Phone number in e.164 format + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets messages + * + * @return \Messente\Api\Model\OmnimessageMessagesInner[] + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Messente\Api\Model\OmnimessageMessagesInner[] $messages An array of messages + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + + /** + * Gets dlrUrl + * + * @return string|null + */ + public function getDlrUrl() + { + return $this->container['dlrUrl']; + } + + /** + * Sets dlrUrl + * + * @param string|null $dlrUrl URL where the delivery report will be sent + * + * @return self + */ + public function setDlrUrl($dlrUrl) + { + if (is_null($dlrUrl)) { + throw new \InvalidArgumentException('non-nullable dlrUrl cannot be null'); + } + $this->container['dlrUrl'] = $dlrUrl; + + return $this; + } + + /** + * Gets textStore + * + * @return \Messente\Api\Model\TextStore|null + */ + public function getTextStore() + { + return $this->container['textStore']; + } + + /** + * Sets textStore + * + * @param \Messente\Api\Model\TextStore|null $textStore textStore + * + * @return self + */ + public function setTextStore($textStore) + { + if (is_null($textStore)) { + throw new \InvalidArgumentException('non-nullable textStore cannot be null'); + } + $this->container['textStore'] = $textStore; + + return $this; + } + + /** + * Gets timeToSend + * + * @return \DateTime|null + */ + public function getTimeToSend() + { + return $this->container['timeToSend']; + } + + /** + * Sets timeToSend + * + * @param \DateTime|null $timeToSend Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) + * + * @return self + */ + public function setTimeToSend($timeToSend) + { + if (is_null($timeToSend)) { + throw new \InvalidArgumentException('non-nullable timeToSend cannot be null'); + } + $this->container['timeToSend'] = $timeToSend; + + return $this; + } + + /** + * Gets priority + * + * @return \Messente\Api\Model\Priority|null + */ + public function getPriority() + { + return $this->container['priority']; + } + + /** + * Sets priority + * + * @param \Messente\Api\Model\Priority|null $priority priority + * + * @return self + */ + public function setPriority($priority) + { + if (is_null($priority)) { + throw new \InvalidArgumentException('non-nullable priority cannot be null'); + } + $this->container['priority'] = $priority; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/OmnimessageMessagesInner.php b/lib/Model/OmnimessageMessagesInner.php new file mode 100644 index 0000000..efdac3d --- /dev/null +++ b/lib/Model/OmnimessageMessagesInner.php @@ -0,0 +1,889 @@ + + */ +class OmnimessageMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Omnimessage_messages_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'text' => 'string', + 'imageUrl' => 'string', + 'buttonUrl' => 'string', + 'buttonText' => 'string', + 'channel' => 'string', + 'autoconvert' => 'string', + 'udh' => 'string', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', + 'documentUrl' => 'string', + 'audioUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'text' => null, + 'imageUrl' => null, + 'buttonUrl' => null, + 'buttonText' => null, + 'channel' => null, + 'autoconvert' => null, + 'udh' => null, + 'template' => null, + 'documentUrl' => null, + 'audioUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false, + 'autoconvert' => false, + 'udh' => false, + 'template' => false, + 'documentUrl' => false, + 'audioUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'text' => 'text', + 'imageUrl' => 'image_url', + 'buttonUrl' => 'button_url', + 'buttonText' => 'button_text', + 'channel' => 'channel', + 'autoconvert' => 'autoconvert', + 'udh' => 'udh', + 'template' => 'template', + 'documentUrl' => 'document_url', + 'audioUrl' => 'audio_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'text' => 'setText', + 'imageUrl' => 'setImageUrl', + 'buttonUrl' => 'setButtonUrl', + 'buttonText' => 'setButtonText', + 'channel' => 'setChannel', + 'autoconvert' => 'setAutoconvert', + 'udh' => 'setUdh', + 'template' => 'setTemplate', + 'documentUrl' => 'setDocumentUrl', + 'audioUrl' => 'setAudioUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'text' => 'getText', + 'imageUrl' => 'getImageUrl', + 'buttonUrl' => 'getButtonUrl', + 'buttonText' => 'getButtonText', + 'channel' => 'getChannel', + 'autoconvert' => 'getAutoconvert', + 'udh' => 'getUdh', + 'template' => 'getTemplate', + 'documentUrl' => 'getDocumentUrl', + 'audioUrl' => 'getAudioUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_TELEGRAM = 'telegram'; + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_TELEGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoconvertAllowableValues() + { + return [ + self::AUTOCONVERT_FULL, + self::AUTOCONVERT_ON, + self::AUTOCONVERT_OFF, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'autoconvert', must be one of '%s'", + $this->container['autoconvert'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Plaintext content for Telegram + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets buttonUrl + * + * @return string|null + */ + public function getButtonUrl() + { + return $this->container['buttonUrl']; + } + + /** + * Sets buttonUrl + * + * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) + * + * @return self + */ + public function setButtonUrl($buttonUrl) + { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } + $this->container['buttonUrl'] = $buttonUrl; + + return $this; + } + + /** + * Gets buttonText + * + * @return string|null + */ + public function getButtonText() + { + return $this->container['buttonText']; + } + + /** + * Sets buttonText + * + * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) + * + * @return self + */ + public function setButtonText($buttonText) + { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } + $this->container['buttonText'] = $buttonText; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets autoconvert + * + * @return string|null + */ + public function getAutoconvert() + { + return $this->container['autoconvert']; + } + + /** + * Sets autoconvert + * + * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way + * + * @return self + */ + public function setAutoconvert($autoconvert) + { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!in_array($autoconvert, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'autoconvert', must be one of '%s'", + $autoconvert, + implode("', '", $allowedValues) + ) + ); + } + $this->container['autoconvert'] = $autoconvert; + + return $this; + } + + /** + * Gets udh + * + * @return string|null + */ + public function getUdh() + { + return $this->container['udh']; + } + + /** + * Sets udh + * + * @param string|null $udh hex-encoded string containing SMS UDH + * + * @return self + */ + public function setUdh($udh) + { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } + $this->container['udh'] = $udh; + + return $this; + } + + /** + * Gets template + * + * @return \Messente\Api\Model\WhatsAppTemplate|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template + * + * @return self + */ + public function setTemplate($template) + { + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets documentUrl + * + * @return string|null + */ + public function getDocumentUrl() + { + return $this->container['documentUrl']; + } + + /** + * Sets documentUrl + * + * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" + * + * @return self + */ + public function setDocumentUrl($documentUrl) + { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } + $this->container['documentUrl'] = $documentUrl; + + return $this; + } + + /** + * Gets audioUrl + * + * @return string|null + */ + public function getAudioUrl() + { + return $this->container['audioUrl']; + } + + /** + * Sets audioUrl + * + * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" + * + * @return self + */ + public function setAudioUrl($audioUrl) + { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } + $this->container['audioUrl'] = $audioUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Priority.php b/lib/Model/Priority.php new file mode 100644 index 0000000..716c782 --- /dev/null +++ b/lib/Model/Priority.php @@ -0,0 +1,67 @@ + + */ +class SMS implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SMS'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'text' => 'string', + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'autoconvert' => 'string', + 'udh' => 'string', + 'channel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'text' => null, + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'autoconvert' => null, + 'udh' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'text' => false, + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'autoconvert' => false, + 'udh' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'text' => 'text', + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'autoconvert' => 'autoconvert', + 'udh' => 'udh', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'text' => 'setText', + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'autoconvert' => 'setAutoconvert', + 'udh' => 'setUdh', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'text' => 'getText', + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'autoconvert' => 'getAutoconvert', + 'udh' => 'getUdh', + 'channel' => 'getChannel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + public const CHANNEL_SMS = 'sms'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoconvertAllowableValues() + { + return [ + self::AUTOCONVERT_FULL, + self::AUTOCONVERT_ON, + self::AUTOCONVERT_OFF, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_SMS, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'sms'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'autoconvert', must be one of '%s'", + $this->container['autoconvert'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets text + * + * @return string + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Text content of the SMS + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets autoconvert + * + * @return string|null + */ + public function getAutoconvert() + { + return $this->container['autoconvert']; + } + + /** + * Sets autoconvert + * + * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way + * + * @return self + */ + public function setAutoconvert($autoconvert) + { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!in_array($autoconvert, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'autoconvert', must be one of '%s'", + $autoconvert, + implode("', '", $allowedValues) + ) + ); + } + $this->container['autoconvert'] = $autoconvert; + + return $this; + } + + /** + * Gets udh + * + * @return string|null + */ + public function getUdh() + { + return $this->container['udh']; + } + + /** + * Sets udh + * + * @param string|null $udh hex-encoded string containing SMS UDH + * + * @return self + */ + public function setUdh($udh) + { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } + $this->container['udh'] = $udh; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/StatisticsReport.php b/lib/Model/StatisticsReport.php new file mode 100644 index 0000000..92e1647 --- /dev/null +++ b/lib/Model/StatisticsReport.php @@ -0,0 +1,488 @@ + + */ +class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StatisticsReport'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totalMessages' => 'int', + 'totalPrice' => 'string', + 'country' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totalMessages' => null, + 'totalPrice' => null, + 'country' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalMessages' => false, + 'totalPrice' => false, + 'country' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'totalMessages' => 'total_messages', + 'totalPrice' => 'total_price', + 'country' => 'country' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totalMessages' => 'setTotalMessages', + 'totalPrice' => 'setTotalPrice', + 'country' => 'setCountry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totalMessages' => 'getTotalMessages', + 'totalPrice' => 'getTotalPrice', + 'country' => 'getCountry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('totalMessages', $data ?? [], null); + $this->setIfExists('totalPrice', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['totalMessages'] === null) { + $invalidProperties[] = "'totalMessages' can't be null"; + } + if ($this->container['totalPrice'] === null) { + $invalidProperties[] = "'totalPrice' can't be null"; + } + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets totalMessages + * + * @return int + */ + public function getTotalMessages() + { + return $this->container['totalMessages']; + } + + /** + * Sets totalMessages + * + * @param int $totalMessages Sum of all messages + * + * @return self + */ + public function setTotalMessages($totalMessages) + { + if (is_null($totalMessages)) { + throw new \InvalidArgumentException('non-nullable totalMessages cannot be null'); + } + $this->container['totalMessages'] = $totalMessages; + + return $this; + } + + /** + * Gets totalPrice + * + * @return string + */ + public function getTotalPrice() + { + return $this->container['totalPrice']; + } + + /** + * Sets totalPrice + * + * @param string $totalPrice Price for all messages + * + * @return self + */ + public function setTotalPrice($totalPrice) + { + if (is_null($totalPrice)) { + throw new \InvalidArgumentException('non-nullable totalPrice cannot be null'); + } + $this->container['totalPrice'] = $totalPrice; + + return $this; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country Target country of all messages + * + * @return self + */ + public function setCountry($country) + { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } + $this->container['country'] = $country; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/StatisticsReportSettings.php b/lib/Model/StatisticsReportSettings.php new file mode 100644 index 0000000..3d6ab50 --- /dev/null +++ b/lib/Model/StatisticsReportSettings.php @@ -0,0 +1,485 @@ + + */ +class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StatisticsReportSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'startDate' => '\DateTime', + 'endDate' => '\DateTime', + 'messageTypes' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'startDate' => 'date', + 'endDate' => 'date', + 'messageTypes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startDate' => false, + 'endDate' => false, + 'messageTypes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'startDate' => 'start_date', + 'endDate' => 'end_date', + 'messageTypes' => 'message_types' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'startDate' => 'setStartDate', + 'endDate' => 'setEndDate', + 'messageTypes' => 'setMessageTypes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'startDate' => 'getStartDate', + 'endDate' => 'getEndDate', + 'messageTypes' => 'getMessageTypes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('messageTypes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['startDate'] === null) { + $invalidProperties[] = "'startDate' can't be null"; + } + if ($this->container['endDate'] === null) { + $invalidProperties[] = "'endDate' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets startDate + * + * @return \DateTime + */ + public function getStartDate() + { + return $this->container['startDate']; + } + + /** + * Sets startDate + * + * @param \DateTime $startDate Start date for the report + * + * @return self + */ + public function setStartDate($startDate) + { + if (is_null($startDate)) { + throw new \InvalidArgumentException('non-nullable startDate cannot be null'); + } + $this->container['startDate'] = $startDate; + + return $this; + } + + /** + * Gets endDate + * + * @return \DateTime + */ + public function getEndDate() + { + return $this->container['endDate']; + } + + /** + * Sets endDate + * + * @param \DateTime $endDate End date for the report + * + * @return self + */ + public function setEndDate($endDate) + { + if (is_null($endDate)) { + throw new \InvalidArgumentException('non-nullable endDate cannot be null'); + } + $this->container['endDate'] = $endDate; + + return $this; + } + + /** + * Gets messageTypes + * + * @return string[]|null + */ + public function getMessageTypes() + { + return $this->container['messageTypes']; + } + + /** + * Sets messageTypes + * + * @param string[]|null $messageTypes Optional list of message types (sms, viber, whatsapp, hlr, telegram) + * + * @return self + */ + public function setMessageTypes($messageTypes) + { + if (is_null($messageTypes)) { + throw new \InvalidArgumentException('non-nullable messageTypes cannot be null'); + } + $this->container['messageTypes'] = $messageTypes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/StatisticsReportSuccess.php b/lib/Model/StatisticsReportSuccess.php new file mode 100644 index 0000000..9fd94d0 --- /dev/null +++ b/lib/Model/StatisticsReportSuccess.php @@ -0,0 +1,414 @@ + + */ +class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'StatisticsReportSuccess'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'reports' => '\Messente\Api\Model\StatisticsReport[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'reports' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reports' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'reports' => 'reports' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'reports' => 'setReports' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'reports' => 'getReports' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('reports', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['reports'] === null) { + $invalidProperties[] = "'reports' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets reports + * + * @return \Messente\Api\Model\StatisticsReport[] + */ + public function getReports() + { + return $this->container['reports']; + } + + /** + * Sets reports + * + * @param \Messente\Api\Model\StatisticsReport[] $reports Array of report objects + * + * @return self + */ + public function setReports($reports) + { + if (is_null($reports)) { + throw new \InvalidArgumentException('non-nullable reports cannot be null'); + } + $this->container['reports'] = $reports; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Status.php b/lib/Model/Status.php new file mode 100644 index 0000000..1fd018f --- /dev/null +++ b/lib/Model/Status.php @@ -0,0 +1,91 @@ + + */ +class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SyncNumberLookupResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'number' => 'string', + 'roaming' => 'bool', + 'ported' => 'bool', + 'roamingNetwork' => '\Messente\Api\Model\MobileNetwork', + 'currentNetwork' => '\Messente\Api\Model\MobileNetwork', + 'originalNetwork' => '\Messente\Api\Model\MobileNetwork', + 'portedNetwork' => '\Messente\Api\Model\MobileNetwork', + 'status' => 'string', + 'error' => 'mixed' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'number' => null, + 'roaming' => null, + 'ported' => null, + 'roamingNetwork' => null, + 'currentNetwork' => null, + 'originalNetwork' => null, + 'portedNetwork' => null, + 'status' => null, + 'error' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'roaming' => true, + 'ported' => true, + 'roamingNetwork' => true, + 'currentNetwork' => true, + 'originalNetwork' => true, + 'portedNetwork' => true, + 'status' => false, + 'error' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'number' => 'number', + 'roaming' => 'roaming', + 'ported' => 'ported', + 'roamingNetwork' => 'roamingNetwork', + 'currentNetwork' => 'currentNetwork', + 'originalNetwork' => 'originalNetwork', + 'portedNetwork' => 'portedNetwork', + 'status' => 'status', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'number' => 'setNumber', + 'roaming' => 'setRoaming', + 'ported' => 'setPorted', + 'roamingNetwork' => 'setRoamingNetwork', + 'currentNetwork' => 'setCurrentNetwork', + 'originalNetwork' => 'setOriginalNetwork', + 'portedNetwork' => 'setPortedNetwork', + 'status' => 'setStatus', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'number' => 'getNumber', + 'roaming' => 'getRoaming', + 'ported' => 'getPorted', + 'roamingNetwork' => 'getRoamingNetwork', + 'currentNetwork' => 'getCurrentNetwork', + 'originalNetwork' => 'getOriginalNetwork', + 'portedNetwork' => 'getPortedNetwork', + 'status' => 'getStatus', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATUS_ON = 'ON'; + public const STATUS_OFF = 'OFF'; + public const STATUS_INVALID = 'INVALID'; + public const STATUS_UNKNOWN = 'UNKNOWN'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ON, + self::STATUS_OFF, + self::STATUS_INVALID, + self::STATUS_UNKNOWN, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('roaming', $data ?? [], null); + $this->setIfExists('ported', $data ?? [], null); + $this->setIfExists('roamingNetwork', $data ?? [], null); + $this->setIfExists('currentNetwork', $data ?? [], null); + $this->setIfExists('originalNetwork', $data ?? [], null); + $this->setIfExists('portedNetwork', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['number'] === null) { + $invalidProperties[] = "'number' can't be null"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets number + * + * @return string + */ + public function getNumber() + { + return $this->container['number']; + } + + /** + * Sets number + * + * @param string $number Phone number in e.164 format + * + * @return self + */ + public function setNumber($number) + { + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } + $this->container['number'] = $number; + + return $this; + } + + /** + * Gets roaming + * + * @return bool|null + */ + public function getRoaming() + { + return $this->container['roaming']; + } + + /** + * Sets roaming + * + * @param bool|null $roaming Indicates if a number is roaming + * + * @return self + */ + public function setRoaming($roaming) + { + if (is_null($roaming)) { + array_push($this->openAPINullablesSetToNull, 'roaming'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roaming', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['roaming'] = $roaming; + + return $this; + } + + /** + * Gets ported + * + * @return bool|null + */ + public function getPorted() + { + return $this->container['ported']; + } + + /** + * Sets ported + * + * @param bool|null $ported Indicates if a number is ported + * + * @return self + */ + public function setPorted($ported) + { + if (is_null($ported)) { + array_push($this->openAPINullablesSetToNull, 'ported'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ported', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['ported'] = $ported; + + return $this; + } + + /** + * Gets roamingNetwork + * + * @return \Messente\Api\Model\MobileNetwork|null + */ + public function getRoamingNetwork() + { + return $this->container['roamingNetwork']; + } + + /** + * Sets roamingNetwork + * + * @param \Messente\Api\Model\MobileNetwork|null $roamingNetwork roamingNetwork + * + * @return self + */ + public function setRoamingNetwork($roamingNetwork) + { + if (is_null($roamingNetwork)) { + array_push($this->openAPINullablesSetToNull, 'roamingNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roamingNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['roamingNetwork'] = $roamingNetwork; + + return $this; + } + + /** + * Gets currentNetwork + * + * @return \Messente\Api\Model\MobileNetwork|null + */ + public function getCurrentNetwork() + { + return $this->container['currentNetwork']; + } + + /** + * Sets currentNetwork + * + * @param \Messente\Api\Model\MobileNetwork|null $currentNetwork currentNetwork + * + * @return self + */ + public function setCurrentNetwork($currentNetwork) + { + if (is_null($currentNetwork)) { + array_push($this->openAPINullablesSetToNull, 'currentNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currentNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['currentNetwork'] = $currentNetwork; + + return $this; + } + + /** + * Gets originalNetwork + * + * @return \Messente\Api\Model\MobileNetwork|null + */ + public function getOriginalNetwork() + { + return $this->container['originalNetwork']; + } + + /** + * Sets originalNetwork + * + * @param \Messente\Api\Model\MobileNetwork|null $originalNetwork originalNetwork + * + * @return self + */ + public function setOriginalNetwork($originalNetwork) + { + if (is_null($originalNetwork)) { + array_push($this->openAPINullablesSetToNull, 'originalNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('originalNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['originalNetwork'] = $originalNetwork; + + return $this; + } + + /** + * Gets portedNetwork + * + * @return \Messente\Api\Model\MobileNetwork|null + */ + public function getPortedNetwork() + { + return $this->container['portedNetwork']; + } + + /** + * Sets portedNetwork + * + * @param \Messente\Api\Model\MobileNetwork|null $portedNetwork portedNetwork + * + * @return self + */ + public function setPortedNetwork($portedNetwork) + { + if (is_null($portedNetwork)) { + array_push($this->openAPINullablesSetToNull, 'portedNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('portedNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['portedNetwork'] = $portedNetwork; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status Status of the phone number + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets error + * + * @return mixed|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param mixed|null $error Indicates if any error occurred while handling the request + * + * @return self + */ + public function setError($error) + { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SyncNumberLookupSuccess.php b/lib/Model/SyncNumberLookupSuccess.php new file mode 100644 index 0000000..95b8e82 --- /dev/null +++ b/lib/Model/SyncNumberLookupSuccess.php @@ -0,0 +1,451 @@ + + */ +class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SyncNumberLookupSuccess'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requestId' => 'string', + 'result' => '\Messente\Api\Model\SyncNumberLookupResult[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'requestId' => null, + 'result' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'requestId' => false, + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'requestId' => 'request_id', + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'requestId' => 'setRequestId', + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'requestId' => 'getRequestId', + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['requestId'] === null) { + $invalidProperties[] = "'requestId' can't be null"; + } + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets requestId + * + * @return string + */ + public function getRequestId() + { + return $this->container['requestId']; + } + + /** + * Sets requestId + * + * @param string $requestId ID of the request + * + * @return self + */ + public function setRequestId($requestId) + { + if (is_null($requestId)) { + throw new \InvalidArgumentException('non-nullable requestId cannot be null'); + } + $this->container['requestId'] = $requestId; + + return $this; + } + + /** + * Gets result + * + * @return \Messente\Api\Model\SyncNumberLookupResult[] + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param \Messente\Api\Model\SyncNumberLookupResult[] $result A container for phone number info objects + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Telegram.php b/lib/Model/Telegram.php new file mode 100644 index 0000000..438ca6f --- /dev/null +++ b/lib/Model/Telegram.php @@ -0,0 +1,647 @@ + + */ +class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Telegram'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'text' => 'string', + 'imageUrl' => 'string', + 'documentUrl' => 'string', + 'audioUrl' => 'string', + 'channel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'text' => null, + 'imageUrl' => null, + 'documentUrl' => null, + 'audioUrl' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'text' => false, + 'imageUrl' => false, + 'documentUrl' => false, + 'audioUrl' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'text' => 'text', + 'imageUrl' => 'image_url', + 'documentUrl' => 'document_url', + 'audioUrl' => 'audio_url', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'text' => 'setText', + 'imageUrl' => 'setImageUrl', + 'documentUrl' => 'setDocumentUrl', + 'audioUrl' => 'setAudioUrl', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'text' => 'getText', + 'imageUrl' => 'getImageUrl', + 'documentUrl' => 'getDocumentUrl', + 'audioUrl' => 'getAudioUrl', + 'channel' => 'getChannel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_TELEGRAM = 'telegram'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_TELEGRAM, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text Plaintext content for Telegram + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets documentUrl + * + * @return string|null + */ + public function getDocumentUrl() + { + return $this->container['documentUrl']; + } + + /** + * Sets documentUrl + * + * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" + * + * @return self + */ + public function setDocumentUrl($documentUrl) + { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } + $this->container['documentUrl'] = $documentUrl; + + return $this; + } + + /** + * Gets audioUrl + * + * @return string|null + */ + public function getAudioUrl() + { + return $this->container['audioUrl']; + } + + /** + * Sets audioUrl + * + * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" + * + * @return self + */ + public function setAudioUrl($audioUrl) + { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } + $this->container['audioUrl'] = $audioUrl; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TextStore.php b/lib/Model/TextStore.php new file mode 100644 index 0000000..ad7e107 --- /dev/null +++ b/lib/Model/TextStore.php @@ -0,0 +1,67 @@ + + */ +class Viber implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Viber'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'text' => 'string', + 'imageUrl' => 'string', + 'buttonUrl' => 'string', + 'buttonText' => 'string', + 'channel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'text' => null, + 'imageUrl' => null, + 'buttonUrl' => null, + 'buttonText' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'text' => 'text', + 'imageUrl' => 'image_url', + 'buttonUrl' => 'button_url', + 'buttonText' => 'button_text', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'text' => 'setText', + 'imageUrl' => 'setImageUrl', + 'buttonUrl' => 'setButtonUrl', + 'buttonText' => 'setButtonText', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'text' => 'getText', + 'imageUrl' => 'getImageUrl', + 'buttonUrl' => 'getButtonUrl', + 'buttonText' => 'getButtonText', + 'channel' => 'getChannel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_VIBER = 'viber'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_VIBER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'viber'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text Plaintext content for Viber + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl URL for the embedded image Valid combinations: 1) image_url, 2) text, image_url, button_url, button_text + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets buttonUrl + * + * @return string|null + */ + public function getButtonUrl() + { + return $this->container['buttonUrl']; + } + + /** + * Sets buttonUrl + * + * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) + * + * @return self + */ + public function setButtonUrl($buttonUrl) + { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } + $this->container['buttonUrl'] = $buttonUrl; + + return $this; + } + + /** + * Gets buttonText + * + * @return string|null + */ + public function getButtonText() + { + return $this->container['buttonText']; + } + + /** + * Sets buttonText + * + * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) + * + * @return self + */ + public function setButtonText($buttonText) + { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } + $this->container['buttonText'] = $buttonText; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php new file mode 100644 index 0000000..ae2ef73 --- /dev/null +++ b/lib/Model/WhatsApp.php @@ -0,0 +1,579 @@ + + */ +class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsApp'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', + 'channel' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'template' => null, + 'channel' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'template' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'template' => 'template', + 'channel' => 'channel' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'template' => 'setTemplate', + 'channel' => 'setChannel' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'template' => 'getTemplate', + 'channel' => 'getChannel' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_WHATSAPP = 'whatsapp'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_WHATSAPP, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'whatsapp'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets template + * + * @return \Messente\Api\Model\WhatsAppTemplate|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template + * + * @return self + */ + public function setTemplate($template) + { + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppComponent.php b/lib/Model/WhatsAppComponent.php new file mode 100644 index 0000000..630b72b --- /dev/null +++ b/lib/Model/WhatsAppComponent.php @@ -0,0 +1,516 @@ + + */ +class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppComponent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'subType' => 'string', + 'index' => 'int', + 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'subType' => null, + 'index' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'subType' => false, + 'index' => false, + 'parameters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'subType' => 'sub_type', + 'index' => 'index', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'subType' => 'setSubType', + 'index' => 'setIndex', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'subType' => 'getSubType', + 'index' => 'getIndex', + 'parameters' => 'getParameters' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('subType', $data ?? [], null); + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of the component + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets subType + * + * @return string|null + */ + public function getSubType() + { + return $this->container['subType']; + } + + /** + * Sets subType + * + * @param string|null $subType Sub-type of the component + * + * @return self + */ + public function setSubType($subType) + { + if (is_null($subType)) { + throw new \InvalidArgumentException('non-nullable subType cannot be null'); + } + $this->container['subType'] = $subType; + + return $this; + } + + /** + * Gets index + * + * @return int|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int|null $index index used to position buttons + * + * @return self + */ + public function setIndex($index) + { + if (is_null($index)) { + throw new \InvalidArgumentException('non-nullable index cannot be null'); + } + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets parameters + * + * @return \Messente\Api\Model\WhatsAppParameter[]|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \Messente\Api\Model\WhatsAppParameter[]|null $parameters List of parameters for the component + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppCurrency.php b/lib/Model/WhatsAppCurrency.php new file mode 100644 index 0000000..c44abd7 --- /dev/null +++ b/lib/Model/WhatsAppCurrency.php @@ -0,0 +1,488 @@ + + */ +class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppCurrency'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'fallbackValue' => 'string', + 'code' => 'string', + 'amount1000' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'fallbackValue' => null, + 'code' => null, + 'amount1000' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fallbackValue' => false, + 'code' => false, + 'amount1000' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'fallbackValue' => 'fallback_value', + 'code' => 'code', + 'amount1000' => 'amount_1000' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'fallbackValue' => 'setFallbackValue', + 'code' => 'setCode', + 'amount1000' => 'setAmount1000' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'fallbackValue' => 'getFallbackValue', + 'code' => 'getCode', + 'amount1000' => 'getAmount1000' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('fallbackValue', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('amount1000', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['fallbackValue'] === null) { + $invalidProperties[] = "'fallbackValue' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['amount1000'] === null) { + $invalidProperties[] = "'amount1000' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets fallbackValue + * + * @return string + */ + public function getFallbackValue() + { + return $this->container['fallbackValue']; + } + + /** + * Sets fallbackValue + * + * @param string $fallbackValue Default text if localization fails. + * + * @return self + */ + public function setFallbackValue($fallbackValue) + { + if (is_null($fallbackValue)) { + throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); + } + $this->container['fallbackValue'] = $fallbackValue; + + return $this; + } + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Currency code as defined in ISO 4217. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets amount1000 + * + * @return string + */ + public function getAmount1000() + { + return $this->container['amount1000']; + } + + /** + * Sets amount1000 + * + * @param string $amount1000 Amount multiplied by 1000. + * + * @return self + */ + public function setAmount1000($amount1000) + { + if (is_null($amount1000)) { + throw new \InvalidArgumentException('non-nullable amount1000 cannot be null'); + } + $this->container['amount1000'] = $amount1000; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppDatetime.php b/lib/Model/WhatsAppDatetime.php new file mode 100644 index 0000000..063cd68 --- /dev/null +++ b/lib/Model/WhatsAppDatetime.php @@ -0,0 +1,414 @@ + + */ +class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppDatetime'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'fallbackValue' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'fallbackValue' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fallbackValue' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'fallbackValue' => 'fallback_value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'fallbackValue' => 'setFallbackValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'fallbackValue' => 'getFallbackValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('fallbackValue', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['fallbackValue'] === null) { + $invalidProperties[] = "'fallbackValue' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets fallbackValue + * + * @return string + */ + public function getFallbackValue() + { + return $this->container['fallbackValue']; + } + + /** + * Sets fallbackValue + * + * @param string $fallbackValue Default text. + * + * @return self + */ + public function setFallbackValue($fallbackValue) + { + if (is_null($fallbackValue)) { + throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); + } + $this->container['fallbackValue'] = $fallbackValue; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppLanguage.php b/lib/Model/WhatsAppLanguage.php new file mode 100644 index 0000000..96e31e8 --- /dev/null +++ b/lib/Model/WhatsAppLanguage.php @@ -0,0 +1,448 @@ + + */ +class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppLanguage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'code' => 'string', + 'policy' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'code' => null, + 'policy' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => false, + 'policy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'code' => 'code', + 'policy' => 'policy' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'policy' => 'setPolicy' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'policy' => 'getPolicy' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('policy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Language code + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets policy + * + * @return string|null + */ + public function getPolicy() + { + return $this->container['policy']; + } + + /** + * Sets policy + * + * @param string|null $policy Language policy + * + * @return self + */ + public function setPolicy($policy) + { + if (is_null($policy)) { + throw new \InvalidArgumentException('non-nullable policy cannot be null'); + } + $this->container['policy'] = $policy; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppMedia.php b/lib/Model/WhatsAppMedia.php new file mode 100644 index 0000000..fc7208c --- /dev/null +++ b/lib/Model/WhatsAppMedia.php @@ -0,0 +1,513 @@ + + */ +class WhatsAppMedia implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppMedia'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'link' => 'string', + 'caption' => 'string', + 'filename' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'link' => null, + 'caption' => null, + 'filename' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'link' => false, + 'caption' => false, + 'filename' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'link' => 'link', + 'caption' => 'caption', + 'filename' => 'filename' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'link' => 'setLink', + 'caption' => 'setCaption', + 'filename' => 'setFilename' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'link' => 'getLink', + 'caption' => 'getCaption', + 'filename' => 'getFilename' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('caption', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The media object ID. Do not use this field when message type is set to text. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + return $this; + } + + /** + * Gets caption + * + * @return string|null + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string|null $caption Media asset caption. Do not use with audio or sticker media. + * + * @return self + */ + public function setCaption($caption) + { + if (is_null($caption)) { + throw new \InvalidArgumentException('non-nullable caption cannot be null'); + } + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename() + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Describes the filename for the specific document. Use only with document media. + * + * @return self + */ + public function setFilename($filename) + { + if (is_null($filename)) { + throw new \InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppParameter.php b/lib/Model/WhatsAppParameter.php new file mode 100644 index 0000000..2fb4408 --- /dev/null +++ b/lib/Model/WhatsAppParameter.php @@ -0,0 +1,618 @@ + + */ +class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppParameter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'text' => 'string', + 'currency' => '\Messente\Api\Model\WhatsAppCurrency', + 'dateTime' => '\Messente\Api\Model\WhatsAppDatetime', + 'image' => '\Messente\Api\Model\WhatsAppMedia', + 'document' => '\Messente\Api\Model\WhatsAppMedia', + 'video' => '\Messente\Api\Model\WhatsAppMedia' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'currency' => null, + 'dateTime' => null, + 'image' => null, + 'document' => null, + 'video' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'currency' => false, + 'dateTime' => false, + 'image' => false, + 'document' => false, + 'video' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'currency' => 'currency', + 'dateTime' => 'date_time', + 'image' => 'image', + 'document' => 'document', + 'video' => 'video' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'currency' => 'setCurrency', + 'dateTime' => 'setDateTime', + 'image' => 'setImage', + 'document' => 'setDocument', + 'video' => 'setVideo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'currency' => 'getCurrency', + 'dateTime' => 'getDateTime', + 'image' => 'getImage', + 'document' => 'getDocument', + 'video' => 'getVideo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('dateTime', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('document', $data ?? [], null); + $this->setIfExists('video', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of the parameter. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text A text. + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets currency + * + * @return \Messente\Api\Model\WhatsAppCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Messente\Api\Model\WhatsAppCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets dateTime + * + * @return \Messente\Api\Model\WhatsAppDatetime|null + */ + public function getDateTime() + { + return $this->container['dateTime']; + } + + /** + * Sets dateTime + * + * @param \Messente\Api\Model\WhatsAppDatetime|null $dateTime dateTime + * + * @return self + */ + public function setDateTime($dateTime) + { + if (is_null($dateTime)) { + throw new \InvalidArgumentException('non-nullable dateTime cannot be null'); + } + $this->container['dateTime'] = $dateTime; + + return $this; + } + + /** + * Gets image + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getImage() + { + return $this->container['image']; + } + + /** + * Sets image + * + * @param \Messente\Api\Model\WhatsAppMedia|null $image image + * + * @return self + */ + public function setImage($image) + { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } + $this->container['image'] = $image; + + return $this; + } + + /** + * Gets document + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getDocument() + { + return $this->container['document']; + } + + /** + * Sets document + * + * @param \Messente\Api\Model\WhatsAppMedia|null $document document + * + * @return self + */ + public function setDocument($document) + { + if (is_null($document)) { + throw new \InvalidArgumentException('non-nullable document cannot be null'); + } + $this->container['document'] = $document; + + return $this; + } + + /** + * Gets video + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getVideo() + { + return $this->container['video']; + } + + /** + * Sets video + * + * @param \Messente\Api\Model\WhatsAppMedia|null $video video + * + * @return self + */ + public function setVideo($video) + { + if (is_null($video)) { + throw new \InvalidArgumentException('non-nullable video cannot be null'); + } + $this->container['video'] = $video; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppTemplate.php b/lib/Model/WhatsAppTemplate.php new file mode 100644 index 0000000..06d3d7c --- /dev/null +++ b/lib/Model/WhatsAppTemplate.php @@ -0,0 +1,485 @@ + + */ +class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppTemplate'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'language' => '\Messente\Api\Model\WhatsAppLanguage', + 'components' => '\Messente\Api\Model\WhatsAppComponent[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'language' => null, + 'components' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'language' => false, + 'components' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'language' => 'language', + 'components' => 'components' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'language' => 'setLanguage', + 'components' => 'setComponents' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'language' => 'getLanguage', + 'components' => 'getComponents' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('components', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Name of the template + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets language + * + * @return \Messente\Api\Model\WhatsAppLanguage + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Messente\Api\Model\WhatsAppLanguage $language language + * + * @return self + */ + public function setLanguage($language) + { + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets components + * + * @return \Messente\Api\Model\WhatsAppComponent[]|null + */ + public function getComponents() + { + return $this->container['components']; + } + + /** + * Sets components + * + * @param \Messente\Api\Model\WhatsAppComponent[]|null $components List of template components + * + * @return self + */ + public function setComponents($components) + { + if (is_null($components)) { + throw new \InvalidArgumentException('non-nullable components cannot be null'); + } + $this->container['components'] = $components; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 0000000..6f7fd57 --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,609 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param float|int|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Messente\Api\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..485899a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./lib/Api + ./lib/Model + + + + + ./test/Api + ./test/Model + + + + + + From 0a7d8657001bd65cad739d445826abacfe9f3649 Mon Sep 17 00:00:00 2001 From: api-librarian Date: Tue, 2 Jul 2024 08:20:40 +0000 Subject: [PATCH 5/9] Travis update: Jul 2024 (Build 749) [skip ci] --- .gitignore | 1 - .openapi-generator/FILES | 83 +- .openapi-generator/VERSION | 2 +- .php-cs-fixer.dist.php | 29 - .php_cs | 23 + .travis.yml | 1 + README.md | 34 +- composer.json | 6 +- docs/Api/BlacklistApi.md | 32 +- docs/Api/ContactsApi.md | 76 +- docs/Api/DeliveryReportApi.md | 14 +- docs/Api/GroupsApi.md | 42 +- docs/Api/NumberLookupApi.md | 14 +- docs/Api/OmnimessageApi.md | 22 +- docs/Api/StatisticsApi.md | 14 +- docs/Model/Omnimessage.md | 2 +- docs/Model/OmnimessageMessagesInner.md | 21 - docs/Model/WhatsApp.md | 5 +- .../{WhatsAppDatetime.md => WhatsAppAudio.md} | 4 +- docs/Model/WhatsAppComponent.md | 12 - ...hatsAppCurrency.md => WhatsAppDocument.md} | 7 +- .../{WhatsAppLanguage.md => WhatsAppImage.md} | 6 +- docs/Model/WhatsAppMedia.md | 12 - docs/Model/WhatsAppParameter.md | 15 - docs/Model/WhatsAppTemplate.md | 11 - docs/Model/WhatsAppText.md | 10 + lib/Api/BlacklistApi.php | 317 ++--- lib/Api/ContactsApi.php | 1049 ++++------------- lib/Api/DeliveryReportApi.php | 133 +-- lib/Api/GroupsApi.php | 617 +++------- lib/Api/NumberLookupApi.php | 153 +-- lib/Api/OmnimessageApi.php | 261 +--- lib/Api/StatisticsApi.php | 168 +-- lib/ApiException.php | 5 +- lib/Configuration.php | 81 +- lib/HeaderSelector.php | 209 +--- lib/Model/Channel.php | 12 +- lib/Model/ContactEnvelope.php | 107 +- lib/Model/ContactFields.php | 224 +--- lib/Model/ContactListEnvelope.php | 107 +- lib/Model/ContactResponseFields.php | 237 +--- lib/Model/ContactUpdateFields.php | 218 +--- lib/Model/DeliveryReportResponse.php | 119 +- lib/Model/DeliveryResult.php | 144 +-- lib/Model/ErrorCodeOmnichannel.php | 18 +- lib/Model/ErrorCodeOmnichannelMachine.php | 28 +- lib/Model/ErrorCodePhonebook.php | 16 +- lib/Model/ErrorCodeStatistics.php | 12 +- lib/Model/ErrorItemNumberLookup.php | 107 +- lib/Model/ErrorItemNumberLookupError.php | 113 +- lib/Model/ErrorItemOmnichannel.php | 132 +-- lib/Model/ErrorItemPhonebook.php | 119 +- lib/Model/ErrorItemStatistics.php | 119 +- lib/Model/ErrorNumberLookup.php | 107 +- lib/Model/ErrorOmnichannel.php | 107 +- lib/Model/ErrorPhonebook.php | 107 +- lib/Model/ErrorStatistics.php | 107 +- lib/Model/ErrorTitleOmnichannel.php | 18 +- lib/Model/ErrorTitlePhonebook.php | 16 +- lib/Model/FetchBlacklistSuccess.php | 107 +- lib/Model/GroupEnvelope.php | 107 +- lib/Model/GroupListEnvelope.php | 107 +- lib/Model/GroupName.php | 107 +- lib/Model/GroupResponseFields.php | 132 +-- lib/Model/MessageResult.php | 119 +- lib/Model/MobileNetwork.php | 131 +- lib/Model/ModelInterface.php | 20 +- lib/Model/NumberToBlacklist.php | 107 +- lib/Model/NumbersToInvestigate.php | 107 +- .../OmniMessageCreateSuccessResponse.php | 119 +- lib/Model/Omnimessage.php | 143 +-- lib/Model/OmnimessageMessagesInner.php | 889 -------------- lib/Model/Priority.php | 10 +- lib/Model/SMS.php | 155 +-- lib/Model/StatisticsReport.php | 119 +- lib/Model/StatisticsReportSettings.php | 119 +- lib/Model/StatisticsReportSuccess.php | 107 +- lib/Model/Status.php | 26 +- lib/Model/SyncNumberLookupResult.php | 214 +--- lib/Model/SyncNumberLookupSuccess.php | 113 +- lib/Model/Telegram.php | 147 +-- lib/Model/TextStore.php | 10 +- lib/Model/Viber.php | 153 +-- lib/Model/WhatsApp.php | 251 ++-- ...WhatsAppCurrency.php => WhatsAppAudio.php} | 219 +--- lib/Model/WhatsAppComponent.php | 516 -------- ...tsAppDatetime.php => WhatsAppDocument.php} | 175 +-- ...WhatsAppLanguage.php => WhatsAppImage.php} | 179 +-- lib/Model/WhatsAppMedia.php | 513 -------- lib/Model/WhatsAppParameter.php | 618 ---------- ...{WhatsAppTemplate.php => WhatsAppText.php} | 216 +--- lib/ObjectSerializer.php | 285 +---- test/Api/BlacklistApiTest.php | 122 ++ test/Api/ContactsApiTest.php | 170 +++ test/Api/DeliveryReportApiTest.php | 86 ++ test/Api/GroupsApiTest.php | 134 +++ test/Api/NumberLookupApiTest.php | 86 ++ test/Api/OmnimessageApiTest.php | 98 ++ test/Api/StatisticsApiTest.php | 86 ++ test/Model/ChannelTest.php | 82 ++ test/Model/ContactEnvelopeTest.php | 91 ++ test/Model/ContactFieldsTest.php | 172 +++ test/Model/ContactListEnvelopeTest.php | 91 ++ test/Model/ContactResponseFieldsTest.php | 181 +++ test/Model/ContactUpdateFieldsTest.php | 163 +++ test/Model/DeliveryReportResponseTest.php | 109 ++ test/Model/DeliveryResultTest.php | 136 +++ .../Model/ErrorCodeOmnichannelMachineTest.php | 82 ++ test/Model/ErrorCodeOmnichannelTest.php | 82 ++ test/Model/ErrorCodePhonebookTest.php | 82 ++ test/Model/ErrorCodeStatisticsTest.php | 82 ++ test/Model/ErrorItemNumberLookupErrorTest.php | 100 ++ test/Model/ErrorItemNumberLookupTest.php | 91 ++ test/Model/ErrorItemOmnichannelTest.php | 118 ++ test/Model/ErrorItemPhonebookTest.php | 109 ++ test/Model/ErrorItemStatisticsTest.php | 109 ++ test/Model/ErrorNumberLookupTest.php | 91 ++ test/Model/ErrorOmnichannelTest.php | 91 ++ test/Model/ErrorPhonebookTest.php | 91 ++ test/Model/ErrorStatisticsTest.php | 91 ++ test/Model/ErrorTitleOmnichannelTest.php | 82 ++ test/Model/ErrorTitlePhonebookTest.php | 82 ++ test/Model/FetchBlacklistSuccessTest.php | 91 ++ test/Model/GroupEnvelopeTest.php | 91 ++ test/Model/GroupListEnvelopeTest.php | 91 ++ test/Model/GroupNameTest.php | 91 ++ test/Model/GroupResponseFieldsTest.php | 118 ++ test/Model/MessageResultTest.php | 109 ++ test/Model/MobileNetworkTest.php | 127 ++ test/Model/NumberToBlacklistTest.php | 91 ++ test/Model/NumbersToInvestigateTest.php | 91 ++ .../OmniMessageCreateSuccessResponseTest.php | 109 ++ test/Model/OmnimessageTest.php | 136 +++ test/Model/PriorityTest.php | 82 ++ test/Model/SMSTest.php | 145 +++ test/Model/StatisticsReportSettingsTest.php | 109 ++ test/Model/StatisticsReportSuccessTest.php | 91 ++ test/Model/StatisticsReportTest.php | 109 ++ test/Model/StatusTest.php | 82 ++ test/Model/SyncNumberLookupResultTest.php | 163 +++ test/Model/SyncNumberLookupSuccessTest.php | 100 ++ test/Model/TelegramTest.php | 145 +++ test/Model/TextStoreTest.php | 82 ++ test/Model/ViberTest.php | 154 +++ test/Model/WhatsAppAudioTest.php | 91 ++ test/Model/WhatsAppDocumentTest.php | 100 ++ test/Model/WhatsAppImageTest.php | 100 ++ test/Model/WhatsAppTest.php | 154 +++ test/Model/WhatsAppTextTest.php | 100 ++ 149 files changed, 7910 insertions(+), 10357 deletions(-) delete mode 100644 .php-cs-fixer.dist.php create mode 100644 .php_cs delete mode 100644 docs/Model/OmnimessageMessagesInner.md rename docs/Model/{WhatsAppDatetime.md => WhatsAppAudio.md} (77%) delete mode 100644 docs/Model/WhatsAppComponent.md rename docs/Model/{WhatsAppCurrency.md => WhatsAppDocument.md} (53%) rename docs/Model/{WhatsAppLanguage.md => WhatsAppImage.md} (64%) delete mode 100644 docs/Model/WhatsAppMedia.md delete mode 100644 docs/Model/WhatsAppParameter.md delete mode 100644 docs/Model/WhatsAppTemplate.md create mode 100644 docs/Model/WhatsAppText.md delete mode 100644 lib/Model/OmnimessageMessagesInner.php rename lib/Model/{WhatsAppCurrency.php => WhatsAppAudio.php} (52%) delete mode 100644 lib/Model/WhatsAppComponent.php rename lib/Model/{WhatsAppDatetime.php => WhatsAppDocument.php} (63%) rename lib/Model/{WhatsAppLanguage.php => WhatsAppImage.php} (60%) delete mode 100644 lib/Model/WhatsAppMedia.php delete mode 100644 lib/Model/WhatsAppParameter.php rename lib/Model/{WhatsAppTemplate.php => WhatsAppText.php} (54%) create mode 100644 test/Api/BlacklistApiTest.php create mode 100644 test/Api/ContactsApiTest.php create mode 100644 test/Api/DeliveryReportApiTest.php create mode 100644 test/Api/GroupsApiTest.php create mode 100644 test/Api/NumberLookupApiTest.php create mode 100644 test/Api/OmnimessageApiTest.php create mode 100644 test/Api/StatisticsApiTest.php create mode 100644 test/Model/ChannelTest.php create mode 100644 test/Model/ContactEnvelopeTest.php create mode 100644 test/Model/ContactFieldsTest.php create mode 100644 test/Model/ContactListEnvelopeTest.php create mode 100644 test/Model/ContactResponseFieldsTest.php create mode 100644 test/Model/ContactUpdateFieldsTest.php create mode 100644 test/Model/DeliveryReportResponseTest.php create mode 100644 test/Model/DeliveryResultTest.php create mode 100644 test/Model/ErrorCodeOmnichannelMachineTest.php create mode 100644 test/Model/ErrorCodeOmnichannelTest.php create mode 100644 test/Model/ErrorCodePhonebookTest.php create mode 100644 test/Model/ErrorCodeStatisticsTest.php create mode 100644 test/Model/ErrorItemNumberLookupErrorTest.php create mode 100644 test/Model/ErrorItemNumberLookupTest.php create mode 100644 test/Model/ErrorItemOmnichannelTest.php create mode 100644 test/Model/ErrorItemPhonebookTest.php create mode 100644 test/Model/ErrorItemStatisticsTest.php create mode 100644 test/Model/ErrorNumberLookupTest.php create mode 100644 test/Model/ErrorOmnichannelTest.php create mode 100644 test/Model/ErrorPhonebookTest.php create mode 100644 test/Model/ErrorStatisticsTest.php create mode 100644 test/Model/ErrorTitleOmnichannelTest.php create mode 100644 test/Model/ErrorTitlePhonebookTest.php create mode 100644 test/Model/FetchBlacklistSuccessTest.php create mode 100644 test/Model/GroupEnvelopeTest.php create mode 100644 test/Model/GroupListEnvelopeTest.php create mode 100644 test/Model/GroupNameTest.php create mode 100644 test/Model/GroupResponseFieldsTest.php create mode 100644 test/Model/MessageResultTest.php create mode 100644 test/Model/MobileNetworkTest.php create mode 100644 test/Model/NumberToBlacklistTest.php create mode 100644 test/Model/NumbersToInvestigateTest.php create mode 100644 test/Model/OmniMessageCreateSuccessResponseTest.php create mode 100644 test/Model/OmnimessageTest.php create mode 100644 test/Model/PriorityTest.php create mode 100644 test/Model/SMSTest.php create mode 100644 test/Model/StatisticsReportSettingsTest.php create mode 100644 test/Model/StatisticsReportSuccessTest.php create mode 100644 test/Model/StatisticsReportTest.php create mode 100644 test/Model/StatusTest.php create mode 100644 test/Model/SyncNumberLookupResultTest.php create mode 100644 test/Model/SyncNumberLookupSuccessTest.php create mode 100644 test/Model/TelegramTest.php create mode 100644 test/Model/TextStoreTest.php create mode 100644 test/Model/ViberTest.php create mode 100644 test/Model/WhatsAppAudioTest.php create mode 100644 test/Model/WhatsAppDocumentTest.php create mode 100644 test/Model/WhatsAppImageTest.php create mode 100644 test/Model/WhatsAppTest.php create mode 100644 test/Model/WhatsAppTextTest.php diff --git a/.gitignore b/.gitignore index 9f1681c..92f7fde 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ composer.phar # php-cs-fixer cache .php_cs.cache -.php-cs-fixer.cache # PHPUnit cache .phpunit.result.cache diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0f2a994..274bcd7 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,6 @@ .gitignore .openapi-generator-ignore -.php-cs-fixer.dist.php +.php_cs .travis.yml README.md composer.json @@ -45,7 +45,6 @@ docs/Model/NumberToBlacklist.md docs/Model/NumbersToInvestigate.md docs/Model/OmniMessageCreateSuccessResponse.md docs/Model/Omnimessage.md -docs/Model/OmnimessageMessagesInner.md docs/Model/Priority.md docs/Model/SMS.md docs/Model/StatisticsReport.md @@ -58,13 +57,10 @@ docs/Model/Telegram.md docs/Model/TextStore.md docs/Model/Viber.md docs/Model/WhatsApp.md -docs/Model/WhatsAppComponent.md -docs/Model/WhatsAppCurrency.md -docs/Model/WhatsAppDatetime.md -docs/Model/WhatsAppLanguage.md -docs/Model/WhatsAppMedia.md -docs/Model/WhatsAppParameter.md -docs/Model/WhatsAppTemplate.md +docs/Model/WhatsAppAudio.md +docs/Model/WhatsAppDocument.md +docs/Model/WhatsAppImage.md +docs/Model/WhatsAppText.md git_push.sh lib/Api/BlacklistApi.php lib/Api/ContactsApi.php @@ -111,7 +107,6 @@ lib/Model/NumberToBlacklist.php lib/Model/NumbersToInvestigate.php lib/Model/OmniMessageCreateSuccessResponse.php lib/Model/Omnimessage.php -lib/Model/OmnimessageMessagesInner.php lib/Model/Priority.php lib/Model/SMS.php lib/Model/StatisticsReport.php @@ -124,12 +119,66 @@ lib/Model/Telegram.php lib/Model/TextStore.php lib/Model/Viber.php lib/Model/WhatsApp.php -lib/Model/WhatsAppComponent.php -lib/Model/WhatsAppCurrency.php -lib/Model/WhatsAppDatetime.php -lib/Model/WhatsAppLanguage.php -lib/Model/WhatsAppMedia.php -lib/Model/WhatsAppParameter.php -lib/Model/WhatsAppTemplate.php +lib/Model/WhatsAppAudio.php +lib/Model/WhatsAppDocument.php +lib/Model/WhatsAppImage.php +lib/Model/WhatsAppText.php lib/ObjectSerializer.php phpunit.xml.dist +test/Api/BlacklistApiTest.php +test/Api/ContactsApiTest.php +test/Api/DeliveryReportApiTest.php +test/Api/GroupsApiTest.php +test/Api/NumberLookupApiTest.php +test/Api/OmnimessageApiTest.php +test/Api/StatisticsApiTest.php +test/Model/ChannelTest.php +test/Model/ContactEnvelopeTest.php +test/Model/ContactFieldsTest.php +test/Model/ContactListEnvelopeTest.php +test/Model/ContactResponseFieldsTest.php +test/Model/ContactUpdateFieldsTest.php +test/Model/DeliveryReportResponseTest.php +test/Model/DeliveryResultTest.php +test/Model/ErrorCodeOmnichannelMachineTest.php +test/Model/ErrorCodeOmnichannelTest.php +test/Model/ErrorCodePhonebookTest.php +test/Model/ErrorCodeStatisticsTest.php +test/Model/ErrorItemNumberLookupErrorTest.php +test/Model/ErrorItemNumberLookupTest.php +test/Model/ErrorItemOmnichannelTest.php +test/Model/ErrorItemPhonebookTest.php +test/Model/ErrorItemStatisticsTest.php +test/Model/ErrorNumberLookupTest.php +test/Model/ErrorOmnichannelTest.php +test/Model/ErrorPhonebookTest.php +test/Model/ErrorStatisticsTest.php +test/Model/ErrorTitleOmnichannelTest.php +test/Model/ErrorTitlePhonebookTest.php +test/Model/FetchBlacklistSuccessTest.php +test/Model/GroupEnvelopeTest.php +test/Model/GroupListEnvelopeTest.php +test/Model/GroupNameTest.php +test/Model/GroupResponseFieldsTest.php +test/Model/MessageResultTest.php +test/Model/MobileNetworkTest.php +test/Model/NumberToBlacklistTest.php +test/Model/NumbersToInvestigateTest.php +test/Model/OmniMessageCreateSuccessResponseTest.php +test/Model/OmnimessageTest.php +test/Model/PriorityTest.php +test/Model/SMSTest.php +test/Model/StatisticsReportSettingsTest.php +test/Model/StatisticsReportSuccessTest.php +test/Model/StatisticsReportTest.php +test/Model/StatusTest.php +test/Model/SyncNumberLookupResultTest.php +test/Model/SyncNumberLookupSuccessTest.php +test/Model/TelegramTest.php +test/Model/TextStoreTest.php +test/Model/ViberTest.php +test/Model/WhatsAppAudioTest.php +test/Model/WhatsAppDocumentTest.php +test/Model/WhatsAppImageTest.php +test/Model/WhatsAppTest.php +test/Model/WhatsAppTextTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 93c8dda..e230c83 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.6.0 +5.3.0 \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php deleted file mode 100644 index af9cf39..0000000 --- a/.php-cs-fixer.dist.php +++ /dev/null @@ -1,29 +0,0 @@ -in(__DIR__) - ->exclude('vendor') - ->exclude('test') - ->exclude('tests') -; - -$config = new PhpCsFixer\Config(); -return $config->setRules([ - '@PSR12' => true, - 'phpdoc_order' => true, - 'array_syntax' => [ 'syntax' => 'short' ], - 'strict_comparison' => true, - 'strict_param' => true, - 'no_trailing_whitespace' => false, - 'no_trailing_whitespace_in_comment' => false, - 'braces' => false, - 'single_blank_line_at_eof' => false, - 'blank_line_after_namespace' => false, - 'no_leading_import_slash' => false, - ]) - ->setFinder($finder) -; diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..4fbe53e --- /dev/null +++ b/.php_cs @@ -0,0 +1,23 @@ +setUsingCache(true) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/.travis.yml b/.travis.yml index 667b815..714772e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php # https://docs.travis-ci.com/user/reference/bionic/#php-support dist: bionic php: + - 7.3 - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/README.md b/README.md index 3ad019b..9611f74 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Messente API Library - Messente API version: 2.0.0 -- PHP artifact version: 3.0.0 +- PHP artifact version: 2.1.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. @@ -73,14 +73,13 @@ Read the [external getting-started article](https://messente.com/documentation/g "Hello SMS!", "sender" => "MySmsSender"] ); -$whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; -$whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); -$whatsAppLanguage = new WhatsAppLanguage(['code' => '']); -$whatsAppTemplate = new WhatsAppTemplate( - [ - 'name'=> '', - 'language'=> $whatsAppLanguage, - 'components' => [$whatsAppComponent] - ] -); + +$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]); $whatsapp = new WhatsApp( - [ - 'sender' => '', - 'template' => $whatsAppTemplate, - ] + ['text' => $whatsAppText, "sender" => "MyWhatsAppSender"] ); $omnimessage->setMessages([$whatsapp, $viber, $sms]); diff --git a/composer.json b/composer.json index 9985e13..5c1fe20 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "messente/messente-api-php", - "version": "3.0.0", + "version": "2.1.0", "description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.", "keywords": ["viber", "telegram", "sms", "whatsapp", "phonebook", "openapitools", "openapi-generator", @@ -26,6 +26,10 @@ "guzzlehttp/guzzle": "^6.2 || ^7.0", "guzzlehttp/psr7": "^1.8" }, + "require-dev": { + "phpunit/phpunit": "^7.4", + "friendsofphp/php-cs-fixer": "^2.12" + }, "autoload": { "psr-4": { "Messente\\Api\\" : "lib/" } }, diff --git a/docs/Api/BlacklistApi.md b/docs/Api/BlacklistApi.md index 26c6414..7bd8656 100644 --- a/docs/Api/BlacklistApi.md +++ b/docs/Api/BlacklistApi.md @@ -1,13 +1,13 @@ # Messente\Api\BlacklistApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist | -| [**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist | -| [**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers | -| [**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist +[**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist +[**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers +[**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted ## `addToBlacklist()` @@ -48,9 +48,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | ### Return type @@ -223,9 +223,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | ### Return type diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md index a99a3ad..970e008 100644 --- a/docs/Api/ContactsApi.md +++ b/docs/Api/ContactsApi.md @@ -1,17 +1,17 @@ # Messente\Api\ContactsApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group | -| [**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact | -| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact | -| [**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact | -| [**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact | -| [**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts | -| [**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group | -| [**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group +[**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact +[**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact +[**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact +[**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact +[**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts +[**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group +[**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact ## `addContactToGroup()` @@ -54,10 +54,10 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupId** | **string**| String in UUID format | + **phone** | **string**| A phone number | ### Return type @@ -115,9 +115,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | ### Return type @@ -174,9 +174,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | ### Return type @@ -234,9 +234,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | ### Return type @@ -294,9 +294,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | ### Return type @@ -354,9 +354,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] ### Return type @@ -414,10 +414,10 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **phone** | **string**| A phone number | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupId** | **string**| String in UUID format | + **phone** | **string**| A phone number | ### Return type @@ -476,10 +476,10 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **phone** | **string**| A phone number | | -| **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **phone** | **string**| A phone number | + **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | ### Return type diff --git a/docs/Api/DeliveryReportApi.md b/docs/Api/DeliveryReportApi.md index 622fe6f..ef62c6f 100644 --- a/docs/Api/DeliveryReportApi.md +++ b/docs/Api/DeliveryReportApi.md @@ -1,10 +1,10 @@ # Messente\Api\DeliveryReportApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage ## `retrieveDeliveryReport()` @@ -46,9 +46,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | ### Return type diff --git a/docs/Api/GroupsApi.md b/docs/Api/GroupsApi.md index 8ad8bb9..f511a0e 100644 --- a/docs/Api/GroupsApi.md +++ b/docs/Api/GroupsApi.md @@ -1,14 +1,14 @@ # Messente\Api\GroupsApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name | -| [**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group | -| [**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group | -| [**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups | -| [**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name +[**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group +[**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group +[**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups +[**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name ## `createGroup()` @@ -50,9 +50,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | ### Return type @@ -109,9 +109,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupId** | **string**| String in UUID format | ### Return type @@ -169,9 +169,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupId** | **string**| String in UUID format | ### Return type @@ -287,10 +287,10 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **groupId** | **string**| String in UUID format | | -| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **groupId** | **string**| String in UUID format | + **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | ### Return type diff --git a/docs/Api/NumberLookupApi.md b/docs/Api/NumberLookupApi.md index 01fa35c..c671dfe 100644 --- a/docs/Api/NumberLookupApi.md +++ b/docs/Api/NumberLookupApi.md @@ -1,10 +1,10 @@ # Messente\Api\NumberLookupApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers ## `fetchInfo()` @@ -46,9 +46,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | ### Return type diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md index b4317da..c07dc9b 100644 --- a/docs/Api/OmnimessageApi.md +++ b/docs/Api/OmnimessageApi.md @@ -1,11 +1,11 @@ # Messente\Api\OmnimessageApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | -| [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage +[**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage ## `cancelScheduledMessage()` @@ -47,9 +47,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | ### Return type diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md index be19360..4cfe438 100644 --- a/docs/Api/StatisticsApi.md +++ b/docs/Api/StatisticsApi.md @@ -1,10 +1,10 @@ # Messente\Api\StatisticsApi -All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. +All URIs are relative to https://api.messente.com/v1. -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country | +Method | HTTP request | Description +------------- | ------------- | ------------- +[**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country ## `createStatisticsReport()` @@ -46,9 +46,9 @@ try { ### Parameters -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | | +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | ### Return type diff --git a/docs/Model/Omnimessage.md b/docs/Model/Omnimessage.md index b5d8079..9f218f0 100644 --- a/docs/Model/Omnimessage.md +++ b/docs/Model/Omnimessage.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **to** | **string** | Phone number in e.164 format | -**messages** | [**\Messente\Api\Model\OmnimessageMessagesInner[]**](OmnimessageMessagesInner.md) | An array of messages | +**messages** | [**OneOfViberSMSWhatsAppTelegram[]**](OneOfViberSMSWhatsAppTelegram.md) | An array of messages | **dlrUrl** | **string** | URL where the delivery report will be sent | [optional] **textStore** | [**\Messente\Api\Model\TextStore**](TextStore.md) | | [optional] **timeToSend** | **\DateTime** | Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) | [optional] diff --git a/docs/Model/OmnimessageMessagesInner.md b/docs/Model/OmnimessageMessagesInner.md deleted file mode 100644 index fa0bdf7..0000000 --- a/docs/Model/OmnimessageMessagesInner.md +++ /dev/null @@ -1,21 +0,0 @@ -# # OmnimessageMessagesInner - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**sender** | **string** | Phone number or alphanumeric sender name | [optional] -**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] -**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**text** | **string** | Plaintext content for Telegram | -**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] -**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] -**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] -**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] -**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] -**udh** | **string** | hex-encoded string containing SMS UDH | [optional] -**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] -**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] -**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsApp.md b/docs/Model/WhatsApp.md index ae5bbdd..95aab88 100644 --- a/docs/Model/WhatsApp.md +++ b/docs/Model/WhatsApp.md @@ -7,7 +7,10 @@ Name | Type | Description | Notes **sender** | **string** | Phone number or alphanumeric sender name | [optional] **validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] **ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**text** | [**\Messente\Api\Model\WhatsAppText**](WhatsAppText.md) | | [optional] +**image** | [**\Messente\Api\Model\WhatsAppImage**](WhatsAppImage.md) | | [optional] +**document** | [**\Messente\Api\Model\WhatsAppDocument**](WhatsAppDocument.md) | | [optional] +**audio** | [**\Messente\Api\Model\WhatsAppAudio**](WhatsAppAudio.md) | | [optional] **channel** | **string** | The channel used to deliver the message | [optional] [default to 'whatsapp'] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppDatetime.md b/docs/Model/WhatsAppAudio.md similarity index 77% rename from docs/Model/WhatsAppDatetime.md rename to docs/Model/WhatsAppAudio.md index 571a030..ff0e201 100644 --- a/docs/Model/WhatsAppDatetime.md +++ b/docs/Model/WhatsAppAudio.md @@ -1,9 +1,9 @@ -# # WhatsAppDatetime +# # WhatsAppAudio ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fallbackValue** | **string** | Default text. | +**content** | **string** | Base64-encoded audio | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppComponent.md b/docs/Model/WhatsAppComponent.md deleted file mode 100644 index 8e0104c..0000000 --- a/docs/Model/WhatsAppComponent.md +++ /dev/null @@ -1,12 +0,0 @@ -# # WhatsAppComponent - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **string** | Type of the component | -**subType** | **string** | Sub-type of the component | [optional] -**index** | **int** | index used to position buttons | [optional] -**parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppCurrency.md b/docs/Model/WhatsAppDocument.md similarity index 53% rename from docs/Model/WhatsAppCurrency.md rename to docs/Model/WhatsAppDocument.md index 660a79e..1183cd3 100644 --- a/docs/Model/WhatsAppCurrency.md +++ b/docs/Model/WhatsAppDocument.md @@ -1,11 +1,10 @@ -# # WhatsAppCurrency +# # WhatsAppDocument ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**fallbackValue** | **string** | Default text if localization fails. | -**code** | **string** | Currency code as defined in ISO 4217. | -**amount1000** | **string** | Amount multiplied by 1000. | +**caption** | **string** | Description for the document | [optional] +**content** | **string** | Base64-encoded image | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppLanguage.md b/docs/Model/WhatsAppImage.md similarity index 64% rename from docs/Model/WhatsAppLanguage.md rename to docs/Model/WhatsAppImage.md index d202598..fff678f 100644 --- a/docs/Model/WhatsAppLanguage.md +++ b/docs/Model/WhatsAppImage.md @@ -1,10 +1,10 @@ -# # WhatsAppLanguage +# # WhatsAppImage ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **string** | Language code | -**policy** | **string** | Language policy | [optional] +**caption** | **string** | Description for the image | [optional] +**content** | **string** | Base64-encoded image | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppMedia.md b/docs/Model/WhatsAppMedia.md deleted file mode 100644 index 085f11c..0000000 --- a/docs/Model/WhatsAppMedia.md +++ /dev/null @@ -1,12 +0,0 @@ -# # WhatsAppMedia - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **string** | The media object ID. Do not use this field when message type is set to text. | [optional] -**link** | **string** | The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. | [optional] -**caption** | **string** | Media asset caption. Do not use with audio or sticker media. | [optional] -**filename** | **string** | Describes the filename for the specific document. Use only with document media. | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppParameter.md b/docs/Model/WhatsAppParameter.md deleted file mode 100644 index 6cbabae..0000000 --- a/docs/Model/WhatsAppParameter.md +++ /dev/null @@ -1,15 +0,0 @@ -# # WhatsAppParameter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **string** | Type of the parameter. | -**text** | **string** | A text. | [optional] -**currency** | [**\Messente\Api\Model\WhatsAppCurrency**](WhatsAppCurrency.md) | | [optional] -**dateTime** | [**\Messente\Api\Model\WhatsAppDatetime**](WhatsAppDatetime.md) | | [optional] -**image** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] -**document** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] -**video** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppTemplate.md b/docs/Model/WhatsAppTemplate.md deleted file mode 100644 index a63f2a3..0000000 --- a/docs/Model/WhatsAppTemplate.md +++ /dev/null @@ -1,11 +0,0 @@ -# # WhatsAppTemplate - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **string** | Name of the template | -**language** | [**\Messente\Api\Model\WhatsAppLanguage**](WhatsAppLanguage.md) | | -**components** | [**\Messente\Api\Model\WhatsAppComponent[]**](WhatsAppComponent.md) | List of template components | [optional] - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppText.md b/docs/Model/WhatsAppText.md new file mode 100644 index 0000000..5a801c0 --- /dev/null +++ b/docs/Model/WhatsAppText.md @@ -0,0 +1,10 @@ +# # WhatsAppText + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**previewUrl** | **bool** | Whether to display link preview if the message contains a hyperlink | [optional] [default to true] +**body** | **string** | Plaintext content for WhatsApp, can contain URLs, emojis and formatting | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/BlacklistApi.php b/lib/Api/BlacklistApi.php index bec68a5..dfa0ecd 100644 --- a/lib/Api/BlacklistApi.php +++ b/lib/Api/BlacklistApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - 'deleteFromBlacklist' => [ - 'application/json', - ], - 'fetchBlacklist' => [ - 'application/json', - ], - 'isBlacklisted' => [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -138,15 +122,14 @@ public function getConfig() * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function addToBlacklist($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + public function addToBlacklist($numberToBlacklist) { - $this->addToBlacklistWithHttpInfo($numberToBlacklist, $contentType); + $this->addToBlacklistWithHttpInfo($numberToBlacklist); } /** @@ -155,15 +138,14 @@ public function addToBlacklist($numberToBlacklist, string $contentType = self::c * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + public function addToBlacklistWithHttpInfo($numberToBlacklist) { - $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); + $request = $this->addToBlacklistRequest($numberToBlacklist); try { $options = $this->createHttpClientOption(); @@ -247,14 +229,13 @@ public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentTy * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsync($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + public function addToBlacklistAsync($numberToBlacklist) { - return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist, $contentType) + return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist) ->then( function ($response) { return $response[0]; @@ -268,15 +249,14 @@ function ($response) { * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist) { $returnType = ''; - $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); + $request = $this->addToBlacklistRequest($numberToBlacklist); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -305,14 +285,12 @@ function ($exception) { * Create request for operation 'addToBlacklist' * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addToBlacklistRequest($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) + public function addToBlacklistRequest($numberToBlacklist) { - // verify the required parameter 'numberToBlacklist' is set if ($numberToBlacklist === null || (is_array($numberToBlacklist) && count($numberToBlacklist) === 0)) { throw new \InvalidArgumentException( @@ -320,7 +298,6 @@ public function addToBlacklistRequest($numberToBlacklist, string $contentType = ); } - $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -332,17 +309,21 @@ public function addToBlacklistRequest($numberToBlacklist, string $contentType = - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($numberToBlacklist)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); } else { $httpBody = $numberToBlacklist; } @@ -361,12 +342,12 @@ public function addToBlacklistRequest($numberToBlacklist, string $contentType = // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -386,11 +367,10 @@ public function addToBlacklistRequest($numberToBlacklist, string $contentType = $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -402,15 +382,14 @@ public function addToBlacklistRequest($numberToBlacklist, string $contentType = * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function deleteFromBlacklist($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + public function deleteFromBlacklist($phone) { - $this->deleteFromBlacklistWithHttpInfo($phone, $contentType); + $this->deleteFromBlacklistWithHttpInfo($phone); } /** @@ -419,15 +398,14 @@ public function deleteFromBlacklist($phone, string $contentType = self::contentT * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + public function deleteFromBlacklistWithHttpInfo($phone) { - $request = $this->deleteFromBlacklistRequest($phone, $contentType); + $request = $this->deleteFromBlacklistRequest($phone); try { $options = $this->createHttpClientOption(); @@ -511,14 +489,13 @@ public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = se * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsync($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + public function deleteFromBlacklistAsync($phone) { - return $this->deleteFromBlacklistAsyncWithHttpInfo($phone, $contentType) + return $this->deleteFromBlacklistAsyncWithHttpInfo($phone) ->then( function ($response) { return $response[0]; @@ -532,15 +509,14 @@ function ($response) { * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + public function deleteFromBlacklistAsyncWithHttpInfo($phone) { $returnType = ''; - $request = $this->deleteFromBlacklistRequest($phone, $contentType); + $request = $this->deleteFromBlacklistRequest($phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -569,14 +545,12 @@ function ($exception) { * Create request for operation 'deleteFromBlacklist' * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteFromBlacklistRequest($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) + public function deleteFromBlacklistRequest($phone) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -584,7 +558,6 @@ public function deleteFromBlacklistRequest($phone, string $contentType = self::c ); } - $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -604,11 +577,16 @@ public function deleteFromBlacklistRequest($phone, string $contentType = self::c } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -626,12 +604,12 @@ public function deleteFromBlacklistRequest($phone, string $contentType = self::c // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -651,11 +629,10 @@ public function deleteFromBlacklistRequest($phone, string $contentType = self::c $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -666,15 +643,14 @@ public function deleteFromBlacklistRequest($phone, string $contentType = self::c * * Returns all blacklisted phone numbers * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchBlacklist(string $contentType = self::contentTypes['fetchBlacklist'][0]) + public function fetchBlacklist() { - list($response) = $this->fetchBlacklistWithHttpInfo($contentType); + list($response) = $this->fetchBlacklistWithHttpInfo(); return $response; } @@ -683,15 +659,14 @@ public function fetchBlacklist(string $contentType = self::contentTypes['fetchBl * * Returns all blacklisted phone numbers * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) + public function fetchBlacklistWithHttpInfo() { - $request = $this->fetchBlacklistRequest($contentType); + $request = $this->fetchBlacklistRequest(); try { $options = $this->createHttpClientOption(); @@ -734,21 +709,6 @@ public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTy $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\FetchBlacklistSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -761,21 +721,6 @@ public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTy $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -788,21 +733,6 @@ public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTy $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -817,21 +747,6 @@ public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTy $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -876,14 +791,13 @@ public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTy * * Returns all blacklisted phone numbers * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsync(string $contentType = self::contentTypes['fetchBlacklist'][0]) + public function fetchBlacklistAsync() { - return $this->fetchBlacklistAsyncWithHttpInfo($contentType) + return $this->fetchBlacklistAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -896,15 +810,14 @@ function ($response) { * * Returns all blacklisted phone numbers * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) + public function fetchBlacklistAsyncWithHttpInfo() { $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; - $request = $this->fetchBlacklistRequest($contentType); + $request = $this->fetchBlacklistRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -914,9 +827,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -945,15 +855,13 @@ function ($exception) { /** * Create request for operation 'fetchBlacklist' * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchBlacklistRequest(string $contentType = self::contentTypes['fetchBlacklist'][0]) + public function fetchBlacklistRequest() { - $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -965,11 +873,16 @@ public function fetchBlacklistRequest(string $contentType = self::contentTypes[' - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -987,12 +900,12 @@ public function fetchBlacklistRequest(string $contentType = self::contentTypes[' // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1012,11 +925,10 @@ public function fetchBlacklistRequest(string $contentType = self::contentTypes[' $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1028,15 +940,14 @@ public function fetchBlacklistRequest(string $contentType = self::contentTypes[' * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function isBlacklisted($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + public function isBlacklisted($phone) { - $this->isBlacklistedWithHttpInfo($phone, $contentType); + $this->isBlacklistedWithHttpInfo($phone); } /** @@ -1045,15 +956,14 @@ public function isBlacklisted($phone, string $contentType = self::contentTypes[' * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function isBlacklistedWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + public function isBlacklistedWithHttpInfo($phone) { - $request = $this->isBlacklistedRequest($phone, $contentType); + $request = $this->isBlacklistedRequest($phone); try { $options = $this->createHttpClientOption(); @@ -1129,14 +1039,13 @@ public function isBlacklistedWithHttpInfo($phone, string $contentType = self::co * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsync($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + public function isBlacklistedAsync($phone) { - return $this->isBlacklistedAsyncWithHttpInfo($phone, $contentType) + return $this->isBlacklistedAsyncWithHttpInfo($phone) ->then( function ($response) { return $response[0]; @@ -1150,15 +1059,14 @@ function ($response) { * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + public function isBlacklistedAsyncWithHttpInfo($phone) { $returnType = ''; - $request = $this->isBlacklistedRequest($phone, $contentType); + $request = $this->isBlacklistedRequest($phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1187,14 +1095,12 @@ function ($exception) { * Create request for operation 'isBlacklisted' * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function isBlacklistedRequest($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) + public function isBlacklistedRequest($phone) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1202,7 +1108,6 @@ public function isBlacklistedRequest($phone, string $contentType = self::content ); } - $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -1222,11 +1127,16 @@ public function isBlacklistedRequest($phone, string $contentType = self::content } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -1244,12 +1154,12 @@ public function isBlacklistedRequest($phone, string $contentType = self::content // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1269,11 +1179,10 @@ public function isBlacklistedRequest($phone, string $contentType = self::content $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php index 4b8ca37..73fc90b 100644 --- a/lib/Api/ContactsApi.php +++ b/lib/Api/ContactsApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - 'createContact' => [ - 'application/json', - ], - 'deleteContact' => [ - 'application/json', - ], - 'fetchContact' => [ - 'application/json', - ], - 'fetchContactGroups' => [ - 'application/json', - ], - 'fetchContacts' => [ - 'application/json', - ], - 'removeContactFromGroup' => [ - 'application/json', - ], - 'updateContact' => [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -151,15 +123,14 @@ public function getConfig() * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function addContactToGroup($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + public function addContactToGroup($groupId, $phone) { - list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone, $contentType); + list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone); return $response; } @@ -170,15 +141,14 @@ public function addContactToGroup($groupId, $phone, string $contentType = self:: * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + public function addContactToGroupWithHttpInfo($groupId, $phone) { - $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); + $request = $this->addContactToGroupRequest($groupId, $phone); try { $options = $this->createHttpClientOption(); @@ -221,21 +191,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('object' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -248,21 +203,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -275,21 +215,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -302,21 +227,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -329,21 +239,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -356,21 +251,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -385,21 +265,6 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -470,14 +335,13 @@ public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentT * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsync($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + public function addContactToGroupAsync($groupId, $phone) { - return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone, $contentType) + return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone) ->then( function ($response) { return $response[0]; @@ -492,15 +356,14 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + public function addContactToGroupAsyncWithHttpInfo($groupId, $phone) { $returnType = 'object'; - $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); + $request = $this->addContactToGroupRequest($groupId, $phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -510,9 +373,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -543,21 +403,18 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addContactToGroupRequest($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) + public function addContactToGroupRequest($groupId, $phone) { - // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling addContactToGroup' ); } - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -565,7 +422,6 @@ public function addContactToGroupRequest($groupId, $phone, string $contentType = ); } - $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -593,11 +449,16 @@ public function addContactToGroupRequest($groupId, $phone, string $contentType = } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -615,12 +476,12 @@ public function addContactToGroupRequest($groupId, $phone, string $contentType = // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -640,11 +501,10 @@ public function addContactToGroupRequest($groupId, $phone, string $contentType = $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -656,15 +516,14 @@ public function addContactToGroupRequest($groupId, $phone, string $contentType = * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createContact($contactFields, string $contentType = self::contentTypes['createContact'][0]) + public function createContact($contactFields) { - list($response) = $this->createContactWithHttpInfo($contactFields, $contentType); + list($response) = $this->createContactWithHttpInfo($contactFields); return $response; } @@ -674,15 +533,14 @@ public function createContact($contactFields, string $contentType = self::conten * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createContactWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) + public function createContactWithHttpInfo($contactFields) { - $request = $this->createContactRequest($contactFields, $contentType); + $request = $this->createContactRequest($contactFields); try { $options = $this->createHttpClientOption(); @@ -725,21 +583,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -752,21 +595,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -779,21 +607,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -806,21 +619,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -833,21 +631,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -862,21 +645,6 @@ public function createContactWithHttpInfo($contactFields, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -938,14 +706,13 @@ public function createContactWithHttpInfo($contactFields, string $contentType = * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsync($contactFields, string $contentType = self::contentTypes['createContact'][0]) + public function createContactAsync($contactFields) { - return $this->createContactAsyncWithHttpInfo($contactFields, $contentType) + return $this->createContactAsyncWithHttpInfo($contactFields) ->then( function ($response) { return $response[0]; @@ -959,15 +726,14 @@ function ($response) { * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsyncWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) + public function createContactAsyncWithHttpInfo($contactFields) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->createContactRequest($contactFields, $contentType); + $request = $this->createContactRequest($contactFields); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -977,9 +743,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1009,14 +772,12 @@ function ($exception) { * Create request for operation 'createContact' * * @param \Messente\Api\Model\ContactFields $contactFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createContactRequest($contactFields, string $contentType = self::contentTypes['createContact'][0]) + public function createContactRequest($contactFields) { - // verify the required parameter 'contactFields' is set if ($contactFields === null || (is_array($contactFields) && count($contactFields) === 0)) { throw new \InvalidArgumentException( @@ -1024,7 +785,6 @@ public function createContactRequest($contactFields, string $contentType = self: ); } - $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -1036,17 +796,21 @@ public function createContactRequest($contactFields, string $contentType = self: - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($contactFields)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactFields)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactFields)); } else { $httpBody = $contactFields; } @@ -1065,12 +829,12 @@ public function createContactRequest($contactFields, string $contentType = self: // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1090,11 +854,10 @@ public function createContactRequest($contactFields, string $contentType = self: $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1106,15 +869,14 @@ public function createContactRequest($contactFields, string $contentType = self: * Deletes a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function deleteContact($phone, string $contentType = self::contentTypes['deleteContact'][0]) + public function deleteContact($phone) { - $this->deleteContactWithHttpInfo($phone, $contentType); + $this->deleteContactWithHttpInfo($phone); } /** @@ -1123,15 +885,14 @@ public function deleteContact($phone, string $contentType = self::contentTypes[' * Deletes a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteContactWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) + public function deleteContactWithHttpInfo($phone) { - $request = $this->deleteContactRequest($phone, $contentType); + $request = $this->deleteContactRequest($phone); try { $options = $this->createHttpClientOption(); @@ -1215,14 +976,13 @@ public function deleteContactWithHttpInfo($phone, string $contentType = self::co * Deletes a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsync($phone, string $contentType = self::contentTypes['deleteContact'][0]) + public function deleteContactAsync($phone) { - return $this->deleteContactAsyncWithHttpInfo($phone, $contentType) + return $this->deleteContactAsyncWithHttpInfo($phone) ->then( function ($response) { return $response[0]; @@ -1236,15 +996,14 @@ function ($response) { * Deletes a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) + public function deleteContactAsyncWithHttpInfo($phone) { $returnType = ''; - $request = $this->deleteContactRequest($phone, $contentType); + $request = $this->deleteContactRequest($phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1273,14 +1032,12 @@ function ($exception) { * Create request for operation 'deleteContact' * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteContactRequest($phone, string $contentType = self::contentTypes['deleteContact'][0]) + public function deleteContactRequest($phone) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1288,7 +1045,6 @@ public function deleteContactRequest($phone, string $contentType = self::content ); } - $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1308,11 +1064,16 @@ public function deleteContactRequest($phone, string $contentType = self::content } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -1330,12 +1091,12 @@ public function deleteContactRequest($phone, string $contentType = self::content // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1355,11 +1116,10 @@ public function deleteContactRequest($phone, string $contentType = self::content $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1371,15 +1131,14 @@ public function deleteContactRequest($phone, string $contentType = self::content * Lists a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContact($phone, string $contentType = self::contentTypes['fetchContact'][0]) + public function fetchContact($phone) { - list($response) = $this->fetchContactWithHttpInfo($phone, $contentType); + list($response) = $this->fetchContactWithHttpInfo($phone); return $response; } @@ -1389,15 +1148,14 @@ public function fetchContact($phone, string $contentType = self::contentTypes['f * Lists a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) + public function fetchContactWithHttpInfo($phone) { - $request = $this->fetchContactRequest($phone, $contentType); + $request = $this->fetchContactRequest($phone); try { $options = $this->createHttpClientOption(); @@ -1440,21 +1198,6 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1467,21 +1210,6 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1494,21 +1222,6 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1521,21 +1234,6 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1550,21 +1248,6 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1618,14 +1301,13 @@ public function fetchContactWithHttpInfo($phone, string $contentType = self::con * Lists a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsync($phone, string $contentType = self::contentTypes['fetchContact'][0]) + public function fetchContactAsync($phone) { - return $this->fetchContactAsyncWithHttpInfo($phone, $contentType) + return $this->fetchContactAsyncWithHttpInfo($phone) ->then( function ($response) { return $response[0]; @@ -1639,15 +1321,14 @@ function ($response) { * Lists a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) + public function fetchContactAsyncWithHttpInfo($phone) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->fetchContactRequest($phone, $contentType); + $request = $this->fetchContactRequest($phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1657,9 +1338,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1689,14 +1367,12 @@ function ($exception) { * Create request for operation 'fetchContact' * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactRequest($phone, string $contentType = self::contentTypes['fetchContact'][0]) + public function fetchContactRequest($phone) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1704,7 +1380,6 @@ public function fetchContactRequest($phone, string $contentType = self::contentT ); } - $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1724,11 +1399,16 @@ public function fetchContactRequest($phone, string $contentType = self::contentT } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -1746,12 +1426,12 @@ public function fetchContactRequest($phone, string $contentType = self::contentT // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1771,11 +1451,10 @@ public function fetchContactRequest($phone, string $contentType = self::contentT $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1787,15 +1466,14 @@ public function fetchContactRequest($phone, string $contentType = self::contentT * Lists groups of a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContactGroups($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + public function fetchContactGroups($phone) { - list($response) = $this->fetchContactGroupsWithHttpInfo($phone, $contentType); + list($response) = $this->fetchContactGroupsWithHttpInfo($phone); return $response; } @@ -1805,15 +1483,14 @@ public function fetchContactGroups($phone, string $contentType = self::contentTy * Lists groups of a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactGroupsWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + public function fetchContactGroupsWithHttpInfo($phone) { - $request = $this->fetchContactGroupsRequest($phone, $contentType); + $request = $this->fetchContactGroupsRequest($phone); try { $options = $this->createHttpClientOption(); @@ -1856,21 +1533,6 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1883,21 +1545,6 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1910,21 +1557,6 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1937,21 +1569,6 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1966,21 +1583,6 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2034,14 +1636,13 @@ public function fetchContactGroupsWithHttpInfo($phone, string $contentType = sel * Lists groups of a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsync($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + public function fetchContactGroupsAsync($phone) { - return $this->fetchContactGroupsAsyncWithHttpInfo($phone, $contentType) + return $this->fetchContactGroupsAsyncWithHttpInfo($phone) ->then( function ($response) { return $response[0]; @@ -2055,15 +1656,14 @@ function ($response) { * Lists groups of a contact * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + public function fetchContactGroupsAsyncWithHttpInfo($phone) { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchContactGroupsRequest($phone, $contentType); + $request = $this->fetchContactGroupsRequest($phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2073,9 +1673,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2105,14 +1702,12 @@ function ($exception) { * Create request for operation 'fetchContactGroups' * * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactGroupsRequest($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) + public function fetchContactGroupsRequest($phone) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -2120,7 +1715,6 @@ public function fetchContactGroupsRequest($phone, string $contentType = self::co ); } - $resourcePath = '/phonebook/contacts/{phone}/groups'; $formParams = []; $queryParams = []; @@ -2140,11 +1734,16 @@ public function fetchContactGroupsRequest($phone, string $contentType = self::co } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -2162,12 +1761,12 @@ public function fetchContactGroupsRequest($phone, string $contentType = self::co // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2187,11 +1786,10 @@ public function fetchContactGroupsRequest($phone, string $contentType = self::co $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2203,15 +1801,14 @@ public function fetchContactGroupsRequest($phone, string $contentType = self::co * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContacts($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + public function fetchContacts($groupIds = null) { - list($response) = $this->fetchContactsWithHttpInfo($groupIds, $contentType); + list($response) = $this->fetchContactsWithHttpInfo($groupIds); return $response; } @@ -2221,15 +1818,14 @@ public function fetchContacts($groupIds = null, string $contentType = self::cont * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactsWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + public function fetchContactsWithHttpInfo($groupIds = null) { - $request = $this->fetchContactsRequest($groupIds, $contentType); + $request = $this->fetchContactsRequest($groupIds); try { $options = $this->createHttpClientOption(); @@ -2272,21 +1868,6 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2299,21 +1880,6 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2326,21 +1892,6 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2353,21 +1904,6 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2382,21 +1918,6 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2450,14 +1971,13 @@ public function fetchContactsWithHttpInfo($groupIds = null, string $contentType * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsync($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + public function fetchContactsAsync($groupIds = null) { - return $this->fetchContactsAsyncWithHttpInfo($groupIds, $contentType) + return $this->fetchContactsAsyncWithHttpInfo($groupIds) ->then( function ($response) { return $response[0]; @@ -2471,15 +1991,14 @@ function ($response) { * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsyncWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + public function fetchContactsAsyncWithHttpInfo($groupIds = null) { $returnType = '\Messente\Api\Model\ContactListEnvelope'; - $request = $this->fetchContactsRequest($groupIds, $contentType); + $request = $this->fetchContactsRequest($groupIds); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2489,9 +2008,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2521,16 +2037,13 @@ function ($exception) { * Create request for operation 'fetchContacts' * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactsRequest($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) + public function fetchContactsRequest($groupIds = null) { - - $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -2539,23 +2052,30 @@ public function fetchContactsRequest($groupIds = null, string $contentType = sel $multipart = false; // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $groupIds, - 'groupIds', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); + if ($groupIds !== null) { + if('form' === 'form' && is_array($groupIds)) { + foreach($groupIds as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['groupIds'] = $groupIds; + } + } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -2573,12 +2093,12 @@ public function fetchContactsRequest($groupIds = null, string $contentType = sel // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2598,11 +2118,10 @@ public function fetchContactsRequest($groupIds = null, string $contentType = sel $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2615,15 +2134,14 @@ public function fetchContactsRequest($groupIds = null, string $contentType = sel * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function removeContactFromGroup($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + public function removeContactFromGroup($groupId, $phone) { - $this->removeContactFromGroupWithHttpInfo($groupId, $phone, $contentType); + $this->removeContactFromGroupWithHttpInfo($groupId, $phone); } /** @@ -2633,15 +2151,14 @@ public function removeContactFromGroup($groupId, $phone, string $contentType = s * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + public function removeContactFromGroupWithHttpInfo($groupId, $phone) { - $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); + $request = $this->removeContactFromGroupRequest($groupId, $phone); try { $options = $this->createHttpClientOption(); @@ -2726,14 +2243,13 @@ public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $con * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsync($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + public function removeContactFromGroupAsync($groupId, $phone) { - return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, $contentType) + return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) ->then( function ($response) { return $response[0]; @@ -2748,15 +2264,14 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) { $returnType = ''; - $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); + $request = $this->removeContactFromGroupRequest($groupId, $phone); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2786,21 +2301,18 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function removeContactFromGroupRequest($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) + public function removeContactFromGroupRequest($groupId, $phone) { - // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling removeContactFromGroup' ); } - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -2808,7 +2320,6 @@ public function removeContactFromGroupRequest($groupId, $phone, string $contentT ); } - $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -2836,11 +2347,16 @@ public function removeContactFromGroupRequest($groupId, $phone, string $contentT } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -2858,12 +2374,12 @@ public function removeContactFromGroupRequest($groupId, $phone, string $contentT // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2883,11 +2399,10 @@ public function removeContactFromGroupRequest($groupId, $phone, string $contentT $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2900,15 +2415,14 @@ public function removeContactFromGroupRequest($groupId, $phone, string $contentT * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateContact($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + public function updateContact($phone, $contactUpdateFields) { - list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields, $contentType); + list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields); return $response; } @@ -2919,15 +2433,14 @@ public function updateContact($phone, $contactUpdateFields, string $contentType * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + public function updateContactWithHttpInfo($phone, $contactUpdateFields) { - $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); + $request = $this->updateContactRequest($phone, $contactUpdateFields); try { $options = $this->createHttpClientOption(); @@ -2970,21 +2483,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -2997,21 +2495,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -3024,21 +2507,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -3051,21 +2519,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -3078,21 +2531,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -3107,21 +2545,6 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -3184,14 +2607,13 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $ * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsync($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + public function updateContactAsync($phone, $contactUpdateFields) { - return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, $contentType) + return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) ->then( function ($response) { return $response[0]; @@ -3206,15 +2628,14 @@ function ($response) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); + $request = $this->updateContactRequest($phone, $contactUpdateFields); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3224,9 +2645,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -3257,21 +2675,18 @@ function ($exception) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateContactRequest($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) + public function updateContactRequest($phone, $contactUpdateFields) { - // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $phone when calling updateContact' ); } - // verify the required parameter 'contactUpdateFields' is set if ($contactUpdateFields === null || (is_array($contactUpdateFields) && count($contactUpdateFields) === 0)) { throw new \InvalidArgumentException( @@ -3279,7 +2694,6 @@ public function updateContactRequest($phone, $contactUpdateFields, string $conte ); } - $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -3299,17 +2713,21 @@ public function updateContactRequest($phone, $contactUpdateFields, string $conte } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($contactUpdateFields)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); } else { $httpBody = $contactUpdateFields; } @@ -3328,12 +2746,12 @@ public function updateContactRequest($phone, $contactUpdateFields, string $conte // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -3353,11 +2771,10 @@ public function updateContactRequest($phone, $contactUpdateFields, string $conte $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PATCH', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/DeliveryReportApi.php b/lib/Api/DeliveryReportApi.php index 037e7ff..dec10da 100644 --- a/lib/Api/DeliveryReportApi.php +++ b/lib/Api/DeliveryReportApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -129,15 +122,14 @@ public function getConfig() * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function retrieveDeliveryReport($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + public function retrieveDeliveryReport($omnimessageId) { - list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId, $contentType); + list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId); return $response; } @@ -147,15 +139,14 @@ public function retrieveDeliveryReport($omnimessageId, string $contentType = sel * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + public function retrieveDeliveryReportWithHttpInfo($omnimessageId) { - $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); + $request = $this->retrieveDeliveryReportRequest($omnimessageId); try { $options = $this->createHttpClientOption(); @@ -198,21 +189,6 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\DeliveryReportResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -225,21 +201,6 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -252,21 +213,6 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -281,21 +227,6 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -341,14 +272,13 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $conte * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsync($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + public function retrieveDeliveryReportAsync($omnimessageId) { - return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, $contentType) + return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) ->then( function ($response) { return $response[0]; @@ -362,15 +292,14 @@ function ($response) { * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) { $returnType = '\Messente\Api\Model\DeliveryReportResponse'; - $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); + $request = $this->retrieveDeliveryReportRequest($omnimessageId); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -380,9 +309,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -412,14 +338,12 @@ function ($exception) { * Create request for operation 'retrieveDeliveryReport' * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function retrieveDeliveryReportRequest($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) + public function retrieveDeliveryReportRequest($omnimessageId) { - // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -427,7 +351,6 @@ public function retrieveDeliveryReportRequest($omnimessageId, string $contentTyp ); } - $resourcePath = '/omnimessage/{omnimessageId}/status'; $formParams = []; $queryParams = []; @@ -447,11 +370,16 @@ public function retrieveDeliveryReportRequest($omnimessageId, string $contentTyp } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -469,12 +397,12 @@ public function retrieveDeliveryReportRequest($omnimessageId, string $contentTyp // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -494,11 +422,10 @@ public function retrieveDeliveryReportRequest($omnimessageId, string $contentTyp $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/GroupsApi.php b/lib/Api/GroupsApi.php index 0b4c8e5..8bfaca6 100644 --- a/lib/Api/GroupsApi.php +++ b/lib/Api/GroupsApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - 'deleteGroup' => [ - 'application/json', - ], - 'fetchGroup' => [ - 'application/json', - ], - 'fetchGroups' => [ - 'application/json', - ], - 'updateGroup' => [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -141,15 +122,14 @@ public function getConfig() * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createGroup($groupName, string $contentType = self::contentTypes['createGroup'][0]) + public function createGroup($groupName) { - list($response) = $this->createGroupWithHttpInfo($groupName, $contentType); + list($response) = $this->createGroupWithHttpInfo($groupName); return $response; } @@ -159,15 +139,14 @@ public function createGroup($groupName, string $contentType = self::contentTypes * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createGroupWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) + public function createGroupWithHttpInfo($groupName) { - $request = $this->createGroupRequest($groupName, $contentType); + $request = $this->createGroupRequest($groupName); try { $options = $this->createHttpClientOption(); @@ -210,21 +189,6 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -237,21 +201,6 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -264,21 +213,6 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -291,21 +225,6 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -320,21 +239,6 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -388,14 +292,13 @@ public function createGroupWithHttpInfo($groupName, string $contentType = self:: * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsync($groupName, string $contentType = self::contentTypes['createGroup'][0]) + public function createGroupAsync($groupName) { - return $this->createGroupAsyncWithHttpInfo($groupName, $contentType) + return $this->createGroupAsyncWithHttpInfo($groupName) ->then( function ($response) { return $response[0]; @@ -409,15 +312,14 @@ function ($response) { * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsyncWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) + public function createGroupAsyncWithHttpInfo($groupName) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->createGroupRequest($groupName, $contentType); + $request = $this->createGroupRequest($groupName); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -427,9 +329,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -459,14 +358,12 @@ function ($exception) { * Create request for operation 'createGroup' * * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createGroupRequest($groupName, string $contentType = self::contentTypes['createGroup'][0]) + public function createGroupRequest($groupName) { - // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -474,7 +371,6 @@ public function createGroupRequest($groupName, string $contentType = self::conte ); } - $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -486,17 +382,21 @@ public function createGroupRequest($groupName, string $contentType = self::conte - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($groupName)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -515,12 +415,12 @@ public function createGroupRequest($groupName, string $contentType = self::conte // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -540,11 +440,10 @@ public function createGroupRequest($groupName, string $contentType = self::conte $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -556,15 +455,14 @@ public function createGroupRequest($groupName, string $contentType = self::conte * Deletes a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function deleteGroup($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + public function deleteGroup($groupId) { - $this->deleteGroupWithHttpInfo($groupId, $contentType); + $this->deleteGroupWithHttpInfo($groupId); } /** @@ -573,15 +471,14 @@ public function deleteGroup($groupId, string $contentType = self::contentTypes[' * Deletes a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + public function deleteGroupWithHttpInfo($groupId) { - $request = $this->deleteGroupRequest($groupId, $contentType); + $request = $this->deleteGroupRequest($groupId); try { $options = $this->createHttpClientOption(); @@ -657,14 +554,13 @@ public function deleteGroupWithHttpInfo($groupId, string $contentType = self::co * Deletes a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsync($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + public function deleteGroupAsync($groupId) { - return $this->deleteGroupAsyncWithHttpInfo($groupId, $contentType) + return $this->deleteGroupAsyncWithHttpInfo($groupId) ->then( function ($response) { return $response[0]; @@ -678,15 +574,14 @@ function ($response) { * Deletes a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + public function deleteGroupAsyncWithHttpInfo($groupId) { $returnType = ''; - $request = $this->deleteGroupRequest($groupId, $contentType); + $request = $this->deleteGroupRequest($groupId); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -715,14 +610,12 @@ function ($exception) { * Create request for operation 'deleteGroup' * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteGroupRequest($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) + public function deleteGroupRequest($groupId) { - // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -730,7 +623,6 @@ public function deleteGroupRequest($groupId, string $contentType = self::content ); } - $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -750,11 +642,16 @@ public function deleteGroupRequest($groupId, string $contentType = self::content } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -772,12 +669,12 @@ public function deleteGroupRequest($groupId, string $contentType = self::content // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -797,11 +694,10 @@ public function deleteGroupRequest($groupId, string $contentType = self::content $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -813,15 +709,14 @@ public function deleteGroupRequest($groupId, string $contentType = self::content * Lists a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroup($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + public function fetchGroup($groupId) { - list($response) = $this->fetchGroupWithHttpInfo($groupId, $contentType); + list($response) = $this->fetchGroupWithHttpInfo($groupId); return $response; } @@ -831,15 +726,14 @@ public function fetchGroup($groupId, string $contentType = self::contentTypes['f * Lists a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + public function fetchGroupWithHttpInfo($groupId) { - $request = $this->fetchGroupRequest($groupId, $contentType); + $request = $this->fetchGroupRequest($groupId); try { $options = $this->createHttpClientOption(); @@ -882,21 +776,6 @@ public function fetchGroupWithHttpInfo($groupId, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -909,21 +788,6 @@ public function fetchGroupWithHttpInfo($groupId, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -936,21 +800,6 @@ public function fetchGroupWithHttpInfo($groupId, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -965,21 +814,6 @@ public function fetchGroupWithHttpInfo($groupId, string $contentType = self::con $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1025,14 +859,13 @@ public function fetchGroupWithHttpInfo($groupId, string $contentType = self::con * Lists a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsync($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + public function fetchGroupAsync($groupId) { - return $this->fetchGroupAsyncWithHttpInfo($groupId, $contentType) + return $this->fetchGroupAsyncWithHttpInfo($groupId) ->then( function ($response) { return $response[0]; @@ -1046,15 +879,14 @@ function ($response) { * Lists a group * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + public function fetchGroupAsyncWithHttpInfo($groupId) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->fetchGroupRequest($groupId, $contentType); + $request = $this->fetchGroupRequest($groupId); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1064,9 +896,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1096,14 +925,12 @@ function ($exception) { * Create request for operation 'fetchGroup' * * @param string $groupId String in UUID format (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupRequest($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) + public function fetchGroupRequest($groupId) { - // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -1111,7 +938,6 @@ public function fetchGroupRequest($groupId, string $contentType = self::contentT ); } - $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -1131,11 +957,16 @@ public function fetchGroupRequest($groupId, string $contentType = self::contentT } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -1153,12 +984,12 @@ public function fetchGroupRequest($groupId, string $contentType = self::contentT // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1178,11 +1009,10 @@ public function fetchGroupRequest($groupId, string $contentType = self::contentT $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1193,15 +1023,14 @@ public function fetchGroupRequest($groupId, string $contentType = self::contentT * * Returns all groups * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroups(string $contentType = self::contentTypes['fetchGroups'][0]) + public function fetchGroups() { - list($response) = $this->fetchGroupsWithHttpInfo($contentType); + list($response) = $this->fetchGroupsWithHttpInfo(); return $response; } @@ -1210,15 +1039,14 @@ public function fetchGroups(string $contentType = self::contentTypes['fetchGroup * * Returns all groups * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) + public function fetchGroupsWithHttpInfo() { - $request = $this->fetchGroupsRequest($contentType); + $request = $this->fetchGroupsRequest(); try { $options = $this->createHttpClientOption(); @@ -1261,21 +1089,6 @@ public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1288,21 +1101,6 @@ public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1315,21 +1113,6 @@ public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1344,21 +1127,6 @@ public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1403,14 +1171,13 @@ public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes * * Returns all groups * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsync(string $contentType = self::contentTypes['fetchGroups'][0]) + public function fetchGroupsAsync() { - return $this->fetchGroupsAsyncWithHttpInfo($contentType) + return $this->fetchGroupsAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -1423,15 +1190,14 @@ function ($response) { * * Returns all groups * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) + public function fetchGroupsAsyncWithHttpInfo() { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchGroupsRequest($contentType); + $request = $this->fetchGroupsRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1441,9 +1207,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1472,15 +1235,13 @@ function ($exception) { /** * Create request for operation 'fetchGroups' * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupsRequest(string $contentType = self::contentTypes['fetchGroups'][0]) + public function fetchGroupsRequest() { - $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -1492,11 +1253,16 @@ public function fetchGroupsRequest(string $contentType = self::contentTypes['fet - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -1514,12 +1280,12 @@ public function fetchGroupsRequest(string $contentType = self::contentTypes['fet // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -1539,11 +1305,10 @@ public function fetchGroupsRequest(string $contentType = self::contentTypes['fet $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1556,15 +1321,14 @@ public function fetchGroupsRequest(string $contentType = self::contentTypes['fet * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateGroup($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + public function updateGroup($groupId, $groupName) { - list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName, $contentType); + list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName); return $response; } @@ -1575,15 +1339,14 @@ public function updateGroup($groupId, $groupName, string $contentType = self::co * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateGroupWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + public function updateGroupWithHttpInfo($groupId, $groupName) { - $request = $this->updateGroupRequest($groupId, $groupName, $contentType); + $request = $this->updateGroupRequest($groupId, $groupName); try { $options = $this->createHttpClientOption(); @@ -1626,21 +1389,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1653,21 +1401,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1680,21 +1413,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1707,21 +1425,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1734,21 +1437,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1763,21 +1451,6 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -1840,14 +1513,13 @@ public function updateGroupWithHttpInfo($groupId, $groupName, string $contentTyp * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsync($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + public function updateGroupAsync($groupId, $groupName) { - return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName, $contentType) + return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName) ->then( function ($response) { return $response[0]; @@ -1862,15 +1534,14 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsyncWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + public function updateGroupAsyncWithHttpInfo($groupId, $groupName) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->updateGroupRequest($groupId, $groupName, $contentType); + $request = $this->updateGroupRequest($groupId, $groupName); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1880,9 +1551,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1913,21 +1581,18 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateGroupRequest($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) + public function updateGroupRequest($groupId, $groupName) { - // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling updateGroup' ); } - // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -1935,7 +1600,6 @@ public function updateGroupRequest($groupId, $groupName, string $contentType = s ); } - $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -1955,17 +1619,21 @@ public function updateGroupRequest($groupId, $groupName, string $contentType = s } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($groupName)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -1984,12 +1652,12 @@ public function updateGroupRequest($groupId, $groupName, string $contentType = s // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -2009,11 +1677,10 @@ public function updateGroupRequest($groupId, $groupName, string $contentType = s $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/NumberLookupApi.php b/lib/Api/NumberLookupApi.php index 4bea0f0..54abbe4 100644 --- a/lib/Api/NumberLookupApi.php +++ b/lib/Api/NumberLookupApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -129,15 +122,14 @@ public function getConfig() * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup */ - public function fetchInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + public function fetchInfo($numbersToInvestigate) { - list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate, $contentType); + list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate); return $response; } @@ -147,15 +139,14 @@ public function fetchInfo($numbersToInvestigate, string $contentType = self::con * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup, HTTP status code, HTTP response headers (array of strings) */ - public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + public function fetchInfoWithHttpInfo($numbersToInvestigate) { - $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); + $request = $this->fetchInfoRequest($numbersToInvestigate); try { $options = $this->createHttpClientOption(); @@ -198,21 +189,6 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\SyncNumberLookupSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -225,21 +201,6 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -252,21 +213,6 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -279,21 +225,6 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -308,21 +239,6 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -376,14 +292,13 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsync($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + public function fetchInfoAsync($numbersToInvestigate) { - return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate, $contentType) + return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate) ->then( function ($response) { return $response[0]; @@ -397,15 +312,14 @@ function ($response) { * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate) { $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; - $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); + $request = $this->fetchInfoRequest($numbersToInvestigate); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -415,9 +329,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -447,14 +358,12 @@ function ($exception) { * Create request for operation 'fetchInfo' * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchInfoRequest($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) + public function fetchInfoRequest($numbersToInvestigate) { - // verify the required parameter 'numbersToInvestigate' is set if ($numbersToInvestigate === null || (is_array($numbersToInvestigate) && count($numbersToInvestigate) === 0)) { throw new \InvalidArgumentException( @@ -462,7 +371,6 @@ public function fetchInfoRequest($numbersToInvestigate, string $contentType = se ); } - $resourcePath = '/hlr/sync'; $formParams = []; $queryParams = []; @@ -474,17 +382,21 @@ public function fetchInfoRequest($numbersToInvestigate, string $contentType = se - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($numbersToInvestigate)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); } else { $httpBody = $numbersToInvestigate; } @@ -503,12 +415,12 @@ public function fetchInfoRequest($numbersToInvestigate, string $contentType = se // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -528,11 +440,10 @@ public function fetchInfoRequest($numbersToInvestigate, string $contentType = se $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php index 1cc0442..bcda4cb 100644 --- a/lib/Api/OmnimessageApi.php +++ b/lib/Api/OmnimessageApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - 'sendOmnimessage' => [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -132,15 +122,14 @@ public function getConfig() * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function cancelScheduledMessage($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + public function cancelScheduledMessage($omnimessageId) { - list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId, $contentType); + list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId); return $response; } @@ -150,15 +139,14 @@ public function cancelScheduledMessage($omnimessageId, string $contentType = sel * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + public function cancelScheduledMessageWithHttpInfo($omnimessageId) { - $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); + $request = $this->cancelScheduledMessageRequest($omnimessageId); try { $options = $this->createHttpClientOption(); @@ -201,21 +189,6 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('object' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -228,21 +201,6 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -255,21 +213,6 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -284,21 +227,6 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $conte $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -344,14 +272,13 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $conte * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsync($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + public function cancelScheduledMessageAsync($omnimessageId) { - return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, $contentType) + return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) ->then( function ($response) { return $response[0]; @@ -365,15 +292,14 @@ function ($response) { * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) { $returnType = 'object'; - $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); + $request = $this->cancelScheduledMessageRequest($omnimessageId); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -383,9 +309,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -415,14 +338,12 @@ function ($exception) { * Create request for operation 'cancelScheduledMessage' * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function cancelScheduledMessageRequest($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) + public function cancelScheduledMessageRequest($omnimessageId) { - // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -430,7 +351,6 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp ); } - $resourcePath = '/omnimessage/{omnimessageId}'; $formParams = []; $queryParams = []; @@ -450,11 +370,16 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp } - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } // for model (json/xml) if (count($formParams) > 0) { @@ -472,12 +397,12 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -497,11 +422,10 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -513,15 +437,14 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function sendOmnimessage($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + public function sendOmnimessage($omnimessage) { - list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage, $contentType); + list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage); return $response; } @@ -531,15 +454,14 @@ public function sendOmnimessage($omnimessage, string $contentType = self::conten * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + public function sendOmnimessageWithHttpInfo($omnimessage) { - $request = $this->sendOmnimessageRequest($omnimessage, $contentType); + $request = $this->sendOmnimessageRequest($omnimessage); try { $options = $this->createHttpClientOption(); @@ -582,21 +504,6 @@ public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -609,21 +516,6 @@ public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -636,21 +528,6 @@ public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -665,21 +542,6 @@ public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -725,14 +587,13 @@ public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsync($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + public function sendOmnimessageAsync($omnimessage) { - return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage, $contentType) + return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage) ->then( function ($response) { return $response[0]; @@ -746,15 +607,14 @@ function ($response) { * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsyncWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + public function sendOmnimessageAsyncWithHttpInfo($omnimessage) { $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; - $request = $this->sendOmnimessageRequest($omnimessage, $contentType); + $request = $this->sendOmnimessageRequest($omnimessage); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -764,9 +624,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -796,14 +653,12 @@ function ($exception) { * Create request for operation 'sendOmnimessage' * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function sendOmnimessageRequest($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) + public function sendOmnimessageRequest($omnimessage) { - // verify the required parameter 'omnimessage' is set if ($omnimessage === null || (is_array($omnimessage) && count($omnimessage) === 0)) { throw new \InvalidArgumentException( @@ -811,7 +666,6 @@ public function sendOmnimessageRequest($omnimessage, string $contentType = self: ); } - $resourcePath = '/omnimessage'; $formParams = []; $queryParams = []; @@ -823,17 +677,21 @@ public function sendOmnimessageRequest($omnimessage, string $contentType = self: - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($omnimessage)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omnimessage)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($omnimessage)); } else { $httpBody = $omnimessage; } @@ -852,12 +710,12 @@ public function sendOmnimessageRequest($omnimessage, string $contentType = self: // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -877,11 +735,10 @@ public function sendOmnimessageRequest($omnimessage, string $contentType = self: $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/StatisticsApi.php b/lib/Api/StatisticsApi.php index 0d70d5a..a5b109f 100644 --- a/lib/Api/StatisticsApi.php +++ b/lib/Api/StatisticsApi.php @@ -1,7 +1,7 @@ [ - 'application/json', - ], - ]; - /** * @param ClientInterface $client * @param Configuration $config @@ -129,15 +122,14 @@ public function getConfig() * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics */ - public function createStatisticsReport($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + public function createStatisticsReport($statisticsReportSettings) { - list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings, $contentType); + list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings); return $response; } @@ -147,15 +139,14 @@ public function createStatisticsReport($statisticsReportSettings, string $conten * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \Messente\Api\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics, HTTP status code, HTTP response headers (array of strings) */ - public function createStatisticsReportWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + public function createStatisticsReportWithHttpInfo($statisticsReportSettings) { - $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); + $request = $this->createStatisticsReportRequest($statisticsReportSettings); try { $options = $this->createHttpClientOption(); @@ -198,21 +189,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\StatisticsReportSuccess' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -225,21 +201,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -252,21 +213,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -279,21 +225,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -306,21 +237,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -335,21 +251,6 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } } return [ @@ -411,14 +312,13 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings, st * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsync($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + public function createStatisticsReportAsync($statisticsReportSettings) { - return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, $contentType) + return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) ->then( function ($response) { return $response[0]; @@ -432,15 +332,14 @@ function ($response) { * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) { $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; - $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); + $request = $this->createStatisticsReportRequest($statisticsReportSettings); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -450,9 +349,6 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -482,14 +378,12 @@ function ($exception) { * Create request for operation 'createStatisticsReport' * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createStatisticsReportRequest($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) + public function createStatisticsReportRequest($statisticsReportSettings) { - // verify the required parameter 'statisticsReportSettings' is set if ($statisticsReportSettings === null || (is_array($statisticsReportSettings) && count($statisticsReportSettings) === 0)) { throw new \InvalidArgumentException( @@ -497,7 +391,6 @@ public function createStatisticsReportRequest($statisticsReportSettings, string ); } - $resourcePath = '/statistics/reports'; $formParams = []; $queryParams = []; @@ -509,17 +402,21 @@ public function createStatisticsReportRequest($statisticsReportSettings, string - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } // for model (json/xml) if (isset($statisticsReportSettings)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); } else { $httpBody = $statisticsReportSettings; } @@ -538,12 +435,12 @@ public function createStatisticsReportRequest($statisticsReportSettings, string // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + } else { // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); } } @@ -563,11 +460,10 @@ public function createStatisticsReportRequest($statisticsReportSettings, string $headers ); - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); + $query = \GuzzleHttp\Psr7\Query::build($queryParams); return new Request( 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/ApiException.php b/lib/ApiException.php index a61f0f5..5e918bc 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -1,7 +1,7 @@ accessToken; } - /** - * Sets boolean format for query string. - * - * @param string $booleanFormat Boolean format for query string - * - * @return $this - */ - public function setBooleanFormatForQueryString(string $booleanFormat) - { - $this->booleanFormatForQueryString = $booleanFormat; - - return $this; - } - - /** - * Gets boolean format for query string. - * - * @return string Boolean format for query string - */ - public function getBooleanFormatForQueryString(): string - { - return $this->booleanFormatForQueryString; - } - /** * Sets the username for HTTP basic authentication * @@ -434,7 +400,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 2.1.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -481,31 +447,32 @@ public function getHostSettings() } /** - * Returns URL based on host settings, index and variables - * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients - * @param int $hostIndex index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) { if (null === $variables) { $variables = []; } + $hosts = $this->getHostSettings(); + // check array index out of bound - if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + if ($index < 0 || $index >= sizeof($hosts)) { + throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); } - $host = $hostSettings[$hostIndex]; + $host = $hosts[$index]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -518,16 +485,4 @@ public static function getHostString(array $hostSettings, $hostIndex, array $var return $url; } - - /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) - { - return self::getHostString($this->getHostSettings(), $index, $variables); - } } diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index d28cb40..a149e1d 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -1,7 +1,7 @@ selectContentTypeHeader($contentTypes); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided. - * - * @param string[] $accept Array of header - * - * @return null|string Accept (e.g. application/json) + * @param string[] $accept + * @return array */ - private function selectAcceptHeader(array $accept): ?string + public function selectHeadersForMultipart($accept) { - # filter out empty entries - $accept = array_filter($accept); - - if (count($accept) === 0) { - return null; - } + $headers = $this->selectHeaders($accept, []); - # If there's only one Accept header, just use it - if (count($accept) === 1) { - return reset($accept); - } - - # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); - if (count($headersWithJson) === 0) { - return implode(',', $accept); - } - - # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, - # to give the highest priority to json-like headers - recalculating the existing ones, if needed - return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); - } - - /** - * Create an Accept header string from the given "Accept" headers array, recalculating all weights - * - * @param string[] $accept Array of Accept Headers - * @param string[] $headersWithJson Array of Accept Headers of type "json" - * - * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") - */ - private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string - { - $processedHeaders = [ - 'withApplicationJson' => [], - 'withJson' => [], - 'withoutJson' => [], - ]; - - foreach ($accept as $header) { - - $headerData = $this->getHeaderAndWeight($header); - - if (stripos($headerData['header'], 'application/json') === 0) { - $processedHeaders['withApplicationJson'][] = $headerData; - } elseif (in_array($header, $headersWithJson, true)) { - $processedHeaders['withJson'][] = $headerData; - } else { - $processedHeaders['withoutJson'][] = $headerData; - } - } - - $acceptHeaders = []; - $currentWeight = 1000; - - $hasMoreThan28Headers = count($accept) > 28; - - foreach($processedHeaders as $headers) { - if (count($headers) > 0) { - $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); - } - } - - $acceptHeaders = array_merge(...$acceptHeaders); - - return implode(',', $acceptHeaders); + unset($headers['Content-Type']); + return $headers; } /** - * Given an Accept header, returns an associative array splitting the header and its weight + * Return the header 'Accept' based on an array of Accept provided * - * @param string $header "Accept" Header + * @param string[] $accept Array of header * - * @return array with the header and its weight + * @return null|string Accept (e.g. application/json) */ - private function getHeaderAndWeight(string $header): array + private function selectAcceptHeader($accept) { - # matches headers with weight, splitting the header and the weight in $outputArray - if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { - $headerData = [ - 'header' => $outputArray[1], - 'weight' => (int)($outputArray[2] * 1000), - ]; + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { + return implode(',', $jsonAccept); } else { - $headerData = [ - 'header' => trim($header), - 'weight' => 1000, - ]; - } - - return $headerData; - } - - /** - * @param array[] $headers - * @param float $currentWeight - * @param bool $hasMoreThan28Headers - * @return string[] array of adjusted "Accept" headers - */ - private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array - { - usort($headers, function (array $a, array $b) { - return $b['weight'] - $a['weight']; - }); - - $acceptHeaders = []; - foreach ($headers as $index => $header) { - if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) - { - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - } - - $weight = $currentWeight; - - $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); - } - - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - - return $acceptHeaders; - } - - /** - * @param string $header - * @param int $weight - * @return string - */ - private function buildAcceptHeader(string $header, int $weight): string - { - if($weight === 1000) { - return $header; + return implode(',', $accept); } - - return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); } /** - * Calculate the next weight, based on the current one. - * - * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the - * following formula: + * Return the content type based on an array of content-type provided * - * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * @param string[] $contentType Array fo content-type * - * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) - * - * Starting from 1000, this generates the following series: - * - * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - * - * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works - * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 - * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. - * - * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) - * @param bool $hasMoreThan28Headers - * @return int + * @return string Content-Type (e.g. application/json) */ - public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + private function selectContentTypeHeader($contentType) { - if ($currentWeight <= 1) { - return 1; - } - - if ($hasMoreThan28Headers) { - return $currentWeight - 1; + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); } - - return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php index e48e7d4..e9c9a37 100644 --- a/lib/Model/Channel.php +++ b/lib/Model/Channel.php @@ -2,7 +2,7 @@ /** * Channel * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,13 +44,13 @@ class Channel /** * Possible values of this enum */ - public const SMS = 'sms'; + const SMS = 'sms'; - public const VIBER = 'viber'; + const VIBER = 'viber'; - public const WHATSAPP = 'whatsapp'; + const WHATSAPP = 'whatsapp'; - public const TELEGRAM = 'telegram'; + const TELEGRAM = 'telegram'; /** * Gets allowable values of the enum diff --git a/lib/Model/ContactEnvelope.php b/lib/Model/ContactEnvelope.php index 1c1bb3c..f1e0dd9 100644 --- a/lib/Model/ContactEnvelope.php +++ b/lib/Model/ContactEnvelope.php @@ -2,7 +2,7 @@ /** * ContactEnvelope * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'contact' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'contact' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('contact', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['contact'] = $data['contact'] ?? null; } /** @@ -310,9 +226,6 @@ public function getContact() */ public function setContact($contact) { - if (is_null($contact)) { - throw new \InvalidArgumentException('non-nullable contact cannot be null'); - } $this->container['contact'] = $contact; return $this; @@ -324,7 +237,7 @@ public function setContact($contact) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -336,7 +249,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -350,7 +262,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -366,7 +278,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -378,7 +290,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactFields.php b/lib/Model/ContactFields.php index 971bc81..7fc55a0 100644 --- a/lib/Model/ContactFields.php +++ b/lib/Model/ContactFields.php @@ -2,7 +2,7 @@ /** * ContactFields * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -91,31 +93,6 @@ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable 'custom4' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false, - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -136,58 +113,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -300,34 +225,16 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('phoneNumber', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; + $this->container['email'] = $data['email'] ?? null; + $this->container['firstName'] = $data['firstName'] ?? null; + $this->container['lastName'] = $data['lastName'] ?? null; + $this->container['company'] = $data['company'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['custom'] = $data['custom'] ?? null; + $this->container['custom2'] = $data['custom2'] ?? null; + $this->container['custom3'] = $data['custom3'] ?? null; + $this->container['custom4'] = $data['custom4'] ?? null; } /** @@ -376,9 +283,6 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -403,16 +307,6 @@ public function getEmail() */ public function setEmail($email) { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['email'] = $email; return $this; @@ -437,16 +331,6 @@ public function getFirstName() */ public function setFirstName($firstName) { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['firstName'] = $firstName; return $this; @@ -471,16 +355,6 @@ public function getLastName() */ public function setLastName($lastName) { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['lastName'] = $lastName; return $this; @@ -505,16 +379,6 @@ public function getCompany() */ public function setCompany($company) { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['company'] = $company; return $this; @@ -539,16 +403,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['title'] = $title; return $this; @@ -573,16 +427,6 @@ public function getCustom() */ public function setCustom($custom) { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom'] = $custom; return $this; @@ -607,16 +451,6 @@ public function getCustom2() */ public function setCustom2($custom2) { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom2'] = $custom2; return $this; @@ -641,16 +475,6 @@ public function getCustom3() */ public function setCustom3($custom3) { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom3'] = $custom3; return $this; @@ -675,16 +499,6 @@ public function getCustom4() */ public function setCustom4($custom4) { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom4'] = $custom4; return $this; @@ -696,7 +510,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -708,7 +522,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -722,7 +535,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -738,7 +551,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -750,7 +563,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactListEnvelope.php b/lib/Model/ContactListEnvelope.php index 81b91ea..b225830 100644 --- a/lib/Model/ContactListEnvelope.php +++ b/lib/Model/ContactListEnvelope.php @@ -2,7 +2,7 @@ /** * ContactListEnvelope * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializa 'contacts' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'contacts' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('contacts', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['contacts'] = $data['contacts'] ?? null; } /** @@ -310,9 +226,6 @@ public function getContacts() */ public function setContacts($contacts) { - if (is_null($contacts)) { - throw new \InvalidArgumentException('non-nullable contacts cannot be null'); - } $this->container['contacts'] = $contacts; @@ -326,7 +239,7 @@ public function setContacts($contacts) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -338,7 +251,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -352,7 +264,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -368,7 +280,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -380,7 +292,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactResponseFields.php b/lib/Model/ContactResponseFields.php index 06a560d..1b44998 100644 --- a/lib/Model/ContactResponseFields.php +++ b/lib/Model/ContactResponseFields.php @@ -2,7 +2,7 @@ /** * ContactResponseFields * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -93,32 +95,6 @@ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSeriali 'scheduledDeletionDate' => 'date' ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false, - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true, - 'scheduledDeletionDate' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -139,58 +115,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -306,35 +230,17 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('phoneNumber', $data ?? [], null); - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - $this->setIfExists('scheduledDeletionDate', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; + $this->container['email'] = $data['email'] ?? null; + $this->container['firstName'] = $data['firstName'] ?? null; + $this->container['lastName'] = $data['lastName'] ?? null; + $this->container['company'] = $data['company'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['custom'] = $data['custom'] ?? null; + $this->container['custom2'] = $data['custom2'] ?? null; + $this->container['custom3'] = $data['custom3'] ?? null; + $this->container['custom4'] = $data['custom4'] ?? null; + $this->container['scheduledDeletionDate'] = $data['scheduledDeletionDate'] ?? null; } /** @@ -380,9 +286,6 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -407,16 +310,6 @@ public function getEmail() */ public function setEmail($email) { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['email'] = $email; return $this; @@ -441,16 +334,6 @@ public function getFirstName() */ public function setFirstName($firstName) { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['firstName'] = $firstName; return $this; @@ -475,16 +358,6 @@ public function getLastName() */ public function setLastName($lastName) { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['lastName'] = $lastName; return $this; @@ -509,16 +382,6 @@ public function getCompany() */ public function setCompany($company) { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['company'] = $company; return $this; @@ -543,16 +406,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['title'] = $title; return $this; @@ -577,16 +430,6 @@ public function getCustom() */ public function setCustom($custom) { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom'] = $custom; return $this; @@ -611,16 +454,6 @@ public function getCustom2() */ public function setCustom2($custom2) { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom2'] = $custom2; return $this; @@ -645,16 +478,6 @@ public function getCustom3() */ public function setCustom3($custom3) { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom3'] = $custom3; return $this; @@ -679,16 +502,6 @@ public function getCustom4() */ public function setCustom4($custom4) { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom4'] = $custom4; return $this; @@ -713,16 +526,6 @@ public function getScheduledDeletionDate() */ public function setScheduledDeletionDate($scheduledDeletionDate) { - if (is_null($scheduledDeletionDate)) { - array_push($this->openAPINullablesSetToNull, 'scheduledDeletionDate'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('scheduledDeletionDate', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['scheduledDeletionDate'] = $scheduledDeletionDate; return $this; @@ -734,7 +537,7 @@ public function setScheduledDeletionDate($scheduledDeletionDate) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -746,7 +549,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -760,7 +562,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -776,7 +578,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -788,7 +590,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactUpdateFields.php b/lib/Model/ContactUpdateFields.php index 8f2b5a5..1f4c757 100644 --- a/lib/Model/ContactUpdateFields.php +++ b/lib/Model/ContactUpdateFields.php @@ -2,7 +2,7 @@ /** * ContactUpdateFields * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -89,30 +91,6 @@ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializa 'custom4' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'email' => true, - 'firstName' => true, - 'lastName' => true, - 'company' => true, - 'title' => true, - 'custom' => true, - 'custom2' => true, - 'custom3' => true, - 'custom4' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -133,58 +111,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -294,33 +220,15 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('email', $data ?? [], null); - $this->setIfExists('firstName', $data ?? [], null); - $this->setIfExists('lastName', $data ?? [], null); - $this->setIfExists('company', $data ?? [], null); - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('custom', $data ?? [], null); - $this->setIfExists('custom2', $data ?? [], null); - $this->setIfExists('custom3', $data ?? [], null); - $this->setIfExists('custom4', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['email'] = $data['email'] ?? null; + $this->container['firstName'] = $data['firstName'] ?? null; + $this->container['lastName'] = $data['lastName'] ?? null; + $this->container['company'] = $data['company'] ?? null; + $this->container['title'] = $data['title'] ?? null; + $this->container['custom'] = $data['custom'] ?? null; + $this->container['custom2'] = $data['custom2'] ?? null; + $this->container['custom3'] = $data['custom3'] ?? null; + $this->container['custom4'] = $data['custom4'] ?? null; } /** @@ -366,16 +274,6 @@ public function getEmail() */ public function setEmail($email) { - if (is_null($email)) { - array_push($this->openAPINullablesSetToNull, 'email'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('email', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['email'] = $email; return $this; @@ -400,16 +298,6 @@ public function getFirstName() */ public function setFirstName($firstName) { - if (is_null($firstName)) { - array_push($this->openAPINullablesSetToNull, 'firstName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('firstName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['firstName'] = $firstName; return $this; @@ -434,16 +322,6 @@ public function getLastName() */ public function setLastName($lastName) { - if (is_null($lastName)) { - array_push($this->openAPINullablesSetToNull, 'lastName'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('lastName', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['lastName'] = $lastName; return $this; @@ -468,16 +346,6 @@ public function getCompany() */ public function setCompany($company) { - if (is_null($company)) { - array_push($this->openAPINullablesSetToNull, 'company'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('company', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['company'] = $company; return $this; @@ -502,16 +370,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - array_push($this->openAPINullablesSetToNull, 'title'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('title', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['title'] = $title; return $this; @@ -536,16 +394,6 @@ public function getCustom() */ public function setCustom($custom) { - if (is_null($custom)) { - array_push($this->openAPINullablesSetToNull, 'custom'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom'] = $custom; return $this; @@ -570,16 +418,6 @@ public function getCustom2() */ public function setCustom2($custom2) { - if (is_null($custom2)) { - array_push($this->openAPINullablesSetToNull, 'custom2'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom2', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom2'] = $custom2; return $this; @@ -604,16 +442,6 @@ public function getCustom3() */ public function setCustom3($custom3) { - if (is_null($custom3)) { - array_push($this->openAPINullablesSetToNull, 'custom3'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom3', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom3'] = $custom3; return $this; @@ -638,16 +466,6 @@ public function getCustom4() */ public function setCustom4($custom4) { - if (is_null($custom4)) { - array_push($this->openAPINullablesSetToNull, 'custom4'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('custom4', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['custom4'] = $custom4; return $this; @@ -659,7 +477,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -671,7 +489,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -685,7 +502,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -701,7 +518,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -713,7 +530,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryReportResponse.php b/lib/Model/DeliveryReportResponse.php index 39c14ed..0ac1bdb 100644 --- a/lib/Model/DeliveryReportResponse.php +++ b/lib/Model/DeliveryReportResponse.php @@ -2,7 +2,7 @@ /** * DeliveryReportResponse * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerial 'omnimessageId' => 'UUID' ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'statuses' => false, - 'to' => false, - 'omnimessageId' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('statuses', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('omnimessageId', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['statuses'] = $data['statuses'] ?? null; + $this->container['to'] = $data['to'] ?? null; + $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; } /** @@ -333,9 +247,6 @@ public function getStatuses() */ public function setStatuses($statuses) { - if (is_null($statuses)) { - throw new \InvalidArgumentException('non-nullable statuses cannot be null'); - } $this->container['statuses'] = $statuses; return $this; @@ -360,9 +271,6 @@ public function getTo() */ public function setTo($to) { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } $this->container['to'] = $to; return $this; @@ -387,9 +295,6 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { - if (is_null($omnimessageId)) { - throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); - } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -401,7 +306,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryResult.php b/lib/Model/DeliveryResult.php index 09858a8..049d5e3 100644 --- a/lib/Model/DeliveryResult.php +++ b/lib/Model/DeliveryResult.php @@ -2,7 +2,7 @@ /** * DeliveryResult * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -83,27 +85,6 @@ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable 'timestamp' => 'date-time' ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'status' => false, - 'channel' => false, - 'messageId' => false, - 'error' => true, - 'err' => false, - 'timestamp' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -124,58 +105,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -276,30 +205,12 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], null); - $this->setIfExists('messageId', $data ?? [], null); - $this->setIfExists('error', $data ?? [], null); - $this->setIfExists('err', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['status'] = $data['status'] ?? null; + $this->container['channel'] = $data['channel'] ?? null; + $this->container['messageId'] = $data['messageId'] ?? null; + $this->container['error'] = $data['error'] ?? null; + $this->container['err'] = $data['err'] ?? null; + $this->container['timestamp'] = $data['timestamp'] ?? null; } /** @@ -345,9 +256,6 @@ public function getStatus() */ public function setStatus($status) { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } $this->container['status'] = $status; return $this; @@ -372,9 +280,6 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $this->container['channel'] = $channel; return $this; @@ -399,9 +304,6 @@ public function getMessageId() */ public function setMessageId($messageId) { - if (is_null($messageId)) { - throw new \InvalidArgumentException('non-nullable messageId cannot be null'); - } $this->container['messageId'] = $messageId; return $this; @@ -426,16 +328,6 @@ public function getError() */ public function setError($error) { - if (is_null($error)) { - array_push($this->openAPINullablesSetToNull, 'error'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('error', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['error'] = $error; return $this; @@ -460,9 +352,6 @@ public function getErr() */ public function setErr($err) { - if (is_null($err)) { - throw new \InvalidArgumentException('non-nullable err cannot be null'); - } $this->container['err'] = $err; return $this; @@ -487,9 +376,6 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { - if (is_null($timestamp)) { - throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); - } $this->container['timestamp'] = $timestamp; return $this; @@ -501,7 +387,7 @@ public function setTimestamp($timestamp) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -513,7 +399,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -527,7 +412,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -543,7 +428,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -555,7 +440,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorCodeOmnichannel.php b/lib/Model/ErrorCodeOmnichannel.php index 51e6e9c..5f88cd2 100644 --- a/lib/Model/ErrorCodeOmnichannel.php +++ b/lib/Model/ErrorCodeOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannel * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,19 +44,19 @@ class ErrorCodeOmnichannel /** * Possible values of this enum */ - public const _101 = '101'; + const _101 = '101'; - public const _102 = '102'; + const _102 = '102'; - public const _103 = '103'; + const _103 = '103'; - public const _104 = '104'; + const _104 = '104'; - public const _105 = '105'; + const _105 = '105'; - public const _106 = '106'; + const _106 = '106'; - public const _107 = '107'; + const _107 = '107'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeOmnichannelMachine.php b/lib/Model/ErrorCodeOmnichannelMachine.php index 8dd9e02..50b2f5f 100644 --- a/lib/Model/ErrorCodeOmnichannelMachine.php +++ b/lib/Model/ErrorCodeOmnichannelMachine.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannelMachine * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,29 +44,29 @@ class ErrorCodeOmnichannelMachine /** * Possible values of this enum */ - public const NUMBER_0 = 0; + const NUMBER_0 = 0; - public const NUMBER_1 = 1; + const NUMBER_1 = 1; - public const NUMBER_2 = 2; + const NUMBER_2 = 2; - public const NUMBER_3 = 3; + const NUMBER_3 = 3; - public const NUMBER_4 = 4; + const NUMBER_4 = 4; - public const NUMBER_5 = 5; + const NUMBER_5 = 5; - public const NUMBER_6 = 6; + const NUMBER_6 = 6; - public const NUMBER_7 = 7; + const NUMBER_7 = 7; - public const NUMBER_8 = 8; + const NUMBER_8 = 8; - public const NUMBER_9 = 9; + const NUMBER_9 = 9; - public const NUMBER_10 = 10; + const NUMBER_10 = 10; - public const NUMBER_999 = 999; + const NUMBER_999 = 999; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodePhonebook.php b/lib/Model/ErrorCodePhonebook.php index 1d455bd..37fdb89 100644 --- a/lib/Model/ErrorCodePhonebook.php +++ b/lib/Model/ErrorCodePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorCodePhonebook * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,17 +44,17 @@ class ErrorCodePhonebook /** * Possible values of this enum */ - public const _201 = '201'; + const _201 = '201'; - public const _202 = '202'; + const _202 = '202'; - public const _203 = '203'; + const _203 = '203'; - public const _204 = '204'; + const _204 = '204'; - public const _244 = '244'; + const _244 = '244'; - public const _205 = '205'; + const _205 = '205'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeStatistics.php b/lib/Model/ErrorCodeStatistics.php index aa373bf..6b082f7 100644 --- a/lib/Model/ErrorCodeStatistics.php +++ b/lib/Model/ErrorCodeStatistics.php @@ -2,7 +2,7 @@ /** * ErrorCodeStatistics * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,13 +44,13 @@ class ErrorCodeStatistics /** * Possible values of this enum */ - public const _100 = '100'; + const _100 = '100'; - public const _103 = '103'; + const _103 = '103'; - public const _104 = '104'; + const _104 = '104'; - public const _105 = '105'; + const _105 = '105'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorItemNumberLookup.php b/lib/Model/ErrorItemNumberLookup.php index 1fe0fe4..1173426 100644 --- a/lib/Model/ErrorItemNumberLookup.php +++ b/lib/Model/ErrorItemNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookup * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSeriali 'error' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'error' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('error', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['error'] = $data['error'] ?? null; } /** @@ -313,9 +229,6 @@ public function getError() */ public function setError($error) { - if (is_null($error)) { - throw new \InvalidArgumentException('non-nullable error cannot be null'); - } $this->container['error'] = $error; return $this; @@ -327,7 +240,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemNumberLookupError.php b/lib/Model/ErrorItemNumberLookupError.php index 54436a2..b8f6254 100644 --- a/lib/Model/ErrorItemNumberLookupError.php +++ b/lib/Model/ErrorItemNumberLookupError.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookupError * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,23 +77,6 @@ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSe 'code' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'description' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -112,58 +97,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -252,26 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('description', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['description'] = $data['description'] ?? null; + $this->container['code'] = $data['code'] ?? null; } /** @@ -331,9 +246,6 @@ public function getDescription() */ public function setDescription($description) { - if (is_null($description)) { - throw new \InvalidArgumentException('non-nullable description cannot be null'); - } $this->container['description'] = $description; return $this; @@ -358,9 +270,6 @@ public function getCode() */ public function setCode($code) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } if (($code > 106)) { throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be smaller than or equal to 106.'); @@ -380,7 +289,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -392,7 +301,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -406,7 +314,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -422,7 +330,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -434,7 +342,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemOmnichannel.php b/lib/Model/ErrorItemOmnichannel.php index afd0fc5..dd1cad6 100644 --- a/lib/Model/ErrorItemOmnichannel.php +++ b/lib/Model/ErrorItemOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorItemOmnichannel * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,25 +81,6 @@ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializ 'source' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'detail' => false, - 'code' => false, - 'source' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -118,58 +101,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -264,28 +195,10 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('detail', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('source', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['title'] = $data['title'] ?? null; + $this->container['detail'] = $data['detail'] ?? null; + $this->container['code'] = $data['code'] ?? null; + $this->container['source'] = $data['source'] ?? null; } /** @@ -343,9 +256,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } $this->container['title'] = $title; return $this; @@ -370,9 +280,6 @@ public function getDetail() */ public function setDetail($detail) { - if (is_null($detail)) { - throw new \InvalidArgumentException('non-nullable detail cannot be null'); - } $this->container['detail'] = $detail; return $this; @@ -397,9 +304,6 @@ public function getCode() */ public function setCode($code) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } $this->container['code'] = $code; return $this; @@ -424,16 +328,6 @@ public function getSource() */ public function setSource($source) { - if (is_null($source)) { - array_push($this->openAPINullablesSetToNull, 'source'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('source', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['source'] = $source; return $this; @@ -445,7 +339,7 @@ public function setSource($source) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -457,7 +351,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -471,7 +364,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -487,7 +380,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -499,7 +392,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemPhonebook.php b/lib/Model/ErrorItemPhonebook.php index 2a3b976..8e0cb54 100644 --- a/lib/Model/ErrorItemPhonebook.php +++ b/lib/Model/ErrorItemPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorItemPhonebook * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializab 'code' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'detail' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('detail', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['title'] = $data['title'] ?? null; + $this->container['detail'] = $data['detail'] ?? null; + $this->container['code'] = $data['code'] ?? null; } /** @@ -333,9 +247,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } $this->container['title'] = $title; return $this; @@ -360,9 +271,6 @@ public function getDetail() */ public function setDetail($detail) { - if (is_null($detail)) { - throw new \InvalidArgumentException('non-nullable detail cannot be null'); - } $this->container['detail'] = $detail; return $this; @@ -387,9 +295,6 @@ public function getCode() */ public function setCode($code) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } $this->container['code'] = $code; return $this; @@ -401,7 +306,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemStatistics.php b/lib/Model/ErrorItemStatistics.php index d01b438..1c794d4 100644 --- a/lib/Model/ErrorItemStatistics.php +++ b/lib/Model/ErrorItemStatistics.php @@ -2,7 +2,7 @@ /** * ErrorItemStatistics * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializa 'code' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'title' => false, - 'details' => false, - 'code' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('title', $data ?? [], null); - $this->setIfExists('details', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['title'] = $data['title'] ?? null; + $this->container['details'] = $data['details'] ?? null; + $this->container['code'] = $data['code'] ?? null; } /** @@ -333,9 +247,6 @@ public function getTitle() */ public function setTitle($title) { - if (is_null($title)) { - throw new \InvalidArgumentException('non-nullable title cannot be null'); - } $this->container['title'] = $title; return $this; @@ -360,9 +271,6 @@ public function getDetails() */ public function setDetails($details) { - if (is_null($details)) { - throw new \InvalidArgumentException('non-nullable details cannot be null'); - } $this->container['details'] = $details; return $this; @@ -387,9 +295,6 @@ public function getCode() */ public function setCode($code) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } $this->container['code'] = $code; return $this; @@ -401,7 +306,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorNumberLookup.php b/lib/Model/ErrorNumberLookup.php index fce5576..1e4d769 100644 --- a/lib/Model/ErrorNumberLookup.php +++ b/lib/Model/ErrorNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorNumberLookup * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializabl 'errors' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['errors'] = $data['errors'] ?? null; } /** @@ -313,9 +229,6 @@ public function getErrors() */ public function setErrors($errors) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } $this->container['errors'] = $errors; return $this; @@ -327,7 +240,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorOmnichannel.php b/lib/Model/ErrorOmnichannel.php index d613256..ff18c12 100644 --- a/lib/Model/ErrorOmnichannel.php +++ b/lib/Model/ErrorOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorOmnichannel * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['errors'] = $data['errors'] ?? null; } /** @@ -313,9 +229,6 @@ public function getErrors() */ public function setErrors($errors) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } $this->container['errors'] = $errors; return $this; @@ -327,7 +240,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorPhonebook.php b/lib/Model/ErrorPhonebook.php index 4a42fb3..6f5f502 100644 --- a/lib/Model/ErrorPhonebook.php +++ b/lib/Model/ErrorPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorPhonebook * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['errors'] = $data['errors'] ?? null; } /** @@ -313,9 +229,6 @@ public function getErrors() */ public function setErrors($errors) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } $this->container['errors'] = $errors; return $this; @@ -327,7 +240,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorStatistics.php b/lib/Model/ErrorStatistics.php index 1c49519..dec3d64 100644 --- a/lib/Model/ErrorStatistics.php +++ b/lib/Model/ErrorStatistics.php @@ -2,7 +2,7 @@ /** * ErrorStatistics * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'errors' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('errors', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['errors'] = $data['errors'] ?? null; } /** @@ -313,9 +229,6 @@ public function getErrors() */ public function setErrors($errors) { - if (is_null($errors)) { - throw new \InvalidArgumentException('non-nullable errors cannot be null'); - } $this->container['errors'] = $errors; return $this; @@ -327,7 +240,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorTitleOmnichannel.php b/lib/Model/ErrorTitleOmnichannel.php index 2538506..e5a0b6b 100644 --- a/lib/Model/ErrorTitleOmnichannel.php +++ b/lib/Model/ErrorTitleOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorTitleOmnichannel * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,19 +44,19 @@ class ErrorTitleOmnichannel /** * Possible values of this enum */ - public const NOT_FOUND = 'Not found'; + const NOT_FOUND = 'Not found'; - public const FORBIDDEN = 'Forbidden'; + const FORBIDDEN = 'Forbidden'; - public const UNAUTHORIZED = 'Unauthorized'; + const UNAUTHORIZED = 'Unauthorized'; - public const INVALID_DATA = 'Invalid data'; + const INVALID_DATA = 'Invalid data'; - public const INTERNAL_SERVER_ERROR = 'Internal Server Error'; + const INTERNAL_SERVER_ERROR = 'Internal Server Error'; - public const MISSING_DATA = 'Missing data'; + const MISSING_DATA = 'Missing data'; - public const METHOD_NOT_ALLOWED = 'Method not allowed'; + const METHOD_NOT_ALLOWED = 'Method not allowed'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorTitlePhonebook.php b/lib/Model/ErrorTitlePhonebook.php index e7c0305..5fe8354 100644 --- a/lib/Model/ErrorTitlePhonebook.php +++ b/lib/Model/ErrorTitlePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorTitlePhonebook * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,17 +44,17 @@ class ErrorTitlePhonebook /** * Possible values of this enum */ - public const INVALID_DATA = 'Invalid data'; + const INVALID_DATA = 'Invalid data'; - public const UNAUTHORIZED = 'Unauthorized'; + const UNAUTHORIZED = 'Unauthorized'; - public const MISSING_RESOURCE = 'Missing resource'; + const MISSING_RESOURCE = 'Missing resource'; - public const CONFLICT = 'Conflict'; + const CONFLICT = 'Conflict'; - public const CLIENT_ERROR = 'Client error'; + const CLIENT_ERROR = 'Client error'; - public const GENERAL_ERROR = 'General error'; + const GENERAL_ERROR = 'General error'; /** * Gets allowable values of the enum diff --git a/lib/Model/FetchBlacklistSuccess.php b/lib/Model/FetchBlacklistSuccess.php index 12fd322..55fe1a5 100644 --- a/lib/Model/FetchBlacklistSuccess.php +++ b/lib/Model/FetchBlacklistSuccess.php @@ -2,7 +2,7 @@ /** * FetchBlacklistSuccess * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSeriali 'phoneNumbers' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumbers' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('phoneNumbers', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['phoneNumbers'] = $data['phoneNumbers'] ?? null; } /** @@ -310,9 +226,6 @@ public function getPhoneNumbers() */ public function setPhoneNumbers($phoneNumbers) { - if (is_null($phoneNumbers)) { - throw new \InvalidArgumentException('non-nullable phoneNumbers cannot be null'); - } $this->container['phoneNumbers'] = $phoneNumbers; @@ -326,7 +239,7 @@ public function setPhoneNumbers($phoneNumbers) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -338,7 +251,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -352,7 +264,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -368,7 +280,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -380,7 +292,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupEnvelope.php b/lib/Model/GroupEnvelope.php index 60a9d7b..d2fd51c 100644 --- a/lib/Model/GroupEnvelope.php +++ b/lib/Model/GroupEnvelope.php @@ -2,7 +2,7 @@ /** * GroupEnvelope * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'group' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'group' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('group', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['group'] = $data['group'] ?? null; } /** @@ -310,9 +226,6 @@ public function getGroup() */ public function setGroup($group) { - if (is_null($group)) { - throw new \InvalidArgumentException('non-nullable group cannot be null'); - } $this->container['group'] = $group; return $this; @@ -324,7 +237,7 @@ public function setGroup($group) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -336,7 +249,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -350,7 +262,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -366,7 +278,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -378,7 +290,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupListEnvelope.php b/lib/Model/GroupListEnvelope.php index b0fc28c..da5982b 100644 --- a/lib/Model/GroupListEnvelope.php +++ b/lib/Model/GroupListEnvelope.php @@ -2,7 +2,7 @@ /** * GroupListEnvelope * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializabl 'groups' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'groups' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('groups', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['groups'] = $data['groups'] ?? null; } /** @@ -310,9 +226,6 @@ public function getGroups() */ public function setGroups($groups) { - if (is_null($groups)) { - throw new \InvalidArgumentException('non-nullable groups cannot be null'); - } $this->container['groups'] = $groups; @@ -326,7 +239,7 @@ public function setGroups($groups) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -338,7 +251,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -352,7 +264,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -368,7 +280,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -380,7 +292,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupName.php b/lib/Model/GroupName.php index 17725d9..5d6f31b 100644 --- a/lib/Model/GroupName.php +++ b/lib/Model/GroupName.php @@ -2,7 +2,7 @@ /** * GroupName * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('name', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['name'] = $data['name'] ?? null; } /** @@ -317,9 +233,6 @@ public function getName() */ public function setName($name) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } if ((mb_strlen($name) < 1)) { throw new \InvalidArgumentException('invalid length for $name when calling GroupName., must be bigger than or equal to 1.'); @@ -336,7 +249,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -348,7 +261,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -362,7 +274,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -378,7 +290,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -390,7 +302,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupResponseFields.php b/lib/Model/GroupResponseFields.php index e2632ba..8da8935 100644 --- a/lib/Model/GroupResponseFields.php +++ b/lib/Model/GroupResponseFields.php @@ -2,7 +2,7 @@ /** * GroupResponseFields * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,25 +81,6 @@ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializa 'contactsCount' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'name' => false, - 'createdOn' => true, - 'contactsCount' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -118,58 +101,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -264,28 +195,10 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('createdOn', $data ?? [], null); - $this->setIfExists('contactsCount', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['id'] = $data['id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['createdOn'] = $data['createdOn'] ?? null; + $this->container['contactsCount'] = $data['contactsCount'] ?? null; } /** @@ -340,9 +253,6 @@ public function getId() */ public function setId($id) { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } $this->container['id'] = $id; return $this; @@ -367,9 +277,6 @@ public function getName() */ public function setName($name) { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } $this->container['name'] = $name; return $this; @@ -394,16 +301,6 @@ public function getCreatedOn() */ public function setCreatedOn($createdOn) { - if (is_null($createdOn)) { - array_push($this->openAPINullablesSetToNull, 'createdOn'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('createdOn', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['createdOn'] = $createdOn; return $this; @@ -428,9 +325,6 @@ public function getContactsCount() */ public function setContactsCount($contactsCount) { - if (is_null($contactsCount)) { - throw new \InvalidArgumentException('non-nullable contactsCount cannot be null'); - } $this->container['contactsCount'] = $contactsCount; return $this; @@ -442,7 +336,7 @@ public function setContactsCount($contactsCount) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -454,7 +348,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -468,7 +361,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -484,7 +377,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -496,7 +389,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MessageResult.php b/lib/Model/MessageResult.php index 1aa0a00..5955d04 100644 --- a/lib/Model/MessageResult.php +++ b/lib/Model/MessageResult.php @@ -2,7 +2,7 @@ /** * MessageResult * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'messageId' => false, - 'channel' => false, - 'sender' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('messageId', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], null); - $this->setIfExists('sender', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['messageId'] = $data['messageId'] ?? null; + $this->container['channel'] = $data['channel'] ?? null; + $this->container['sender'] = $data['sender'] ?? null; } /** @@ -333,9 +247,6 @@ public function getMessageId() */ public function setMessageId($messageId) { - if (is_null($messageId)) { - throw new \InvalidArgumentException('non-nullable messageId cannot be null'); - } $this->container['messageId'] = $messageId; return $this; @@ -360,9 +271,6 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $this->container['channel'] = $channel; return $this; @@ -387,9 +295,6 @@ public function getSender() */ public function setSender($sender) { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } $this->container['sender'] = $sender; return $this; @@ -401,7 +306,7 @@ public function setSender($sender) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MobileNetwork.php b/lib/Model/MobileNetwork.php index 009d7f5..8309511 100644 --- a/lib/Model/MobileNetwork.php +++ b/lib/Model/MobileNetwork.php @@ -2,7 +2,7 @@ /** * MobileNetwork * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -81,26 +83,6 @@ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable 'countryCode' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'mccmnc' => false, - 'networkName' => false, - 'countryName' => false, - 'countryPrefix' => false, - 'countryCode' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -121,58 +103,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -270,29 +200,11 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('mccmnc', $data ?? [], null); - $this->setIfExists('networkName', $data ?? [], null); - $this->setIfExists('countryName', $data ?? [], null); - $this->setIfExists('countryPrefix', $data ?? [], null); - $this->setIfExists('countryCode', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['mccmnc'] = $data['mccmnc'] ?? null; + $this->container['networkName'] = $data['networkName'] ?? null; + $this->container['countryName'] = $data['countryName'] ?? null; + $this->container['countryPrefix'] = $data['countryPrefix'] ?? null; + $this->container['countryCode'] = $data['countryCode'] ?? null; } /** @@ -338,9 +250,6 @@ public function getMccmnc() */ public function setMccmnc($mccmnc) { - if (is_null($mccmnc)) { - throw new \InvalidArgumentException('non-nullable mccmnc cannot be null'); - } $this->container['mccmnc'] = $mccmnc; return $this; @@ -365,9 +274,6 @@ public function getNetworkName() */ public function setNetworkName($networkName) { - if (is_null($networkName)) { - throw new \InvalidArgumentException('non-nullable networkName cannot be null'); - } $this->container['networkName'] = $networkName; return $this; @@ -392,9 +298,6 @@ public function getCountryName() */ public function setCountryName($countryName) { - if (is_null($countryName)) { - throw new \InvalidArgumentException('non-nullable countryName cannot be null'); - } $this->container['countryName'] = $countryName; return $this; @@ -419,9 +322,6 @@ public function getCountryPrefix() */ public function setCountryPrefix($countryPrefix) { - if (is_null($countryPrefix)) { - throw new \InvalidArgumentException('non-nullable countryPrefix cannot be null'); - } $this->container['countryPrefix'] = $countryPrefix; return $this; @@ -446,9 +346,6 @@ public function getCountryCode() */ public function setCountryCode($countryCode) { - if (is_null($countryCode)) { - throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); - } $this->container['countryCode'] = $countryCode; return $this; @@ -460,7 +357,7 @@ public function setCountryCode($countryCode) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -472,7 +369,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -486,7 +382,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -502,7 +398,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -514,7 +410,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php index da1a39e..672465c 100644 --- a/lib/Model/ModelInterface.php +++ b/lib/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api\Model @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -93,20 +93,4 @@ public function listInvalidProperties(); * @return bool */ public function valid(); - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool; - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool; } diff --git a/lib/Model/NumberToBlacklist.php b/lib/Model/NumberToBlacklist.php index 0c647b5..59d996c 100644 --- a/lib/Model/NumberToBlacklist.php +++ b/lib/Model/NumberToBlacklist.php @@ -2,7 +2,7 @@ /** * NumberToBlacklist * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializabl 'phoneNumber' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'phoneNumber' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('phoneNumber', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; } /** @@ -313,9 +229,6 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { - if (is_null($phoneNumber)) { - throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); - } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -327,7 +240,7 @@ public function setPhoneNumber($phoneNumber) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/NumbersToInvestigate.php b/lib/Model/NumbersToInvestigate.php index fcdb632..5f5b95c 100644 --- a/lib/Model/NumbersToInvestigate.php +++ b/lib/Model/NumbersToInvestigate.php @@ -2,7 +2,7 @@ /** * NumbersToInvestigate * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializ 'numbers' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'numbers' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('numbers', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['numbers'] = $data['numbers'] ?? null; } /** @@ -321,9 +237,6 @@ public function getNumbers() */ public function setNumbers($numbers) { - if (is_null($numbers)) { - throw new \InvalidArgumentException('non-nullable numbers cannot be null'); - } if ((count($numbers) > 10)) { throw new \InvalidArgumentException('invalid value for $numbers when calling NumbersToInvestigate., number of items must be less than or equal to 10.'); @@ -342,7 +255,7 @@ public function setNumbers($numbers) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -354,7 +267,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -368,7 +280,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -384,7 +296,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -396,7 +308,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmniMessageCreateSuccessResponse.php b/lib/Model/OmniMessageCreateSuccessResponse.php index 51f9bf1..387711d 100644 --- a/lib/Model/OmniMessageCreateSuccessResponse.php +++ b/lib/Model/OmniMessageCreateSuccessResponse.php @@ -2,7 +2,7 @@ /** * OmniMessageCreateSuccessResponse * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \ 'omnimessageId' => 'UUID' ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'messages' => false, - 'to' => false, - 'omnimessageId' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('messages', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('omnimessageId', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['messages'] = $data['messages'] ?? null; + $this->container['to'] = $data['to'] ?? null; + $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; } /** @@ -333,9 +247,6 @@ public function getMessages() */ public function setMessages($messages) { - if (is_null($messages)) { - throw new \InvalidArgumentException('non-nullable messages cannot be null'); - } $this->container['messages'] = $messages; return $this; @@ -360,9 +271,6 @@ public function getTo() */ public function setTo($to) { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } $this->container['to'] = $to; return $this; @@ -387,9 +295,6 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { - if (is_null($omnimessageId)) { - throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); - } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -401,7 +306,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Omnimessage.php b/lib/Model/Omnimessage.php index 873874f..f312944 100644 --- a/lib/Model/Omnimessage.php +++ b/lib/Model/Omnimessage.php @@ -2,7 +2,7 @@ /** * Omnimessage * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -60,7 +62,7 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'to' => 'string', - 'messages' => '\Messente\Api\Model\OmnimessageMessagesInner[]', + 'messages' => 'OneOfViberSMSWhatsAppTelegram[]', 'dlrUrl' => 'string', 'textStore' => '\Messente\Api\Model\TextStore', 'timeToSend' => '\DateTime', @@ -83,27 +85,6 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable 'priority' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'to' => false, - 'messages' => false, - 'dlrUrl' => false, - 'textStore' => false, - 'timeToSend' => false, - 'priority' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -124,58 +105,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -276,30 +205,12 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('messages', $data ?? [], null); - $this->setIfExists('dlrUrl', $data ?? [], null); - $this->setIfExists('textStore', $data ?? [], null); - $this->setIfExists('timeToSend', $data ?? [], null); - $this->setIfExists('priority', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['to'] = $data['to'] ?? null; + $this->container['messages'] = $data['messages'] ?? null; + $this->container['dlrUrl'] = $data['dlrUrl'] ?? null; + $this->container['textStore'] = $data['textStore'] ?? null; + $this->container['timeToSend'] = $data['timeToSend'] ?? null; + $this->container['priority'] = $data['priority'] ?? null; } /** @@ -351,9 +262,6 @@ public function getTo() */ public function setTo($to) { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } $this->container['to'] = $to; return $this; @@ -362,7 +270,7 @@ public function setTo($to) /** * Gets messages * - * @return \Messente\Api\Model\OmnimessageMessagesInner[] + * @return OneOfViberSMSWhatsAppTelegram[] */ public function getMessages() { @@ -372,15 +280,12 @@ public function getMessages() /** * Sets messages * - * @param \Messente\Api\Model\OmnimessageMessagesInner[] $messages An array of messages + * @param OneOfViberSMSWhatsAppTelegram[] $messages An array of messages * * @return self */ public function setMessages($messages) { - if (is_null($messages)) { - throw new \InvalidArgumentException('non-nullable messages cannot be null'); - } $this->container['messages'] = $messages; return $this; @@ -405,9 +310,6 @@ public function getDlrUrl() */ public function setDlrUrl($dlrUrl) { - if (is_null($dlrUrl)) { - throw new \InvalidArgumentException('non-nullable dlrUrl cannot be null'); - } $this->container['dlrUrl'] = $dlrUrl; return $this; @@ -432,9 +334,6 @@ public function getTextStore() */ public function setTextStore($textStore) { - if (is_null($textStore)) { - throw new \InvalidArgumentException('non-nullable textStore cannot be null'); - } $this->container['textStore'] = $textStore; return $this; @@ -459,9 +358,6 @@ public function getTimeToSend() */ public function setTimeToSend($timeToSend) { - if (is_null($timeToSend)) { - throw new \InvalidArgumentException('non-nullable timeToSend cannot be null'); - } $this->container['timeToSend'] = $timeToSend; return $this; @@ -486,9 +382,6 @@ public function getPriority() */ public function setPriority($priority) { - if (is_null($priority)) { - throw new \InvalidArgumentException('non-nullable priority cannot be null'); - } $this->container['priority'] = $priority; return $this; @@ -500,7 +393,7 @@ public function setPriority($priority) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -512,7 +405,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -526,7 +418,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -542,7 +434,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -554,7 +446,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmnimessageMessagesInner.php b/lib/Model/OmnimessageMessagesInner.php deleted file mode 100644 index efdac3d..0000000 --- a/lib/Model/OmnimessageMessagesInner.php +++ /dev/null @@ -1,889 +0,0 @@ - - */ -class OmnimessageMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Omnimessage_messages_inner'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'sender' => 'string', - 'validity' => 'int', - 'ttl' => 'int', - 'text' => 'string', - 'imageUrl' => 'string', - 'buttonUrl' => 'string', - 'buttonText' => 'string', - 'channel' => 'string', - 'autoconvert' => 'string', - 'udh' => 'string', - 'template' => '\Messente\Api\Model\WhatsAppTemplate', - 'documentUrl' => 'string', - 'audioUrl' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'sender' => null, - 'validity' => null, - 'ttl' => null, - 'text' => null, - 'imageUrl' => null, - 'buttonUrl' => null, - 'buttonText' => null, - 'channel' => null, - 'autoconvert' => null, - 'udh' => null, - 'template' => null, - 'documentUrl' => null, - 'audioUrl' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'text' => false, - 'imageUrl' => false, - 'buttonUrl' => false, - 'buttonText' => false, - 'channel' => false, - 'autoconvert' => false, - 'udh' => false, - 'template' => false, - 'documentUrl' => false, - 'audioUrl' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'sender' => 'sender', - 'validity' => 'validity', - 'ttl' => 'ttl', - 'text' => 'text', - 'imageUrl' => 'image_url', - 'buttonUrl' => 'button_url', - 'buttonText' => 'button_text', - 'channel' => 'channel', - 'autoconvert' => 'autoconvert', - 'udh' => 'udh', - 'template' => 'template', - 'documentUrl' => 'document_url', - 'audioUrl' => 'audio_url' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'sender' => 'setSender', - 'validity' => 'setValidity', - 'ttl' => 'setTtl', - 'text' => 'setText', - 'imageUrl' => 'setImageUrl', - 'buttonUrl' => 'setButtonUrl', - 'buttonText' => 'setButtonText', - 'channel' => 'setChannel', - 'autoconvert' => 'setAutoconvert', - 'udh' => 'setUdh', - 'template' => 'setTemplate', - 'documentUrl' => 'setDocumentUrl', - 'audioUrl' => 'setAudioUrl' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'sender' => 'getSender', - 'validity' => 'getValidity', - 'ttl' => 'getTtl', - 'text' => 'getText', - 'imageUrl' => 'getImageUrl', - 'buttonUrl' => 'getButtonUrl', - 'buttonText' => 'getButtonText', - 'channel' => 'getChannel', - 'autoconvert' => 'getAutoconvert', - 'udh' => 'getUdh', - 'template' => 'getTemplate', - 'documentUrl' => 'getDocumentUrl', - 'audioUrl' => 'getAudioUrl' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - public const CHANNEL_TELEGRAM = 'telegram'; - public const AUTOCONVERT_FULL = 'full'; - public const AUTOCONVERT_ON = 'on'; - public const AUTOCONVERT_OFF = 'off'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getChannelAllowableValues() - { - return [ - self::CHANNEL_TELEGRAM, - ]; - } - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getAutoconvertAllowableValues() - { - return [ - self::AUTOCONVERT_FULL, - self::AUTOCONVERT_ON, - self::AUTOCONVERT_OFF, - ]; - } - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('buttonUrl', $data ?? [], null); - $this->setIfExists('buttonText', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'telegram'); - $this->setIfExists('autoconvert', $data ?? [], null); - $this->setIfExists('udh', $data ?? [], null); - $this->setIfExists('template', $data ?? [], null); - $this->setIfExists('documentUrl', $data ?? [], null); - $this->setIfExists('audioUrl', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['text'] === null) { - $invalidProperties[] = "'text' can't be null"; - } - $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'channel', must be one of '%s'", - $this->container['channel'], - implode("', '", $allowedValues) - ); - } - - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'autoconvert', must be one of '%s'", - $this->container['autoconvert'], - implode("', '", $allowedValues) - ); - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets sender - * - * @return string|null - */ - public function getSender() - { - return $this->container['sender']; - } - - /** - * Sets sender - * - * @param string|null $sender Phone number or alphanumeric sender name - * - * @return self - */ - public function setSender($sender) - { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } - $this->container['sender'] = $sender; - - return $this; - } - - /** - * Gets validity - * - * @return int|null - */ - public function getValidity() - { - return $this->container['validity']; - } - - /** - * Sets validity - * - * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted - * - * @return self - */ - public function setValidity($validity) - { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } - $this->container['validity'] = $validity; - - return $this; - } - - /** - * Gets ttl - * - * @return int|null - */ - public function getTtl() - { - return $this->container['ttl']; - } - - /** - * Sets ttl - * - * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. - * - * @return self - */ - public function setTtl($ttl) - { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } - $this->container['ttl'] = $ttl; - - return $this; - } - - /** - * Gets text - * - * @return string - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string $text Plaintext content for Telegram - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets imageUrl - * - * @return string|null - */ - public function getImageUrl() - { - return $this->container['imageUrl']; - } - - /** - * Sets imageUrl - * - * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" - * - * @return self - */ - public function setImageUrl($imageUrl) - { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } - $this->container['imageUrl'] = $imageUrl; - - return $this; - } - - /** - * Gets buttonUrl - * - * @return string|null - */ - public function getButtonUrl() - { - return $this->container['buttonUrl']; - } - - /** - * Sets buttonUrl - * - * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) - * - * @return self - */ - public function setButtonUrl($buttonUrl) - { - if (is_null($buttonUrl)) { - throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); - } - $this->container['buttonUrl'] = $buttonUrl; - - return $this; - } - - /** - * Gets buttonText - * - * @return string|null - */ - public function getButtonText() - { - return $this->container['buttonText']; - } - - /** - * Sets buttonText - * - * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) - * - * @return self - */ - public function setButtonText($buttonText) - { - if (is_null($buttonText)) { - throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); - } - $this->container['buttonText'] = $buttonText; - - return $this; - } - - /** - * Gets channel - * - * @return string|null - */ - public function getChannel() - { - return $this->container['channel']; - } - - /** - * Sets channel - * - * @param string|null $channel The channel used to deliver the message - * - * @return self - */ - public function setChannel($channel) - { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } - $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'channel', must be one of '%s'", - $channel, - implode("', '", $allowedValues) - ) - ); - } - $this->container['channel'] = $channel; - - return $this; - } - - /** - * Gets autoconvert - * - * @return string|null - */ - public function getAutoconvert() - { - return $this->container['autoconvert']; - } - - /** - * Sets autoconvert - * - * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way - * - * @return self - */ - public function setAutoconvert($autoconvert) - { - if (is_null($autoconvert)) { - throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); - } - $allowedValues = $this->getAutoconvertAllowableValues(); - if (!in_array($autoconvert, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'autoconvert', must be one of '%s'", - $autoconvert, - implode("', '", $allowedValues) - ) - ); - } - $this->container['autoconvert'] = $autoconvert; - - return $this; - } - - /** - * Gets udh - * - * @return string|null - */ - public function getUdh() - { - return $this->container['udh']; - } - - /** - * Sets udh - * - * @param string|null $udh hex-encoded string containing SMS UDH - * - * @return self - */ - public function setUdh($udh) - { - if (is_null($udh)) { - throw new \InvalidArgumentException('non-nullable udh cannot be null'); - } - $this->container['udh'] = $udh; - - return $this; - } - - /** - * Gets template - * - * @return \Messente\Api\Model\WhatsAppTemplate|null - */ - public function getTemplate() - { - return $this->container['template']; - } - - /** - * Sets template - * - * @param \Messente\Api\Model\WhatsAppTemplate|null $template template - * - * @return self - */ - public function setTemplate($template) - { - if (is_null($template)) { - throw new \InvalidArgumentException('non-nullable template cannot be null'); - } - $this->container['template'] = $template; - - return $this; - } - - /** - * Gets documentUrl - * - * @return string|null - */ - public function getDocumentUrl() - { - return $this->container['documentUrl']; - } - - /** - * Sets documentUrl - * - * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" - * - * @return self - */ - public function setDocumentUrl($documentUrl) - { - if (is_null($documentUrl)) { - throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); - } - $this->container['documentUrl'] = $documentUrl; - - return $this; - } - - /** - * Gets audioUrl - * - * @return string|null - */ - public function getAudioUrl() - { - return $this->container['audioUrl']; - } - - /** - * Sets audioUrl - * - * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" - * - * @return self - */ - public function setAudioUrl($audioUrl) - { - if (is_null($audioUrl)) { - throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); - } - $this->container['audioUrl'] = $audioUrl; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/Priority.php b/lib/Model/Priority.php index 716c782..609f6b5 100644 --- a/lib/Model/Priority.php +++ b/lib/Model/Priority.php @@ -2,7 +2,7 @@ /** * Priority * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,11 +44,11 @@ class Priority /** * Possible values of this enum */ - public const LOW = 'low'; + const LOW = 'low'; - public const REGULAR = 'regular'; + const REGULAR = 'regular'; - public const HIGH = 'high'; + const HIGH = 'high'; /** * Gets allowable values of the enum diff --git a/lib/Model/SMS.php b/lib/Model/SMS.php index 20c3614..44acc1c 100644 --- a/lib/Model/SMS.php +++ b/lib/Model/SMS.php @@ -2,7 +2,7 @@ /** * SMS * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -85,28 +87,6 @@ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'text' => false, - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'autoconvert' => false, - 'udh' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -127,58 +107,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -266,10 +194,10 @@ public function getModelName() return self::$openAPIModelName; } - public const AUTOCONVERT_FULL = 'full'; - public const AUTOCONVERT_ON = 'on'; - public const AUTOCONVERT_OFF = 'off'; - public const CHANNEL_SMS = 'sms'; + const AUTOCONVERT_FULL = 'full'; + const AUTOCONVERT_ON = 'on'; + const AUTOCONVERT_OFF = 'off'; + const CHANNEL_SMS = 'sms'; /** * Gets allowable values of the enum @@ -312,31 +240,13 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('autoconvert', $data ?? [], null); - $this->setIfExists('udh', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'sms'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['text'] = $data['text'] ?? null; + $this->container['sender'] = $data['sender'] ?? null; + $this->container['validity'] = $data['validity'] ?? null; + $this->container['ttl'] = $data['ttl'] ?? null; + $this->container['autoconvert'] = $data['autoconvert'] ?? null; + $this->container['udh'] = $data['udh'] ?? null; + $this->container['channel'] = $data['channel'] ?? 'sms'; } /** @@ -403,9 +313,6 @@ public function getText() */ public function setText($text) { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } $this->container['text'] = $text; return $this; @@ -430,9 +337,6 @@ public function getSender() */ public function setSender($sender) { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } $this->container['sender'] = $sender; return $this; @@ -457,9 +361,6 @@ public function getValidity() */ public function setValidity($validity) { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } $this->container['validity'] = $validity; return $this; @@ -484,9 +385,6 @@ public function getTtl() */ public function setTtl($ttl) { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } $this->container['ttl'] = $ttl; return $this; @@ -511,11 +409,8 @@ public function getAutoconvert() */ public function setAutoconvert($autoconvert) { - if (is_null($autoconvert)) { - throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); - } $allowedValues = $this->getAutoconvertAllowableValues(); - if (!in_array($autoconvert, $allowedValues, true)) { + if (!is_null($autoconvert) && !in_array($autoconvert, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'autoconvert', must be one of '%s'", @@ -548,9 +443,6 @@ public function getUdh() */ public function setUdh($udh) { - if (is_null($udh)) { - throw new \InvalidArgumentException('non-nullable udh cannot be null'); - } $this->container['udh'] = $udh; return $this; @@ -575,11 +467,8 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -599,7 +488,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -611,7 +500,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -625,7 +513,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -641,7 +529,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -653,7 +541,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReport.php b/lib/Model/StatisticsReport.php index 92e1647..3e7d658 100644 --- a/lib/Model/StatisticsReport.php +++ b/lib/Model/StatisticsReport.php @@ -2,7 +2,7 @@ /** * StatisticsReport * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable 'country' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'totalMessages' => false, - 'totalPrice' => false, - 'country' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('totalMessages', $data ?? [], null); - $this->setIfExists('totalPrice', $data ?? [], null); - $this->setIfExists('country', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['totalMessages'] = $data['totalMessages'] ?? null; + $this->container['totalPrice'] = $data['totalPrice'] ?? null; + $this->container['country'] = $data['country'] ?? null; } /** @@ -333,9 +247,6 @@ public function getTotalMessages() */ public function setTotalMessages($totalMessages) { - if (is_null($totalMessages)) { - throw new \InvalidArgumentException('non-nullable totalMessages cannot be null'); - } $this->container['totalMessages'] = $totalMessages; return $this; @@ -360,9 +271,6 @@ public function getTotalPrice() */ public function setTotalPrice($totalPrice) { - if (is_null($totalPrice)) { - throw new \InvalidArgumentException('non-nullable totalPrice cannot be null'); - } $this->container['totalPrice'] = $totalPrice; return $this; @@ -387,9 +295,6 @@ public function getCountry() */ public function setCountry($country) { - if (is_null($country)) { - throw new \InvalidArgumentException('non-nullable country cannot be null'); - } $this->container['country'] = $country; return $this; @@ -401,7 +306,7 @@ public function setCountry($country) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +318,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +331,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +347,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +359,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSettings.php b/lib/Model/StatisticsReportSettings.php index 3d6ab50..74991c1 100644 --- a/lib/Model/StatisticsReportSettings.php +++ b/lib/Model/StatisticsReportSettings.php @@ -2,7 +2,7 @@ /** * StatisticsReportSettings * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,24 +79,6 @@ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSeri 'messageTypes' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'startDate' => false, - 'endDate' => false, - 'messageTypes' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +99,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -258,27 +190,9 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('startDate', $data ?? [], null); - $this->setIfExists('endDate', $data ?? [], null); - $this->setIfExists('messageTypes', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['startDate'] = $data['startDate'] ?? null; + $this->container['endDate'] = $data['endDate'] ?? null; + $this->container['messageTypes'] = $data['messageTypes'] ?? null; } /** @@ -330,9 +244,6 @@ public function getStartDate() */ public function setStartDate($startDate) { - if (is_null($startDate)) { - throw new \InvalidArgumentException('non-nullable startDate cannot be null'); - } $this->container['startDate'] = $startDate; return $this; @@ -357,9 +268,6 @@ public function getEndDate() */ public function setEndDate($endDate) { - if (is_null($endDate)) { - throw new \InvalidArgumentException('non-nullable endDate cannot be null'); - } $this->container['endDate'] = $endDate; return $this; @@ -384,9 +292,6 @@ public function getMessageTypes() */ public function setMessageTypes($messageTypes) { - if (is_null($messageTypes)) { - throw new \InvalidArgumentException('non-nullable messageTypes cannot be null'); - } $this->container['messageTypes'] = $messageTypes; return $this; @@ -398,7 +303,7 @@ public function setMessageTypes($messageTypes) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -410,7 +315,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -424,7 +328,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -440,7 +344,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -452,7 +356,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSuccess.php b/lib/Model/StatisticsReportSuccess.php index 9fd94d0..0178992 100644 --- a/lib/Model/StatisticsReportSuccess.php +++ b/lib/Model/StatisticsReportSuccess.php @@ -2,7 +2,7 @@ /** * StatisticsReportSuccess * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -73,22 +75,6 @@ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'reports' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'reports' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -246,25 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('reports', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['reports'] = $data['reports'] ?? null; } /** @@ -313,9 +229,6 @@ public function getReports() */ public function setReports($reports) { - if (is_null($reports)) { - throw new \InvalidArgumentException('non-nullable reports cannot be null'); - } $this->container['reports'] = $reports; return $this; @@ -327,7 +240,7 @@ public function setReports($reports) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Status.php b/lib/Model/Status.php index 1fd018f..dcfbfeb 100644 --- a/lib/Model/Status.php +++ b/lib/Model/Status.php @@ -2,7 +2,7 @@ /** * Status * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,27 +44,27 @@ class Status /** * Possible values of this enum */ - public const ACK = 'ACK'; + const ACK = 'ACK'; - public const DELIVRD = 'DELIVRD'; + const DELIVRD = 'DELIVRD'; - public const UNDELIV = 'UNDELIV'; + const UNDELIV = 'UNDELIV'; - public const FAILED = 'FAILED'; + const FAILED = 'FAILED'; - public const UNKNOWN = 'UNKNOWN'; + const UNKNOWN = 'UNKNOWN'; - public const ACCEPTD = 'ACCEPTD'; + const ACCEPTD = 'ACCEPTD'; - public const REJECTD = 'REJECTD'; + const REJECTD = 'REJECTD'; - public const DELETED = 'DELETED'; + const DELETED = 'DELETED'; - public const EXPIRED = 'EXPIRED'; + const EXPIRED = 'EXPIRED'; - public const NACK = 'NACK'; + const NACK = 'NACK'; - public const SEEN = 'SEEN'; + const SEEN = 'SEEN'; /** * Gets allowable values of the enum diff --git a/lib/Model/SyncNumberLookupResult.php b/lib/Model/SyncNumberLookupResult.php index a291c18..15f25c9 100644 --- a/lib/Model/SyncNumberLookupResult.php +++ b/lib/Model/SyncNumberLookupResult.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupResult * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -89,30 +91,6 @@ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerial 'error' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'number' => false, - 'roaming' => true, - 'ported' => true, - 'roamingNetwork' => true, - 'currentNetwork' => true, - 'originalNetwork' => true, - 'portedNetwork' => true, - 'status' => false, - 'error' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -133,58 +111,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -278,10 +204,10 @@ public function getModelName() return self::$openAPIModelName; } - public const STATUS_ON = 'ON'; - public const STATUS_OFF = 'OFF'; - public const STATUS_INVALID = 'INVALID'; - public const STATUS_UNKNOWN = 'UNKNOWN'; + const STATUS_ON = 'ON'; + const STATUS_OFF = 'OFF'; + const STATUS_INVALID = 'INVALID'; + const STATUS_UNKNOWN = 'UNKNOWN'; /** * Gets allowable values of the enum @@ -313,33 +239,15 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('number', $data ?? [], null); - $this->setIfExists('roaming', $data ?? [], null); - $this->setIfExists('ported', $data ?? [], null); - $this->setIfExists('roamingNetwork', $data ?? [], null); - $this->setIfExists('currentNetwork', $data ?? [], null); - $this->setIfExists('originalNetwork', $data ?? [], null); - $this->setIfExists('portedNetwork', $data ?? [], null); - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('error', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['number'] = $data['number'] ?? null; + $this->container['roaming'] = $data['roaming'] ?? null; + $this->container['ported'] = $data['ported'] ?? null; + $this->container['roamingNetwork'] = $data['roamingNetwork'] ?? null; + $this->container['currentNetwork'] = $data['currentNetwork'] ?? null; + $this->container['originalNetwork'] = $data['originalNetwork'] ?? null; + $this->container['portedNetwork'] = $data['portedNetwork'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['error'] = $data['error'] ?? null; } /** @@ -397,9 +305,6 @@ public function getNumber() */ public function setNumber($number) { - if (is_null($number)) { - throw new \InvalidArgumentException('non-nullable number cannot be null'); - } $this->container['number'] = $number; return $this; @@ -424,16 +329,6 @@ public function getRoaming() */ public function setRoaming($roaming) { - if (is_null($roaming)) { - array_push($this->openAPINullablesSetToNull, 'roaming'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('roaming', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['roaming'] = $roaming; return $this; @@ -458,16 +353,6 @@ public function getPorted() */ public function setPorted($ported) { - if (is_null($ported)) { - array_push($this->openAPINullablesSetToNull, 'ported'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('ported', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['ported'] = $ported; return $this; @@ -492,16 +377,6 @@ public function getRoamingNetwork() */ public function setRoamingNetwork($roamingNetwork) { - if (is_null($roamingNetwork)) { - array_push($this->openAPINullablesSetToNull, 'roamingNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('roamingNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['roamingNetwork'] = $roamingNetwork; return $this; @@ -526,16 +401,6 @@ public function getCurrentNetwork() */ public function setCurrentNetwork($currentNetwork) { - if (is_null($currentNetwork)) { - array_push($this->openAPINullablesSetToNull, 'currentNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('currentNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['currentNetwork'] = $currentNetwork; return $this; @@ -560,16 +425,6 @@ public function getOriginalNetwork() */ public function setOriginalNetwork($originalNetwork) { - if (is_null($originalNetwork)) { - array_push($this->openAPINullablesSetToNull, 'originalNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('originalNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['originalNetwork'] = $originalNetwork; return $this; @@ -594,16 +449,6 @@ public function getPortedNetwork() */ public function setPortedNetwork($portedNetwork) { - if (is_null($portedNetwork)) { - array_push($this->openAPINullablesSetToNull, 'portedNetwork'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('portedNetwork', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['portedNetwork'] = $portedNetwork; return $this; @@ -628,11 +473,8 @@ public function getStatus() */ public function setStatus($status) { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } $allowedValues = $this->getStatusAllowableValues(); - if (!in_array($status, $allowedValues, true)) { + if (!is_null($status) && !in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'status', must be one of '%s'", @@ -665,16 +507,6 @@ public function getError() */ public function setError($error) { - if (is_null($error)) { - array_push($this->openAPINullablesSetToNull, 'error'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('error', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } $this->container['error'] = $error; return $this; @@ -686,7 +518,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -698,7 +530,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -712,7 +543,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -728,7 +559,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -740,7 +571,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/SyncNumberLookupSuccess.php b/lib/Model/SyncNumberLookupSuccess.php index 95b8e82..c00b889 100644 --- a/lib/Model/SyncNumberLookupSuccess.php +++ b/lib/Model/SyncNumberLookupSuccess.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupSuccess * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,23 +77,6 @@ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'result' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'requestId' => false, - 'result' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -112,58 +97,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -252,26 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('requestId', $data ?? [], null); - $this->setIfExists('result', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['requestId'] = $data['requestId'] ?? null; + $this->container['result'] = $data['result'] ?? null; } /** @@ -323,9 +238,6 @@ public function getRequestId() */ public function setRequestId($requestId) { - if (is_null($requestId)) { - throw new \InvalidArgumentException('non-nullable requestId cannot be null'); - } $this->container['requestId'] = $requestId; return $this; @@ -350,9 +262,6 @@ public function getResult() */ public function setResult($result) { - if (is_null($result)) { - throw new \InvalidArgumentException('non-nullable result cannot be null'); - } $this->container['result'] = $result; return $this; @@ -364,7 +273,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -376,7 +285,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -390,7 +298,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -406,7 +314,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -418,7 +326,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Telegram.php b/lib/Model/Telegram.php index 438ca6f..f033906 100644 --- a/lib/Model/Telegram.php +++ b/lib/Model/Telegram.php @@ -2,7 +2,7 @@ /** * Telegram * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -85,28 +87,6 @@ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'text' => false, - 'imageUrl' => false, - 'documentUrl' => false, - 'audioUrl' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -127,58 +107,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -266,7 +194,7 @@ public function getModelName() return self::$openAPIModelName; } - public const CHANNEL_TELEGRAM = 'telegram'; + const CHANNEL_TELEGRAM = 'telegram'; /** * Gets allowable values of the enum @@ -295,31 +223,13 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('documentUrl', $data ?? [], null); - $this->setIfExists('audioUrl', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'telegram'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['sender'] = $data['sender'] ?? null; + $this->container['validity'] = $data['validity'] ?? null; + $this->container['text'] = $data['text'] ?? null; + $this->container['imageUrl'] = $data['imageUrl'] ?? null; + $this->container['documentUrl'] = $data['documentUrl'] ?? null; + $this->container['audioUrl'] = $data['audioUrl'] ?? null; + $this->container['channel'] = $data['channel'] ?? 'telegram'; } /** @@ -374,9 +284,6 @@ public function getSender() */ public function setSender($sender) { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } $this->container['sender'] = $sender; return $this; @@ -401,9 +308,6 @@ public function getValidity() */ public function setValidity($validity) { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } $this->container['validity'] = $validity; return $this; @@ -428,9 +332,6 @@ public function getText() */ public function setText($text) { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } $this->container['text'] = $text; return $this; @@ -455,9 +356,6 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } $this->container['imageUrl'] = $imageUrl; return $this; @@ -482,9 +380,6 @@ public function getDocumentUrl() */ public function setDocumentUrl($documentUrl) { - if (is_null($documentUrl)) { - throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); - } $this->container['documentUrl'] = $documentUrl; return $this; @@ -509,9 +404,6 @@ public function getAudioUrl() */ public function setAudioUrl($audioUrl) { - if (is_null($audioUrl)) { - throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); - } $this->container['audioUrl'] = $audioUrl; return $this; @@ -536,11 +428,8 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -560,7 +449,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -572,7 +461,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -586,7 +474,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -602,7 +490,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -614,7 +502,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/TextStore.php b/lib/Model/TextStore.php index ad7e107..e06dd53 100644 --- a/lib/Model/TextStore.php +++ b/lib/Model/TextStore.php @@ -2,7 +2,7 @@ /** * TextStore * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -44,11 +44,11 @@ class TextStore /** * Possible values of this enum */ - public const NOSTORE = 'nostore'; + const NOSTORE = 'nostore'; - public const PLAINTEXT = 'plaintext'; + const PLAINTEXT = 'plaintext'; - public const SHA256 = 'sha256'; + const SHA256 = 'sha256'; /** * Gets allowable values of the enum diff --git a/lib/Model/Viber.php b/lib/Model/Viber.php index af4db61..0447d57 100644 --- a/lib/Model/Viber.php +++ b/lib/Model/Viber.php @@ -2,7 +2,7 @@ /** * Viber * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -87,29 +89,6 @@ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'text' => false, - 'imageUrl' => false, - 'buttonUrl' => false, - 'buttonText' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -130,58 +109,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -272,7 +199,7 @@ public function getModelName() return self::$openAPIModelName; } - public const CHANNEL_VIBER = 'viber'; + const CHANNEL_VIBER = 'viber'; /** * Gets allowable values of the enum @@ -301,32 +228,14 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('imageUrl', $data ?? [], null); - $this->setIfExists('buttonUrl', $data ?? [], null); - $this->setIfExists('buttonText', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'viber'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['sender'] = $data['sender'] ?? null; + $this->container['validity'] = $data['validity'] ?? null; + $this->container['ttl'] = $data['ttl'] ?? null; + $this->container['text'] = $data['text'] ?? null; + $this->container['imageUrl'] = $data['imageUrl'] ?? null; + $this->container['buttonUrl'] = $data['buttonUrl'] ?? null; + $this->container['buttonText'] = $data['buttonText'] ?? null; + $this->container['channel'] = $data['channel'] ?? 'viber'; } /** @@ -381,9 +290,6 @@ public function getSender() */ public function setSender($sender) { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } $this->container['sender'] = $sender; return $this; @@ -408,9 +314,6 @@ public function getValidity() */ public function setValidity($validity) { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } $this->container['validity'] = $validity; return $this; @@ -435,9 +338,6 @@ public function getTtl() */ public function setTtl($ttl) { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } $this->container['ttl'] = $ttl; return $this; @@ -462,9 +362,6 @@ public function getText() */ public function setText($text) { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } $this->container['text'] = $text; return $this; @@ -489,9 +386,6 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { - if (is_null($imageUrl)) { - throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); - } $this->container['imageUrl'] = $imageUrl; return $this; @@ -516,9 +410,6 @@ public function getButtonUrl() */ public function setButtonUrl($buttonUrl) { - if (is_null($buttonUrl)) { - throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); - } $this->container['buttonUrl'] = $buttonUrl; return $this; @@ -543,9 +434,6 @@ public function getButtonText() */ public function setButtonText($buttonText) { - if (is_null($buttonText)) { - throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); - } $this->container['buttonText'] = $buttonText; return $this; @@ -570,11 +458,8 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -594,7 +479,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -606,7 +491,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -620,7 +504,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -636,7 +520,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -648,7 +532,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php index ae2ef73..d55da7a 100644 --- a/lib/Model/WhatsApp.php +++ b/lib/Model/WhatsApp.php @@ -2,7 +2,7 @@ /** * WhatsApp * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -40,7 +40,9 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -62,7 +64,10 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => 'string', 'validity' => 'int', 'ttl' => 'int', - 'template' => '\Messente\Api\Model\WhatsAppTemplate', + 'text' => '\Messente\Api\Model\WhatsAppText', + 'image' => '\Messente\Api\Model\WhatsAppImage', + 'document' => '\Messente\Api\Model\WhatsAppDocument', + 'audio' => '\Messente\Api\Model\WhatsAppAudio', 'channel' => 'string' ]; @@ -77,30 +82,13 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null, 'validity' => null, 'ttl' => null, - 'template' => null, + 'text' => null, + 'image' => null, + 'document' => null, + 'audio' => null, 'channel' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'sender' => false, - 'validity' => false, - 'ttl' => false, - 'template' => false, - 'channel' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -121,58 +109,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -183,7 +119,10 @@ public function isNullableSetToNull(string $property): bool 'sender' => 'sender', 'validity' => 'validity', 'ttl' => 'ttl', - 'template' => 'template', + 'text' => 'text', + 'image' => 'image', + 'document' => 'document', + 'audio' => 'audio', 'channel' => 'channel' ]; @@ -196,7 +135,10 @@ public function isNullableSetToNull(string $property): bool 'sender' => 'setSender', 'validity' => 'setValidity', 'ttl' => 'setTtl', - 'template' => 'setTemplate', + 'text' => 'setText', + 'image' => 'setImage', + 'document' => 'setDocument', + 'audio' => 'setAudio', 'channel' => 'setChannel' ]; @@ -209,7 +151,10 @@ public function isNullableSetToNull(string $property): bool 'sender' => 'getSender', 'validity' => 'getValidity', 'ttl' => 'getTtl', - 'template' => 'getTemplate', + 'text' => 'getText', + 'image' => 'getImage', + 'document' => 'getDocument', + 'audio' => 'getAudio', 'channel' => 'getChannel' ]; @@ -254,7 +199,7 @@ public function getModelName() return self::$openAPIModelName; } - public const CHANNEL_WHATSAPP = 'whatsapp'; + const CHANNEL_WHATSAPP = 'whatsapp'; /** * Gets allowable values of the enum @@ -283,29 +228,14 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('sender', $data ?? [], null); - $this->setIfExists('validity', $data ?? [], null); - $this->setIfExists('ttl', $data ?? [], null); - $this->setIfExists('template', $data ?? [], null); - $this->setIfExists('channel', $data ?? [], 'whatsapp'); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['sender'] = $data['sender'] ?? null; + $this->container['validity'] = $data['validity'] ?? null; + $this->container['ttl'] = $data['ttl'] ?? null; + $this->container['text'] = $data['text'] ?? null; + $this->container['image'] = $data['image'] ?? null; + $this->container['document'] = $data['document'] ?? null; + $this->container['audio'] = $data['audio'] ?? null; + $this->container['channel'] = $data['channel'] ?? 'whatsapp'; } /** @@ -360,9 +290,6 @@ public function getSender() */ public function setSender($sender) { - if (is_null($sender)) { - throw new \InvalidArgumentException('non-nullable sender cannot be null'); - } $this->container['sender'] = $sender; return $this; @@ -387,9 +314,6 @@ public function getValidity() */ public function setValidity($validity) { - if (is_null($validity)) { - throw new \InvalidArgumentException('non-nullable validity cannot be null'); - } $this->container['validity'] = $validity; return $this; @@ -414,37 +338,103 @@ public function getTtl() */ public function setTtl($ttl) { - if (is_null($ttl)) { - throw new \InvalidArgumentException('non-nullable ttl cannot be null'); - } $this->container['ttl'] = $ttl; return $this; } /** - * Gets template + * Gets text * - * @return \Messente\Api\Model\WhatsAppTemplate|null + * @return \Messente\Api\Model\WhatsAppText|null */ - public function getTemplate() + public function getText() { - return $this->container['template']; + return $this->container['text']; } /** - * Sets template + * Sets text * - * @param \Messente\Api\Model\WhatsAppTemplate|null $template template + * @param \Messente\Api\Model\WhatsAppText|null $text text * * @return self */ - public function setTemplate($template) + public function setText($text) { - if (is_null($template)) { - throw new \InvalidArgumentException('non-nullable template cannot be null'); - } - $this->container['template'] = $template; + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets image + * + * @return \Messente\Api\Model\WhatsAppImage|null + */ + public function getImage() + { + return $this->container['image']; + } + + /** + * Sets image + * + * @param \Messente\Api\Model\WhatsAppImage|null $image image + * + * @return self + */ + public function setImage($image) + { + $this->container['image'] = $image; + + return $this; + } + + /** + * Gets document + * + * @return \Messente\Api\Model\WhatsAppDocument|null + */ + public function getDocument() + { + return $this->container['document']; + } + + /** + * Sets document + * + * @param \Messente\Api\Model\WhatsAppDocument|null $document document + * + * @return self + */ + public function setDocument($document) + { + $this->container['document'] = $document; + + return $this; + } + + /** + * Gets audio + * + * @return \Messente\Api\Model\WhatsAppAudio|null + */ + public function getAudio() + { + return $this->container['audio']; + } + + /** + * Sets audio + * + * @param \Messente\Api\Model\WhatsAppAudio|null $audio audio + * + * @return self + */ + public function setAudio($audio) + { + $this->container['audio'] = $audio; return $this; } @@ -468,11 +458,8 @@ public function getChannel() */ public function setChannel($channel) { - if (is_null($channel)) { - throw new \InvalidArgumentException('non-nullable channel cannot be null'); - } $allowedValues = $this->getChannelAllowableValues(); - if (!in_array($channel, $allowedValues, true)) { + if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -492,7 +479,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -504,7 +491,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -518,7 +504,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -534,7 +520,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -546,7 +532,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppCurrency.php b/lib/Model/WhatsAppAudio.php similarity index 52% rename from lib/Model/WhatsAppCurrency.php rename to lib/Model/WhatsAppAudio.php index c44abd7..eb67bc9 100644 --- a/lib/Model/WhatsAppCurrency.php +++ b/lib/Model/WhatsAppAudio.php @@ -1,8 +1,8 @@ + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ -class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -51,7 +53,7 @@ class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppCurrency'; + protected static $openAPIModelName = 'WhatsAppAudio'; /** * Array of property to type mappings. Used for (de)serialization @@ -59,9 +61,7 @@ class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'fallbackValue' => 'string', - 'code' => 'string', - 'amount1000' => 'string' + 'content' => 'string' ]; /** @@ -72,29 +72,9 @@ class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'fallbackValue' => null, - 'code' => null, - 'amount1000' => null + 'content' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'fallbackValue' => false, - 'code' => false, - 'amount1000' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +95,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -174,9 +102,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'fallbackValue' => 'fallback_value', - 'code' => 'code', - 'amount1000' => 'amount_1000' + 'content' => 'content' ]; /** @@ -185,9 +111,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'fallbackValue' => 'setFallbackValue', - 'code' => 'setCode', - 'amount1000' => 'setAmount1000' + 'content' => 'setContent' ]; /** @@ -196,9 +120,7 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'fallbackValue' => 'getFallbackValue', - 'code' => 'getCode', - 'amount1000' => 'getAmount1000' + 'content' => 'getContent' ]; /** @@ -258,27 +180,7 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('fallbackValue', $data ?? [], null); - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('amount1000', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['content'] = $data['content'] ?? null; } /** @@ -290,14 +192,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['fallbackValue'] === null) { - $invalidProperties[] = "'fallbackValue' can't be null"; - } - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; - } - if ($this->container['amount1000'] === null) { - $invalidProperties[] = "'amount1000' can't be null"; + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; } return $invalidProperties; } @@ -315,82 +211,25 @@ public function valid() /** - * Gets fallbackValue - * - * @return string - */ - public function getFallbackValue() - { - return $this->container['fallbackValue']; - } - - /** - * Sets fallbackValue - * - * @param string $fallbackValue Default text if localization fails. - * - * @return self - */ - public function setFallbackValue($fallbackValue) - { - if (is_null($fallbackValue)) { - throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); - } - $this->container['fallbackValue'] = $fallbackValue; - - return $this; - } - - /** - * Gets code - * - * @return string - */ - public function getCode() - { - return $this->container['code']; - } - - /** - * Sets code - * - * @param string $code Currency code as defined in ISO 4217. - * - * @return self - */ - public function setCode($code) - { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; - - return $this; - } - - /** - * Gets amount1000 + * Gets content * * @return string */ - public function getAmount1000() + public function getContent() { - return $this->container['amount1000']; + return $this->container['content']; } /** - * Sets amount1000 + * Sets content * - * @param string $amount1000 Amount multiplied by 1000. + * @param string $content Base64-encoded audio * * @return self */ - public function setAmount1000($amount1000) + public function setContent($content) { - if (is_null($amount1000)) { - throw new \InvalidArgumentException('non-nullable amount1000 cannot be null'); - } - $this->container['amount1000'] = $amount1000; + $this->container['content'] = $content; return $this; } @@ -401,7 +240,7 @@ public function setAmount1000($amount1000) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -413,7 +252,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -427,7 +265,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -443,7 +281,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -455,7 +293,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppComponent.php b/lib/Model/WhatsAppComponent.php deleted file mode 100644 index 630b72b..0000000 --- a/lib/Model/WhatsAppComponent.php +++ /dev/null @@ -1,516 +0,0 @@ - - */ -class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppComponent'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'subType' => 'string', - 'index' => 'int', - 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'subType' => null, - 'index' => null, - 'parameters' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'subType' => false, - 'index' => false, - 'parameters' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'subType' => 'sub_type', - 'index' => 'index', - 'parameters' => 'parameters' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'subType' => 'setSubType', - 'index' => 'setIndex', - 'parameters' => 'setParameters' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'subType' => 'getSubType', - 'index' => 'getIndex', - 'parameters' => 'getParameters' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('subType', $data ?? [], null); - $this->setIfExists('index', $data ?? [], null); - $this->setIfExists('parameters', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of the component - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets subType - * - * @return string|null - */ - public function getSubType() - { - return $this->container['subType']; - } - - /** - * Sets subType - * - * @param string|null $subType Sub-type of the component - * - * @return self - */ - public function setSubType($subType) - { - if (is_null($subType)) { - throw new \InvalidArgumentException('non-nullable subType cannot be null'); - } - $this->container['subType'] = $subType; - - return $this; - } - - /** - * Gets index - * - * @return int|null - */ - public function getIndex() - { - return $this->container['index']; - } - - /** - * Sets index - * - * @param int|null $index index used to position buttons - * - * @return self - */ - public function setIndex($index) - { - if (is_null($index)) { - throw new \InvalidArgumentException('non-nullable index cannot be null'); - } - $this->container['index'] = $index; - - return $this; - } - - /** - * Gets parameters - * - * @return \Messente\Api\Model\WhatsAppParameter[]|null - */ - public function getParameters() - { - return $this->container['parameters']; - } - - /** - * Sets parameters - * - * @param \Messente\Api\Model\WhatsAppParameter[]|null $parameters List of parameters for the component - * - * @return self - */ - public function setParameters($parameters) - { - if (is_null($parameters)) { - throw new \InvalidArgumentException('non-nullable parameters cannot be null'); - } - $this->container['parameters'] = $parameters; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppDatetime.php b/lib/Model/WhatsAppDocument.php similarity index 63% rename from lib/Model/WhatsAppDatetime.php rename to lib/Model/WhatsAppDocument.php index 063cd68..fe15f48 100644 --- a/lib/Model/WhatsAppDatetime.php +++ b/lib/Model/WhatsAppDocument.php @@ -1,8 +1,8 @@ + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ -class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -51,7 +53,7 @@ class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppDatetime'; + protected static $openAPIModelName = 'WhatsAppDocument'; /** * Array of property to type mappings. Used for (de)serialization @@ -59,7 +61,8 @@ class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'fallbackValue' => 'string' + 'caption' => 'string', + 'content' => 'string' ]; /** @@ -70,25 +73,10 @@ class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'fallbackValue' => null + 'caption' => null, + 'content' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'fallbackValue' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -109,58 +97,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -168,7 +104,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'fallbackValue' => 'fallback_value' + 'caption' => 'caption', + 'content' => 'content' ]; /** @@ -177,7 +114,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'fallbackValue' => 'setFallbackValue' + 'caption' => 'setCaption', + 'content' => 'setContent' ]; /** @@ -186,7 +124,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'fallbackValue' => 'getFallbackValue' + 'caption' => 'getCaption', + 'content' => 'getContent' ]; /** @@ -246,25 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('fallbackValue', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['caption'] = $data['caption'] ?? null; + $this->container['content'] = $data['content'] ?? null; } /** @@ -276,8 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['fallbackValue'] === null) { - $invalidProperties[] = "'fallbackValue' can't be null"; + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; } return $invalidProperties; } @@ -295,28 +217,49 @@ public function valid() /** - * Gets fallbackValue + * Gets caption + * + * @return string|null + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string|null $caption Description for the document + * + * @return self + */ + public function setCaption($caption) + { + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets content * * @return string */ - public function getFallbackValue() + public function getContent() { - return $this->container['fallbackValue']; + return $this->container['content']; } /** - * Sets fallbackValue + * Sets content * - * @param string $fallbackValue Default text. + * @param string $content Base64-encoded image * * @return self */ - public function setFallbackValue($fallbackValue) + public function setContent($content) { - if (is_null($fallbackValue)) { - throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); - } - $this->container['fallbackValue'] = $fallbackValue; + $this->container['content'] = $content; return $this; } @@ -327,7 +270,7 @@ public function setFallbackValue($fallbackValue) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -339,7 +282,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -353,7 +295,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -369,7 +311,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -381,7 +323,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppLanguage.php b/lib/Model/WhatsAppImage.php similarity index 60% rename from lib/Model/WhatsAppLanguage.php rename to lib/Model/WhatsAppImage.php index 96e31e8..3e6545b 100644 --- a/lib/Model/WhatsAppLanguage.php +++ b/lib/Model/WhatsAppImage.php @@ -1,8 +1,8 @@ + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ -class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -51,7 +53,7 @@ class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppLanguage'; + protected static $openAPIModelName = 'WhatsAppImage'; /** * Array of property to type mappings. Used for (de)serialization @@ -59,8 +61,8 @@ class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'code' => 'string', - 'policy' => 'string' + 'caption' => 'string', + 'content' => 'string' ]; /** @@ -71,27 +73,10 @@ class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'code' => null, - 'policy' => null + 'caption' => null, + 'content' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'code' => false, - 'policy' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -112,58 +97,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -171,8 +104,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'code' => 'code', - 'policy' => 'policy' + 'caption' => 'caption', + 'content' => 'content' ]; /** @@ -181,8 +114,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'code' => 'setCode', - 'policy' => 'setPolicy' + 'caption' => 'setCaption', + 'content' => 'setContent' ]; /** @@ -191,8 +124,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'code' => 'getCode', - 'policy' => 'getPolicy' + 'caption' => 'getCaption', + 'content' => 'getContent' ]; /** @@ -252,26 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('code', $data ?? [], null); - $this->setIfExists('policy', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['caption'] = $data['caption'] ?? null; + $this->container['content'] = $data['content'] ?? null; } /** @@ -283,8 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['code'] === null) { - $invalidProperties[] = "'code' can't be null"; + if ($this->container['content'] === null) { + $invalidProperties[] = "'content' can't be null"; } return $invalidProperties; } @@ -302,55 +217,49 @@ public function valid() /** - * Gets code + * Gets caption * - * @return string + * @return string|null */ - public function getCode() + public function getCaption() { - return $this->container['code']; + return $this->container['caption']; } /** - * Sets code + * Sets caption * - * @param string $code Language code + * @param string|null $caption Description for the image * * @return self */ - public function setCode($code) + public function setCaption($caption) { - if (is_null($code)) { - throw new \InvalidArgumentException('non-nullable code cannot be null'); - } - $this->container['code'] = $code; + $this->container['caption'] = $caption; return $this; } /** - * Gets policy + * Gets content * - * @return string|null + * @return string */ - public function getPolicy() + public function getContent() { - return $this->container['policy']; + return $this->container['content']; } /** - * Sets policy + * Sets content * - * @param string|null $policy Language policy + * @param string $content Base64-encoded image * * @return self */ - public function setPolicy($policy) + public function setContent($content) { - if (is_null($policy)) { - throw new \InvalidArgumentException('non-nullable policy cannot be null'); - } - $this->container['policy'] = $policy; + $this->container['content'] = $content; return $this; } @@ -361,7 +270,7 @@ public function setPolicy($policy) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -373,7 +282,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -387,7 +295,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -403,7 +311,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -415,7 +323,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppMedia.php b/lib/Model/WhatsAppMedia.php deleted file mode 100644 index fc7208c..0000000 --- a/lib/Model/WhatsAppMedia.php +++ /dev/null @@ -1,513 +0,0 @@ - - */ -class WhatsAppMedia implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppMedia'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'string', - 'link' => 'string', - 'caption' => 'string', - 'filename' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => null, - 'link' => null, - 'caption' => null, - 'filename' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'link' => false, - 'caption' => false, - 'filename' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'id', - 'link' => 'link', - 'caption' => 'caption', - 'filename' => 'filename' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'link' => 'setLink', - 'caption' => 'setCaption', - 'filename' => 'setFilename' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'link' => 'getLink', - 'caption' => 'getCaption', - 'filename' => 'getFilename' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('link', $data ?? [], null); - $this->setIfExists('caption', $data ?? [], null); - $this->setIfExists('filename', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return string|null - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param string|null $id The media object ID. Do not use this field when message type is set to text. - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets link - * - * @return string|null - */ - public function getLink() - { - return $this->container['link']; - } - - /** - * Sets link - * - * @param string|null $link The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. - * - * @return self - */ - public function setLink($link) - { - if (is_null($link)) { - throw new \InvalidArgumentException('non-nullable link cannot be null'); - } - $this->container['link'] = $link; - - return $this; - } - - /** - * Gets caption - * - * @return string|null - */ - public function getCaption() - { - return $this->container['caption']; - } - - /** - * Sets caption - * - * @param string|null $caption Media asset caption. Do not use with audio or sticker media. - * - * @return self - */ - public function setCaption($caption) - { - if (is_null($caption)) { - throw new \InvalidArgumentException('non-nullable caption cannot be null'); - } - $this->container['caption'] = $caption; - - return $this; - } - - /** - * Gets filename - * - * @return string|null - */ - public function getFilename() - { - return $this->container['filename']; - } - - /** - * Sets filename - * - * @param string|null $filename Describes the filename for the specific document. Use only with document media. - * - * @return self - */ - public function setFilename($filename) - { - if (is_null($filename)) { - throw new \InvalidArgumentException('non-nullable filename cannot be null'); - } - $this->container['filename'] = $filename; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppParameter.php b/lib/Model/WhatsAppParameter.php deleted file mode 100644 index 2fb4408..0000000 --- a/lib/Model/WhatsAppParameter.php +++ /dev/null @@ -1,618 +0,0 @@ - - */ -class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'WhatsAppParameter'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'type' => 'string', - 'text' => 'string', - 'currency' => '\Messente\Api\Model\WhatsAppCurrency', - 'dateTime' => '\Messente\Api\Model\WhatsAppDatetime', - 'image' => '\Messente\Api\Model\WhatsAppMedia', - 'document' => '\Messente\Api\Model\WhatsAppMedia', - 'video' => '\Messente\Api\Model\WhatsAppMedia' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'type' => null, - 'text' => null, - 'currency' => null, - 'dateTime' => null, - 'image' => null, - 'document' => null, - 'video' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'type' => false, - 'text' => false, - 'currency' => false, - 'dateTime' => false, - 'image' => false, - 'document' => false, - 'video' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'type' => 'type', - 'text' => 'text', - 'currency' => 'currency', - 'dateTime' => 'date_time', - 'image' => 'image', - 'document' => 'document', - 'video' => 'video' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'type' => 'setType', - 'text' => 'setText', - 'currency' => 'setCurrency', - 'dateTime' => 'setDateTime', - 'image' => 'setImage', - 'document' => 'setDocument', - 'video' => 'setVideo' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'type' => 'getType', - 'text' => 'getText', - 'currency' => 'getCurrency', - 'dateTime' => 'getDateTime', - 'image' => 'getImage', - 'document' => 'getDocument', - 'video' => 'getVideo' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('text', $data ?? [], null); - $this->setIfExists('currency', $data ?? [], null); - $this->setIfExists('dateTime', $data ?? [], null); - $this->setIfExists('image', $data ?? [], null); - $this->setIfExists('document', $data ?? [], null); - $this->setIfExists('video', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['type'] === null) { - $invalidProperties[] = "'type' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets type - * - * @return string - */ - public function getType() - { - return $this->container['type']; - } - - /** - * Sets type - * - * @param string $type Type of the parameter. - * - * @return self - */ - public function setType($type) - { - if (is_null($type)) { - throw new \InvalidArgumentException('non-nullable type cannot be null'); - } - $this->container['type'] = $type; - - return $this; - } - - /** - * Gets text - * - * @return string|null - */ - public function getText() - { - return $this->container['text']; - } - - /** - * Sets text - * - * @param string|null $text A text. - * - * @return self - */ - public function setText($text) - { - if (is_null($text)) { - throw new \InvalidArgumentException('non-nullable text cannot be null'); - } - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets currency - * - * @return \Messente\Api\Model\WhatsAppCurrency|null - */ - public function getCurrency() - { - return $this->container['currency']; - } - - /** - * Sets currency - * - * @param \Messente\Api\Model\WhatsAppCurrency|null $currency currency - * - * @return self - */ - public function setCurrency($currency) - { - if (is_null($currency)) { - throw new \InvalidArgumentException('non-nullable currency cannot be null'); - } - $this->container['currency'] = $currency; - - return $this; - } - - /** - * Gets dateTime - * - * @return \Messente\Api\Model\WhatsAppDatetime|null - */ - public function getDateTime() - { - return $this->container['dateTime']; - } - - /** - * Sets dateTime - * - * @param \Messente\Api\Model\WhatsAppDatetime|null $dateTime dateTime - * - * @return self - */ - public function setDateTime($dateTime) - { - if (is_null($dateTime)) { - throw new \InvalidArgumentException('non-nullable dateTime cannot be null'); - } - $this->container['dateTime'] = $dateTime; - - return $this; - } - - /** - * Gets image - * - * @return \Messente\Api\Model\WhatsAppMedia|null - */ - public function getImage() - { - return $this->container['image']; - } - - /** - * Sets image - * - * @param \Messente\Api\Model\WhatsAppMedia|null $image image - * - * @return self - */ - public function setImage($image) - { - if (is_null($image)) { - throw new \InvalidArgumentException('non-nullable image cannot be null'); - } - $this->container['image'] = $image; - - return $this; - } - - /** - * Gets document - * - * @return \Messente\Api\Model\WhatsAppMedia|null - */ - public function getDocument() - { - return $this->container['document']; - } - - /** - * Sets document - * - * @param \Messente\Api\Model\WhatsAppMedia|null $document document - * - * @return self - */ - public function setDocument($document) - { - if (is_null($document)) { - throw new \InvalidArgumentException('non-nullable document cannot be null'); - } - $this->container['document'] = $document; - - return $this; - } - - /** - * Gets video - * - * @return \Messente\Api\Model\WhatsAppMedia|null - */ - public function getVideo() - { - return $this->container['video']; - } - - /** - * Sets video - * - * @param \Messente\Api\Model\WhatsAppMedia|null $video video - * - * @return self - */ - public function setVideo($video) - { - if (is_null($video)) { - throw new \InvalidArgumentException('non-nullable video cannot be null'); - } - $this->container['video'] = $video; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/lib/Model/WhatsAppTemplate.php b/lib/Model/WhatsAppText.php similarity index 54% rename from lib/Model/WhatsAppTemplate.php rename to lib/Model/WhatsAppText.php index 06d3d7c..c3f257b 100644 --- a/lib/Model/WhatsAppTemplate.php +++ b/lib/Model/WhatsAppText.php @@ -1,8 +1,8 @@ + * @implements \ArrayAccess + * @template TKey int|null + * @template TValue mixed|null */ -class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -51,7 +53,7 @@ class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppTemplate'; + protected static $openAPIModelName = 'WhatsAppText'; /** * Array of property to type mappings. Used for (de)serialization @@ -59,9 +61,8 @@ class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'name' => 'string', - 'language' => '\Messente\Api\Model\WhatsAppLanguage', - 'components' => '\Messente\Api\Model\WhatsAppComponent[]' + 'previewUrl' => 'bool', + 'body' => 'string' ]; /** @@ -72,29 +73,10 @@ class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'name' => null, - 'language' => null, - 'components' => null + 'previewUrl' => null, + 'body' => null ]; - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'name' => false, - 'language' => false, - 'components' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - /** * Array of property to type mappings. Used for (de)serialization * @@ -115,58 +97,6 @@ public static function openAPIFormats() return self::$openAPIFormats; } - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - /** * Array of attributes where the key is the local name, * and the value is the original name @@ -174,9 +104,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $attributeMap = [ - 'name' => 'name', - 'language' => 'language', - 'components' => 'components' + 'previewUrl' => 'preview_url', + 'body' => 'body' ]; /** @@ -185,9 +114,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $setters = [ - 'name' => 'setName', - 'language' => 'setLanguage', - 'components' => 'setComponents' + 'previewUrl' => 'setPreviewUrl', + 'body' => 'setBody' ]; /** @@ -196,9 +124,8 @@ public function isNullableSetToNull(string $property): bool * @var string[] */ protected static $getters = [ - 'name' => 'getName', - 'language' => 'getLanguage', - 'components' => 'getComponents' + 'previewUrl' => 'getPreviewUrl', + 'body' => 'getBody' ]; /** @@ -258,27 +185,8 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('language', $data ?? [], null); - $this->setIfExists('components', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + $this->container['previewUrl'] = $data['previewUrl'] ?? true; + $this->container['body'] = $data['body'] ?? null; } /** @@ -290,11 +198,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['language'] === null) { - $invalidProperties[] = "'language' can't be null"; + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' can't be null"; } return $invalidProperties; } @@ -312,82 +217,49 @@ public function valid() /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name Name of the template - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets language + * Gets previewUrl * - * @return \Messente\Api\Model\WhatsAppLanguage + * @return bool|null */ - public function getLanguage() + public function getPreviewUrl() { - return $this->container['language']; + return $this->container['previewUrl']; } /** - * Sets language + * Sets previewUrl * - * @param \Messente\Api\Model\WhatsAppLanguage $language language + * @param bool|null $previewUrl Whether to display link preview if the message contains a hyperlink * * @return self */ - public function setLanguage($language) + public function setPreviewUrl($previewUrl) { - if (is_null($language)) { - throw new \InvalidArgumentException('non-nullable language cannot be null'); - } - $this->container['language'] = $language; + $this->container['previewUrl'] = $previewUrl; return $this; } /** - * Gets components + * Gets body * - * @return \Messente\Api\Model\WhatsAppComponent[]|null + * @return string */ - public function getComponents() + public function getBody() { - return $this->container['components']; + return $this->container['body']; } /** - * Sets components + * Sets body * - * @param \Messente\Api\Model\WhatsAppComponent[]|null $components List of template components + * @param string $body Plaintext content for WhatsApp, can contain URLs, emojis and formatting * * @return self */ - public function setComponents($components) + public function setBody($body) { - if (is_null($components)) { - throw new \InvalidArgumentException('non-nullable components cannot be null'); - } - $this->container['components'] = $components; + $this->container['body'] = $body; return $this; } @@ -398,7 +270,7 @@ public function setComponents($components) * * @return boolean */ - public function offsetExists($offset): bool + public function offsetExists($offset) { return isset($this->container[$offset]); } @@ -410,7 +282,6 @@ public function offsetExists($offset): bool * * @return mixed|null */ - #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -424,7 +295,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value): void + public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; @@ -440,7 +311,7 @@ public function offsetSet($offset, $value): void * * @return void */ - public function offsetUnset($offset): void + public function offsetUnset($offset) { unset($this->container[$offset]); } @@ -452,7 +323,6 @@ public function offsetUnset($offset): void * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index 6f7fd57..2a1510f 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.4 + * PHP version 7.3 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * Generator version: 7.6.0 + * OpenAPI Generator version: 5.3.0 */ /** @@ -29,7 +29,6 @@ namespace Messente\Api; -use GuzzleHttp\Psr7\Utils; use Messente\Api\Model\ModelInterface; /** @@ -88,7 +87,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -99,7 +98,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + if ($value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -131,20 +130,6 @@ public static function sanitizeFilename($filename) } } - /** - * Shorter timestamp microseconds to 6 digits length. - * - * @param string $timestamp Original timestamp - * - * @return string the shorten timestamp - */ - public static function sanitizeTimestamp($timestamp) - { - if (!is_string($timestamp)) return $timestamp; - - return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); - } - /** * Take value and turn it into a string suitable for inclusion in * the path, by url-encoding. @@ -159,141 +144,22 @@ public static function toPathValue($value) } /** - * Checks if a value is empty, based on its OpenAPI type. - * - * @param mixed $value - * @param string $openApiType - * - * @return bool true if $value is empty - */ - private static function isEmptyValue($value, string $openApiType): bool - { - # If empty() returns false, it is not empty regardless of its type. - if (!empty($value)) { - return false; - } - - # Null is always empty, as we cannot send a real "null" value in a query parameter. - if ($value === null) { - return true; - } - - switch ($openApiType) { - # For numeric values, false and '' are considered empty. - # This comparison is safe for floating point values, since the previous call to empty() will - # filter out values that don't match 0. - case 'int': - case 'integer': - return $value !== 0; - - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; - - # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return !in_array($value, [false, 0], true); - - # For all the other types, any value at this point can be considered empty. - default: - return true; - } - } - - /** - * Take query parameter properties and turn it into an array suitable for - * native http_build_query or GuzzleHttp\Psr7\Query::build. - * - * @param mixed $value Parameter value - * @param string $paramName Parameter name - * @param string $openApiType OpenAPIType eg. array or object - * @param string $style Parameter serialization style - * @param bool $explode Parameter explode option - * @param bool $required Whether query param is required or not - * - * @return array - */ - public static function toQueryValue( - $value, - string $paramName, - string $openApiType = 'string', - string $style = 'form', - bool $explode = true, - bool $required = true - ): array { - - # Check if we should omit this parameter from the query. This should only happen when: - # - Parameter is NOT required; AND - # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For - # example, 0 as "int" or "boolean" is NOT an empty value. - if (self::isEmptyValue($value, $openApiType)) { - if ($required) { - return ["{$paramName}" => '']; - } else { - return []; - } - } - - # Handle DateTime objects in query - if($openApiType === "\\DateTime" && $value instanceof \DateTime) { - return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; - } - - $query = []; - $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; - - // since \GuzzleHttp\Psr7\Query::build fails with nested arrays - // need to flatten array first - $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { - if (!is_array($arr)) return $arr; - - foreach ($arr as $k => $v) { - $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; - - if (is_array($v)) { - $flattenArray($v, $prop, $result); - } else { - if ($style !== 'deepObject' && !$explode) { - // push key itself - $result[] = $prop; - } - $result[$prop] = $v; - } - } - return $result; - }; - - $value = $flattenArray($value, $paramName); - - if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { - return $value; - } - - if ('boolean' === $openApiType && is_bool($value)) { - $value = self::convertBoolToQueryStringFormat($value); - } - - // handle style in serializeCollection - $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); - - return $query; - } - - /** - * Convert boolean value to format for query string. + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. * - * @param bool $value Boolean value + * @param string[]|string|\DateTime $object an object to be serialized to a string * - * @return int|string Boolean value in format + * @return string the serialized object */ - public static function convertBoolToQueryStringFormat(bool $value) + public static function toQueryValue($object) { - if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { - return $value ? 'true' : 'false'; + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); } - - return (int) $value; } /** @@ -339,7 +205,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param float|int|bool|\DateTime $value the value of the parameter + * @param string|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -350,7 +216,7 @@ public static function toString($value) } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { - return (string) $value; + return $value; } } @@ -397,6 +263,7 @@ public static function serializeCollection(array $collection, $style, $allowColl * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used * * @return object|array|null a single or an array of $class instances */ @@ -439,13 +306,13 @@ public static function deserialize($data, $class, $httpHeaders = null) if ($class === 'object') { settype($data, 'array'); return $data; - } elseif ($class === 'mixed') { + } else if ($class === 'mixed') { settype($data, gettype($data)); return $data; } if ($class === '\DateTime') { - // Some APIs return an invalid, empty string as a + // Some API's return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -455,27 +322,29 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some APIs return a date-time with too high nanosecond - // precision for php's DateTime to handle. - // With provided regexp 6 digits of microseconds saved - return new \DateTime(self::sanitizeTimestamp($data)); + // Some API's return a date-time with too high nanosecond + // precision for php's DateTime to handle. This conversion + // (string -> unix timestamp -> DateTime) is a workaround + // for the problem. + return (new \DateTime())->setTimestamp(strtotime($data)); } } else { return null; } } - if ($class === '\SplFileObject') { - $data = Utils::streamFor($data); + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + if ($class === '\SplFileObject') { /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if ( - is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) - && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) - ) { + if (array_key_exists('Content-Disposition', $httpHeaders) && + preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); @@ -488,16 +357,7 @@ public static function deserialize($data, $class, $httpHeaders = null) fclose($file); return new \SplFileObject($filename, 'r'); - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - - - if (method_exists($class, 'getAllowableEnumValues')) { + } elseif (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); @@ -505,11 +365,6 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; - - if (is_array($data)) { - $data = (object)$data; - } - // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -524,15 +379,7 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter)) { - continue; - } - - if (!isset($data->{$instance::attributeMap()[$property]})) { - if ($instance::isNullable($property)) { - $instance->$propertySetter(null); - } - + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { continue; } @@ -544,66 +391,4 @@ public static function deserialize($data, $class, $httpHeaders = null) return $instance; } } - - /** - * Build a query string from an array of key value pairs. - * - * This function can use the return value of `parse()` to build a query - * string. This function does not modify the provided keys when an array is - * encountered (like `http_build_query()` would). - * - * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 - * with a modification which is described in https://github.com/guzzle/psr7/pull/603 - * - * @param array $params Query string parameters. - * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 - * to encode using RFC3986, or PHP_QUERY_RFC1738 - * to encode using RFC1738. - */ - public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function (string $str): string { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() - ? function ($v) { return (int) $v; } - : function ($v) { return $v ? 'true' : 'false'; }; - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? $castBool($v) : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? $castBool($vv) : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } } diff --git a/test/Api/BlacklistApiTest.php b/test/Api/BlacklistApiTest.php new file mode 100644 index 0000000..4a9cd00 --- /dev/null +++ b/test/Api/BlacklistApiTest.php @@ -0,0 +1,122 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteFromBlacklist + * + * Deletes a phone number from the blacklist. + * + */ + public function testDeleteFromBlacklist() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchBlacklist + * + * Returns all blacklisted phone numbers. + * + */ + public function testFetchBlacklist() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for isBlacklisted + * + * Checks if a phone number is blacklisted. + * + */ + public function testIsBlacklisted() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/ContactsApiTest.php b/test/Api/ContactsApiTest.php new file mode 100644 index 0000000..7cbcd7e --- /dev/null +++ b/test/Api/ContactsApiTest.php @@ -0,0 +1,170 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for createContact + * + * Creates a new contact. + * + */ + public function testCreateContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteContact + * + * Deletes a contact. + * + */ + public function testDeleteContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchContact + * + * Lists a contact. + * + */ + public function testFetchContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchContactGroups + * + * Lists groups of a contact. + * + */ + public function testFetchContactGroups() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchContacts + * + * Returns all contacts. + * + */ + public function testFetchContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for removeContactFromGroup + * + * Removes a contact from a group. + * + */ + public function testRemoveContactFromGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateContact + * + * Updates a contact. + * + */ + public function testUpdateContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/DeliveryReportApiTest.php b/test/Api/DeliveryReportApiTest.php new file mode 100644 index 0000000..cce94dd --- /dev/null +++ b/test/Api/DeliveryReportApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/GroupsApiTest.php b/test/Api/GroupsApiTest.php new file mode 100644 index 0000000..3faadc3 --- /dev/null +++ b/test/Api/GroupsApiTest.php @@ -0,0 +1,134 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for deleteGroup + * + * Deletes a group. + * + */ + public function testDeleteGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchGroup + * + * Lists a group. + * + */ + public function testFetchGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for fetchGroups + * + * Returns all groups. + * + */ + public function testFetchGroups() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test case for updateGroup + * + * Updates a group with the provided name. + * + */ + public function testUpdateGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/NumberLookupApiTest.php b/test/Api/NumberLookupApiTest.php new file mode 100644 index 0000000..f64ee88 --- /dev/null +++ b/test/Api/NumberLookupApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/OmnimessageApiTest.php b/test/Api/OmnimessageApiTest.php new file mode 100644 index 0000000..6b61e27 --- /dev/null +++ b/test/Api/OmnimessageApiTest.php @@ -0,0 +1,98 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test case for sendOmnimessage + * + * Sends an Omnimessage. + * + */ + public function testSendOmnimessage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Api/StatisticsApiTest.php b/test/Api/StatisticsApiTest.php new file mode 100644 index 0000000..10f2646 --- /dev/null +++ b/test/Api/StatisticsApiTest.php @@ -0,0 +1,86 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ChannelTest.php b/test/Model/ChannelTest.php new file mode 100644 index 0000000..5d478ad --- /dev/null +++ b/test/Model/ChannelTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactEnvelopeTest.php b/test/Model/ContactEnvelopeTest.php new file mode 100644 index 0000000..ad42b6a --- /dev/null +++ b/test/Model/ContactEnvelopeTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contact" + */ + public function testPropertyContact() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactFieldsTest.php b/test/Model/ContactFieldsTest.php new file mode 100644 index 0000000..7fa774d --- /dev/null +++ b/test/Model/ContactFieldsTest.php @@ -0,0 +1,172 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phoneNumber" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "firstName" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "lastName" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom" + */ + public function testPropertyCustom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom2" + */ + public function testPropertyCustom2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom3" + */ + public function testPropertyCustom3() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom4" + */ + public function testPropertyCustom4() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactListEnvelopeTest.php b/test/Model/ContactListEnvelopeTest.php new file mode 100644 index 0000000..bde0072 --- /dev/null +++ b/test/Model/ContactListEnvelopeTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contacts" + */ + public function testPropertyContacts() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactResponseFieldsTest.php b/test/Model/ContactResponseFieldsTest.php new file mode 100644 index 0000000..0709a33 --- /dev/null +++ b/test/Model/ContactResponseFieldsTest.php @@ -0,0 +1,181 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phoneNumber" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "firstName" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "lastName" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom" + */ + public function testPropertyCustom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom2" + */ + public function testPropertyCustom2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom3" + */ + public function testPropertyCustom3() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom4" + */ + public function testPropertyCustom4() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "scheduledDeletionDate" + */ + public function testPropertyScheduledDeletionDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ContactUpdateFieldsTest.php b/test/Model/ContactUpdateFieldsTest.php new file mode 100644 index 0000000..c179501 --- /dev/null +++ b/test/Model/ContactUpdateFieldsTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "email" + */ + public function testPropertyEmail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "firstName" + */ + public function testPropertyFirstName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "lastName" + */ + public function testPropertyLastName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "company" + */ + public function testPropertyCompany() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom" + */ + public function testPropertyCustom() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom2" + */ + public function testPropertyCustom2() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom3" + */ + public function testPropertyCustom3() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "custom4" + */ + public function testPropertyCustom4() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DeliveryReportResponseTest.php b/test/Model/DeliveryReportResponseTest.php new file mode 100644 index 0000000..8bb70a1 --- /dev/null +++ b/test/Model/DeliveryReportResponseTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "statuses" + */ + public function testPropertyStatuses() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "omnimessageId" + */ + public function testPropertyOmnimessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/DeliveryResultTest.php b/test/Model/DeliveryResultTest.php new file mode 100644 index 0000000..a1e207b --- /dev/null +++ b/test/Model/DeliveryResultTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "messageId" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "err" + */ + public function testPropertyErr() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "timestamp" + */ + public function testPropertyTimestamp() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorCodeOmnichannelMachineTest.php b/test/Model/ErrorCodeOmnichannelMachineTest.php new file mode 100644 index 0000000..1cdf214 --- /dev/null +++ b/test/Model/ErrorCodeOmnichannelMachineTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorCodeOmnichannelTest.php b/test/Model/ErrorCodeOmnichannelTest.php new file mode 100644 index 0000000..78fddb5 --- /dev/null +++ b/test/Model/ErrorCodeOmnichannelTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorCodePhonebookTest.php b/test/Model/ErrorCodePhonebookTest.php new file mode 100644 index 0000000..71bc429 --- /dev/null +++ b/test/Model/ErrorCodePhonebookTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorCodeStatisticsTest.php b/test/Model/ErrorCodeStatisticsTest.php new file mode 100644 index 0000000..f03468e --- /dev/null +++ b/test/Model/ErrorCodeStatisticsTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorItemNumberLookupErrorTest.php b/test/Model/ErrorItemNumberLookupErrorTest.php new file mode 100644 index 0000000..8885f53 --- /dev/null +++ b/test/Model/ErrorItemNumberLookupErrorTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "description" + */ + public function testPropertyDescription() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorItemNumberLookupTest.php b/test/Model/ErrorItemNumberLookupTest.php new file mode 100644 index 0000000..9246aa1 --- /dev/null +++ b/test/Model/ErrorItemNumberLookupTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorItemOmnichannelTest.php b/test/Model/ErrorItemOmnichannelTest.php new file mode 100644 index 0000000..ae5544a --- /dev/null +++ b/test/Model/ErrorItemOmnichannelTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "detail" + */ + public function testPropertyDetail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "source" + */ + public function testPropertySource() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorItemPhonebookTest.php b/test/Model/ErrorItemPhonebookTest.php new file mode 100644 index 0000000..4d28e07 --- /dev/null +++ b/test/Model/ErrorItemPhonebookTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "detail" + */ + public function testPropertyDetail() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorItemStatisticsTest.php b/test/Model/ErrorItemStatisticsTest.php new file mode 100644 index 0000000..24e42b7 --- /dev/null +++ b/test/Model/ErrorItemStatisticsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "title" + */ + public function testPropertyTitle() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "details" + */ + public function testPropertyDetails() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "code" + */ + public function testPropertyCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorNumberLookupTest.php b/test/Model/ErrorNumberLookupTest.php new file mode 100644 index 0000000..27b57c4 --- /dev/null +++ b/test/Model/ErrorNumberLookupTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorOmnichannelTest.php b/test/Model/ErrorOmnichannelTest.php new file mode 100644 index 0000000..5f1e138 --- /dev/null +++ b/test/Model/ErrorOmnichannelTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorPhonebookTest.php b/test/Model/ErrorPhonebookTest.php new file mode 100644 index 0000000..4e836bf --- /dev/null +++ b/test/Model/ErrorPhonebookTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorStatisticsTest.php b/test/Model/ErrorStatisticsTest.php new file mode 100644 index 0000000..4272499 --- /dev/null +++ b/test/Model/ErrorStatisticsTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "errors" + */ + public function testPropertyErrors() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorTitleOmnichannelTest.php b/test/Model/ErrorTitleOmnichannelTest.php new file mode 100644 index 0000000..c29096a --- /dev/null +++ b/test/Model/ErrorTitleOmnichannelTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ErrorTitlePhonebookTest.php b/test/Model/ErrorTitlePhonebookTest.php new file mode 100644 index 0000000..2816116 --- /dev/null +++ b/test/Model/ErrorTitlePhonebookTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/FetchBlacklistSuccessTest.php b/test/Model/FetchBlacklistSuccessTest.php new file mode 100644 index 0000000..a93ea6f --- /dev/null +++ b/test/Model/FetchBlacklistSuccessTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phoneNumbers" + */ + public function testPropertyPhoneNumbers() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupEnvelopeTest.php b/test/Model/GroupEnvelopeTest.php new file mode 100644 index 0000000..ac7b3b1 --- /dev/null +++ b/test/Model/GroupEnvelopeTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "group" + */ + public function testPropertyGroup() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupListEnvelopeTest.php b/test/Model/GroupListEnvelopeTest.php new file mode 100644 index 0000000..47b2f4b --- /dev/null +++ b/test/Model/GroupListEnvelopeTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "groups" + */ + public function testPropertyGroups() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupNameTest.php b/test/Model/GroupNameTest.php new file mode 100644 index 0000000..82a5d94 --- /dev/null +++ b/test/Model/GroupNameTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/GroupResponseFieldsTest.php b/test/Model/GroupResponseFieldsTest.php new file mode 100644 index 0000000..cd5136a --- /dev/null +++ b/test/Model/GroupResponseFieldsTest.php @@ -0,0 +1,118 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "id" + */ + public function testPropertyId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "name" + */ + public function testPropertyName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "createdOn" + */ + public function testPropertyCreatedOn() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "contactsCount" + */ + public function testPropertyContactsCount() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MessageResultTest.php b/test/Model/MessageResultTest.php new file mode 100644 index 0000000..778d4dc --- /dev/null +++ b/test/Model/MessageResultTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "messageId" + */ + public function testPropertyMessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/MobileNetworkTest.php b/test/Model/MobileNetworkTest.php new file mode 100644 index 0000000..6b19db3 --- /dev/null +++ b/test/Model/MobileNetworkTest.php @@ -0,0 +1,127 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "mccmnc" + */ + public function testPropertyMccmnc() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "networkName" + */ + public function testPropertyNetworkName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "countryName" + */ + public function testPropertyCountryName() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "countryPrefix" + */ + public function testPropertyCountryPrefix() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "countryCode" + */ + public function testPropertyCountryCode() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/NumberToBlacklistTest.php b/test/Model/NumberToBlacklistTest.php new file mode 100644 index 0000000..2b005cd --- /dev/null +++ b/test/Model/NumberToBlacklistTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "phoneNumber" + */ + public function testPropertyPhoneNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/NumbersToInvestigateTest.php b/test/Model/NumbersToInvestigateTest.php new file mode 100644 index 0000000..54c17fb --- /dev/null +++ b/test/Model/NumbersToInvestigateTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "numbers" + */ + public function testPropertyNumbers() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OmniMessageCreateSuccessResponseTest.php b/test/Model/OmniMessageCreateSuccessResponseTest.php new file mode 100644 index 0000000..1544f73 --- /dev/null +++ b/test/Model/OmniMessageCreateSuccessResponseTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "messages" + */ + public function testPropertyMessages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "omnimessageId" + */ + public function testPropertyOmnimessageId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/OmnimessageTest.php b/test/Model/OmnimessageTest.php new file mode 100644 index 0000000..c498a37 --- /dev/null +++ b/test/Model/OmnimessageTest.php @@ -0,0 +1,136 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "to" + */ + public function testPropertyTo() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "messages" + */ + public function testPropertyMessages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "dlrUrl" + */ + public function testPropertyDlrUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "textStore" + */ + public function testPropertyTextStore() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "timeToSend" + */ + public function testPropertyTimeToSend() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "priority" + */ + public function testPropertyPriority() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/PriorityTest.php b/test/Model/PriorityTest.php new file mode 100644 index 0000000..124fe12 --- /dev/null +++ b/test/Model/PriorityTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SMSTest.php b/test/Model/SMSTest.php new file mode 100644 index 0000000..3ab9316 --- /dev/null +++ b/test/Model/SMSTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validity" + */ + public function testPropertyValidity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ttl" + */ + public function testPropertyTtl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "autoconvert" + */ + public function testPropertyAutoconvert() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "udh" + */ + public function testPropertyUdh() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/StatisticsReportSettingsTest.php b/test/Model/StatisticsReportSettingsTest.php new file mode 100644 index 0000000..d73d235 --- /dev/null +++ b/test/Model/StatisticsReportSettingsTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "startDate" + */ + public function testPropertyStartDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "endDate" + */ + public function testPropertyEndDate() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "messageTypes" + */ + public function testPropertyMessageTypes() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/StatisticsReportSuccessTest.php b/test/Model/StatisticsReportSuccessTest.php new file mode 100644 index 0000000..f200c05 --- /dev/null +++ b/test/Model/StatisticsReportSuccessTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "reports" + */ + public function testPropertyReports() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/StatisticsReportTest.php b/test/Model/StatisticsReportTest.php new file mode 100644 index 0000000..8a4021a --- /dev/null +++ b/test/Model/StatisticsReportTest.php @@ -0,0 +1,109 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "totalMessages" + */ + public function testPropertyTotalMessages() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "totalPrice" + */ + public function testPropertyTotalPrice() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "country" + */ + public function testPropertyCountry() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/StatusTest.php b/test/Model/StatusTest.php new file mode 100644 index 0000000..10530f9 --- /dev/null +++ b/test/Model/StatusTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SyncNumberLookupResultTest.php b/test/Model/SyncNumberLookupResultTest.php new file mode 100644 index 0000000..8eb6dae --- /dev/null +++ b/test/Model/SyncNumberLookupResultTest.php @@ -0,0 +1,163 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "number" + */ + public function testPropertyNumber() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "roaming" + */ + public function testPropertyRoaming() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ported" + */ + public function testPropertyPorted() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "roamingNetwork" + */ + public function testPropertyRoamingNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "currentNetwork" + */ + public function testPropertyCurrentNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "originalNetwork" + */ + public function testPropertyOriginalNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "portedNetwork" + */ + public function testPropertyPortedNetwork() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "status" + */ + public function testPropertyStatus() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "error" + */ + public function testPropertyError() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/SyncNumberLookupSuccessTest.php b/test/Model/SyncNumberLookupSuccessTest.php new file mode 100644 index 0000000..1274234 --- /dev/null +++ b/test/Model/SyncNumberLookupSuccessTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "requestId" + */ + public function testPropertyRequestId() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "result" + */ + public function testPropertyResult() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TelegramTest.php b/test/Model/TelegramTest.php new file mode 100644 index 0000000..6a88027 --- /dev/null +++ b/test/Model/TelegramTest.php @@ -0,0 +1,145 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validity" + */ + public function testPropertyValidity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imageUrl" + */ + public function testPropertyImageUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "documentUrl" + */ + public function testPropertyDocumentUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "audioUrl" + */ + public function testPropertyAudioUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/TextStoreTest.php b/test/Model/TextStoreTest.php new file mode 100644 index 0000000..70ff6ca --- /dev/null +++ b/test/Model/TextStoreTest.php @@ -0,0 +1,82 @@ +markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/ViberTest.php b/test/Model/ViberTest.php new file mode 100644 index 0000000..f15e95e --- /dev/null +++ b/test/Model/ViberTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validity" + */ + public function testPropertyValidity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ttl" + */ + public function testPropertyTtl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "imageUrl" + */ + public function testPropertyImageUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "buttonUrl" + */ + public function testPropertyButtonUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "buttonText" + */ + public function testPropertyButtonText() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WhatsAppAudioTest.php b/test/Model/WhatsAppAudioTest.php new file mode 100644 index 0000000..9d4fec7 --- /dev/null +++ b/test/Model/WhatsAppAudioTest.php @@ -0,0 +1,91 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WhatsAppDocumentTest.php b/test/Model/WhatsAppDocumentTest.php new file mode 100644 index 0000000..022c0fa --- /dev/null +++ b/test/Model/WhatsAppDocumentTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "caption" + */ + public function testPropertyCaption() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WhatsAppImageTest.php b/test/Model/WhatsAppImageTest.php new file mode 100644 index 0000000..e9d384f --- /dev/null +++ b/test/Model/WhatsAppImageTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "caption" + */ + public function testPropertyCaption() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "content" + */ + public function testPropertyContent() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WhatsAppTest.php b/test/Model/WhatsAppTest.php new file mode 100644 index 0000000..115ec5c --- /dev/null +++ b/test/Model/WhatsAppTest.php @@ -0,0 +1,154 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "sender" + */ + public function testPropertySender() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "validity" + */ + public function testPropertyValidity() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "ttl" + */ + public function testPropertyTtl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "text" + */ + public function testPropertyText() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "image" + */ + public function testPropertyImage() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "document" + */ + public function testPropertyDocument() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "audio" + */ + public function testPropertyAudio() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "channel" + */ + public function testPropertyChannel() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} diff --git a/test/Model/WhatsAppTextTest.php b/test/Model/WhatsAppTextTest.php new file mode 100644 index 0000000..a3b7035 --- /dev/null +++ b/test/Model/WhatsAppTextTest.php @@ -0,0 +1,100 @@ +markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "previewUrl" + */ + public function testPropertyPreviewUrl() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } + + /** + * Test attribute "body" + */ + public function testPropertyBody() + { + // TODO: implement + $this->markTestIncomplete('Not implemented'); + } +} From 5b6d3fcb773f3c39f570bd3831b7b2ef522e8781 Mon Sep 17 00:00:00 2001 From: api-librarian Date: Tue, 2 Jul 2024 16:58:55 +0000 Subject: [PATCH 6/9] Travis update: Jul 2024 (Build 750) [skip ci] --- .gitignore | 1 + .openapi-generator/FILES | 83 +- .openapi-generator/VERSION | 2 +- .php-cs-fixer.dist.php | 29 + .php_cs | 23 - .travis.yml | 1 - README.md | 34 +- composer.json | 6 +- docs/Api/BlacklistApi.md | 32 +- docs/Api/ContactsApi.md | 76 +- docs/Api/DeliveryReportApi.md | 14 +- docs/Api/GroupsApi.md | 42 +- docs/Api/NumberLookupApi.md | 14 +- docs/Api/OmnimessageApi.md | 22 +- docs/Api/StatisticsApi.md | 14 +- docs/Model/Omnimessage.md | 2 +- docs/Model/OmnimessageMessagesInner.md | 21 + docs/Model/WhatsApp.md | 5 +- docs/Model/WhatsAppComponent.md | 12 + ...hatsAppDocument.md => WhatsAppCurrency.md} | 7 +- .../{WhatsAppAudio.md => WhatsAppDatetime.md} | 4 +- .../{WhatsAppImage.md => WhatsAppLanguage.md} | 6 +- docs/Model/WhatsAppMedia.md | 12 + docs/Model/WhatsAppParameter.md | 15 + docs/Model/WhatsAppTemplate.md | 11 + docs/Model/WhatsAppText.md | 10 - lib/Api/BlacklistApi.php | 317 +++-- lib/Api/ContactsApi.php | 1049 +++++++++++++---- lib/Api/DeliveryReportApi.php | 133 ++- lib/Api/GroupsApi.php | 617 +++++++--- lib/Api/NumberLookupApi.php | 153 ++- lib/Api/OmnimessageApi.php | 261 +++- lib/Api/StatisticsApi.php | 168 ++- lib/ApiException.php | 5 +- lib/Configuration.php | 81 +- lib/HeaderSelector.php | 209 +++- lib/Model/Channel.php | 12 +- lib/Model/ContactEnvelope.php | 107 +- lib/Model/ContactFields.php | 224 +++- lib/Model/ContactListEnvelope.php | 107 +- lib/Model/ContactResponseFields.php | 237 +++- lib/Model/ContactUpdateFields.php | 218 +++- lib/Model/DeliveryReportResponse.php | 119 +- lib/Model/DeliveryResult.php | 144 ++- lib/Model/ErrorCodeOmnichannel.php | 18 +- lib/Model/ErrorCodeOmnichannelMachine.php | 28 +- lib/Model/ErrorCodePhonebook.php | 16 +- lib/Model/ErrorCodeStatistics.php | 12 +- lib/Model/ErrorItemNumberLookup.php | 107 +- lib/Model/ErrorItemNumberLookupError.php | 113 +- lib/Model/ErrorItemOmnichannel.php | 132 ++- lib/Model/ErrorItemPhonebook.php | 119 +- lib/Model/ErrorItemStatistics.php | 119 +- lib/Model/ErrorNumberLookup.php | 107 +- lib/Model/ErrorOmnichannel.php | 107 +- lib/Model/ErrorPhonebook.php | 107 +- lib/Model/ErrorStatistics.php | 107 +- lib/Model/ErrorTitleOmnichannel.php | 18 +- lib/Model/ErrorTitlePhonebook.php | 16 +- lib/Model/FetchBlacklistSuccess.php | 107 +- lib/Model/GroupEnvelope.php | 107 +- lib/Model/GroupListEnvelope.php | 107 +- lib/Model/GroupName.php | 107 +- lib/Model/GroupResponseFields.php | 132 ++- lib/Model/MessageResult.php | 119 +- lib/Model/MobileNetwork.php | 131 +- lib/Model/ModelInterface.php | 20 +- lib/Model/NumberToBlacklist.php | 107 +- lib/Model/NumbersToInvestigate.php | 107 +- .../OmniMessageCreateSuccessResponse.php | 119 +- lib/Model/Omnimessage.php | 143 ++- lib/Model/OmnimessageMessagesInner.php | 889 ++++++++++++++ lib/Model/Priority.php | 10 +- lib/Model/SMS.php | 155 ++- lib/Model/StatisticsReport.php | 119 +- lib/Model/StatisticsReportSettings.php | 119 +- lib/Model/StatisticsReportSuccess.php | 107 +- lib/Model/Status.php | 26 +- lib/Model/SyncNumberLookupResult.php | 214 +++- lib/Model/SyncNumberLookupSuccess.php | 113 +- lib/Model/Telegram.php | 147 ++- lib/Model/TextStore.php | 10 +- lib/Model/Viber.php | 153 ++- lib/Model/WhatsApp.php | 251 ++-- lib/Model/WhatsAppComponent.php | 516 ++++++++ ...WhatsAppAudio.php => WhatsAppCurrency.php} | 219 +++- ...tsAppDocument.php => WhatsAppDatetime.php} | 175 ++- ...WhatsAppImage.php => WhatsAppLanguage.php} | 179 ++- lib/Model/WhatsAppMedia.php | 513 ++++++++ lib/Model/WhatsAppParameter.php | 618 ++++++++++ ...{WhatsAppText.php => WhatsAppTemplate.php} | 216 +++- lib/ObjectSerializer.php | 285 ++++- test/Api/BlacklistApiTest.php | 122 -- test/Api/ContactsApiTest.php | 170 --- test/Api/DeliveryReportApiTest.php | 86 -- test/Api/GroupsApiTest.php | 134 --- test/Api/NumberLookupApiTest.php | 86 -- test/Api/OmnimessageApiTest.php | 98 -- test/Api/StatisticsApiTest.php | 86 -- test/Model/ChannelTest.php | 82 -- test/Model/ContactEnvelopeTest.php | 91 -- test/Model/ContactFieldsTest.php | 172 --- test/Model/ContactListEnvelopeTest.php | 91 -- test/Model/ContactResponseFieldsTest.php | 181 --- test/Model/ContactUpdateFieldsTest.php | 163 --- test/Model/DeliveryReportResponseTest.php | 109 -- test/Model/DeliveryResultTest.php | 136 --- .../Model/ErrorCodeOmnichannelMachineTest.php | 82 -- test/Model/ErrorCodeOmnichannelTest.php | 82 -- test/Model/ErrorCodePhonebookTest.php | 82 -- test/Model/ErrorCodeStatisticsTest.php | 82 -- test/Model/ErrorItemNumberLookupErrorTest.php | 100 -- test/Model/ErrorItemNumberLookupTest.php | 91 -- test/Model/ErrorItemOmnichannelTest.php | 118 -- test/Model/ErrorItemPhonebookTest.php | 109 -- test/Model/ErrorItemStatisticsTest.php | 109 -- test/Model/ErrorNumberLookupTest.php | 91 -- test/Model/ErrorOmnichannelTest.php | 91 -- test/Model/ErrorPhonebookTest.php | 91 -- test/Model/ErrorStatisticsTest.php | 91 -- test/Model/ErrorTitleOmnichannelTest.php | 82 -- test/Model/ErrorTitlePhonebookTest.php | 82 -- test/Model/FetchBlacklistSuccessTest.php | 91 -- test/Model/GroupEnvelopeTest.php | 91 -- test/Model/GroupListEnvelopeTest.php | 91 -- test/Model/GroupNameTest.php | 91 -- test/Model/GroupResponseFieldsTest.php | 118 -- test/Model/MessageResultTest.php | 109 -- test/Model/MobileNetworkTest.php | 127 -- test/Model/NumberToBlacklistTest.php | 91 -- test/Model/NumbersToInvestigateTest.php | 91 -- .../OmniMessageCreateSuccessResponseTest.php | 109 -- test/Model/OmnimessageTest.php | 136 --- test/Model/PriorityTest.php | 82 -- test/Model/SMSTest.php | 145 --- test/Model/StatisticsReportSettingsTest.php | 109 -- test/Model/StatisticsReportSuccessTest.php | 91 -- test/Model/StatisticsReportTest.php | 109 -- test/Model/StatusTest.php | 82 -- test/Model/SyncNumberLookupResultTest.php | 163 --- test/Model/SyncNumberLookupSuccessTest.php | 100 -- test/Model/TelegramTest.php | 145 --- test/Model/TextStoreTest.php | 82 -- test/Model/ViberTest.php | 154 --- test/Model/WhatsAppAudioTest.php | 91 -- test/Model/WhatsAppDocumentTest.php | 100 -- test/Model/WhatsAppImageTest.php | 100 -- test/Model/WhatsAppTest.php | 154 --- test/Model/WhatsAppTextTest.php | 100 -- 149 files changed, 10357 insertions(+), 7910 deletions(-) create mode 100644 .php-cs-fixer.dist.php delete mode 100644 .php_cs create mode 100644 docs/Model/OmnimessageMessagesInner.md create mode 100644 docs/Model/WhatsAppComponent.md rename docs/Model/{WhatsAppDocument.md => WhatsAppCurrency.md} (53%) rename docs/Model/{WhatsAppAudio.md => WhatsAppDatetime.md} (77%) rename docs/Model/{WhatsAppImage.md => WhatsAppLanguage.md} (64%) create mode 100644 docs/Model/WhatsAppMedia.md create mode 100644 docs/Model/WhatsAppParameter.md create mode 100644 docs/Model/WhatsAppTemplate.md delete mode 100644 docs/Model/WhatsAppText.md create mode 100644 lib/Model/OmnimessageMessagesInner.php create mode 100644 lib/Model/WhatsAppComponent.php rename lib/Model/{WhatsAppAudio.php => WhatsAppCurrency.php} (52%) rename lib/Model/{WhatsAppDocument.php => WhatsAppDatetime.php} (63%) rename lib/Model/{WhatsAppImage.php => WhatsAppLanguage.php} (60%) create mode 100644 lib/Model/WhatsAppMedia.php create mode 100644 lib/Model/WhatsAppParameter.php rename lib/Model/{WhatsAppText.php => WhatsAppTemplate.php} (54%) delete mode 100644 test/Api/BlacklistApiTest.php delete mode 100644 test/Api/ContactsApiTest.php delete mode 100644 test/Api/DeliveryReportApiTest.php delete mode 100644 test/Api/GroupsApiTest.php delete mode 100644 test/Api/NumberLookupApiTest.php delete mode 100644 test/Api/OmnimessageApiTest.php delete mode 100644 test/Api/StatisticsApiTest.php delete mode 100644 test/Model/ChannelTest.php delete mode 100644 test/Model/ContactEnvelopeTest.php delete mode 100644 test/Model/ContactFieldsTest.php delete mode 100644 test/Model/ContactListEnvelopeTest.php delete mode 100644 test/Model/ContactResponseFieldsTest.php delete mode 100644 test/Model/ContactUpdateFieldsTest.php delete mode 100644 test/Model/DeliveryReportResponseTest.php delete mode 100644 test/Model/DeliveryResultTest.php delete mode 100644 test/Model/ErrorCodeOmnichannelMachineTest.php delete mode 100644 test/Model/ErrorCodeOmnichannelTest.php delete mode 100644 test/Model/ErrorCodePhonebookTest.php delete mode 100644 test/Model/ErrorCodeStatisticsTest.php delete mode 100644 test/Model/ErrorItemNumberLookupErrorTest.php delete mode 100644 test/Model/ErrorItemNumberLookupTest.php delete mode 100644 test/Model/ErrorItemOmnichannelTest.php delete mode 100644 test/Model/ErrorItemPhonebookTest.php delete mode 100644 test/Model/ErrorItemStatisticsTest.php delete mode 100644 test/Model/ErrorNumberLookupTest.php delete mode 100644 test/Model/ErrorOmnichannelTest.php delete mode 100644 test/Model/ErrorPhonebookTest.php delete mode 100644 test/Model/ErrorStatisticsTest.php delete mode 100644 test/Model/ErrorTitleOmnichannelTest.php delete mode 100644 test/Model/ErrorTitlePhonebookTest.php delete mode 100644 test/Model/FetchBlacklistSuccessTest.php delete mode 100644 test/Model/GroupEnvelopeTest.php delete mode 100644 test/Model/GroupListEnvelopeTest.php delete mode 100644 test/Model/GroupNameTest.php delete mode 100644 test/Model/GroupResponseFieldsTest.php delete mode 100644 test/Model/MessageResultTest.php delete mode 100644 test/Model/MobileNetworkTest.php delete mode 100644 test/Model/NumberToBlacklistTest.php delete mode 100644 test/Model/NumbersToInvestigateTest.php delete mode 100644 test/Model/OmniMessageCreateSuccessResponseTest.php delete mode 100644 test/Model/OmnimessageTest.php delete mode 100644 test/Model/PriorityTest.php delete mode 100644 test/Model/SMSTest.php delete mode 100644 test/Model/StatisticsReportSettingsTest.php delete mode 100644 test/Model/StatisticsReportSuccessTest.php delete mode 100644 test/Model/StatisticsReportTest.php delete mode 100644 test/Model/StatusTest.php delete mode 100644 test/Model/SyncNumberLookupResultTest.php delete mode 100644 test/Model/SyncNumberLookupSuccessTest.php delete mode 100644 test/Model/TelegramTest.php delete mode 100644 test/Model/TextStoreTest.php delete mode 100644 test/Model/ViberTest.php delete mode 100644 test/Model/WhatsAppAudioTest.php delete mode 100644 test/Model/WhatsAppDocumentTest.php delete mode 100644 test/Model/WhatsAppImageTest.php delete mode 100644 test/Model/WhatsAppTest.php delete mode 100644 test/Model/WhatsAppTextTest.php diff --git a/.gitignore b/.gitignore index 92f7fde..9f1681c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ composer.phar # php-cs-fixer cache .php_cs.cache +.php-cs-fixer.cache # PHPUnit cache .phpunit.result.cache diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 274bcd7..0f2a994 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,6 @@ .gitignore .openapi-generator-ignore -.php_cs +.php-cs-fixer.dist.php .travis.yml README.md composer.json @@ -45,6 +45,7 @@ docs/Model/NumberToBlacklist.md docs/Model/NumbersToInvestigate.md docs/Model/OmniMessageCreateSuccessResponse.md docs/Model/Omnimessage.md +docs/Model/OmnimessageMessagesInner.md docs/Model/Priority.md docs/Model/SMS.md docs/Model/StatisticsReport.md @@ -57,10 +58,13 @@ docs/Model/Telegram.md docs/Model/TextStore.md docs/Model/Viber.md docs/Model/WhatsApp.md -docs/Model/WhatsAppAudio.md -docs/Model/WhatsAppDocument.md -docs/Model/WhatsAppImage.md -docs/Model/WhatsAppText.md +docs/Model/WhatsAppComponent.md +docs/Model/WhatsAppCurrency.md +docs/Model/WhatsAppDatetime.md +docs/Model/WhatsAppLanguage.md +docs/Model/WhatsAppMedia.md +docs/Model/WhatsAppParameter.md +docs/Model/WhatsAppTemplate.md git_push.sh lib/Api/BlacklistApi.php lib/Api/ContactsApi.php @@ -107,6 +111,7 @@ lib/Model/NumberToBlacklist.php lib/Model/NumbersToInvestigate.php lib/Model/OmniMessageCreateSuccessResponse.php lib/Model/Omnimessage.php +lib/Model/OmnimessageMessagesInner.php lib/Model/Priority.php lib/Model/SMS.php lib/Model/StatisticsReport.php @@ -119,66 +124,12 @@ lib/Model/Telegram.php lib/Model/TextStore.php lib/Model/Viber.php lib/Model/WhatsApp.php -lib/Model/WhatsAppAudio.php -lib/Model/WhatsAppDocument.php -lib/Model/WhatsAppImage.php -lib/Model/WhatsAppText.php +lib/Model/WhatsAppComponent.php +lib/Model/WhatsAppCurrency.php +lib/Model/WhatsAppDatetime.php +lib/Model/WhatsAppLanguage.php +lib/Model/WhatsAppMedia.php +lib/Model/WhatsAppParameter.php +lib/Model/WhatsAppTemplate.php lib/ObjectSerializer.php phpunit.xml.dist -test/Api/BlacklistApiTest.php -test/Api/ContactsApiTest.php -test/Api/DeliveryReportApiTest.php -test/Api/GroupsApiTest.php -test/Api/NumberLookupApiTest.php -test/Api/OmnimessageApiTest.php -test/Api/StatisticsApiTest.php -test/Model/ChannelTest.php -test/Model/ContactEnvelopeTest.php -test/Model/ContactFieldsTest.php -test/Model/ContactListEnvelopeTest.php -test/Model/ContactResponseFieldsTest.php -test/Model/ContactUpdateFieldsTest.php -test/Model/DeliveryReportResponseTest.php -test/Model/DeliveryResultTest.php -test/Model/ErrorCodeOmnichannelMachineTest.php -test/Model/ErrorCodeOmnichannelTest.php -test/Model/ErrorCodePhonebookTest.php -test/Model/ErrorCodeStatisticsTest.php -test/Model/ErrorItemNumberLookupErrorTest.php -test/Model/ErrorItemNumberLookupTest.php -test/Model/ErrorItemOmnichannelTest.php -test/Model/ErrorItemPhonebookTest.php -test/Model/ErrorItemStatisticsTest.php -test/Model/ErrorNumberLookupTest.php -test/Model/ErrorOmnichannelTest.php -test/Model/ErrorPhonebookTest.php -test/Model/ErrorStatisticsTest.php -test/Model/ErrorTitleOmnichannelTest.php -test/Model/ErrorTitlePhonebookTest.php -test/Model/FetchBlacklistSuccessTest.php -test/Model/GroupEnvelopeTest.php -test/Model/GroupListEnvelopeTest.php -test/Model/GroupNameTest.php -test/Model/GroupResponseFieldsTest.php -test/Model/MessageResultTest.php -test/Model/MobileNetworkTest.php -test/Model/NumberToBlacklistTest.php -test/Model/NumbersToInvestigateTest.php -test/Model/OmniMessageCreateSuccessResponseTest.php -test/Model/OmnimessageTest.php -test/Model/PriorityTest.php -test/Model/SMSTest.php -test/Model/StatisticsReportSettingsTest.php -test/Model/StatisticsReportSuccessTest.php -test/Model/StatisticsReportTest.php -test/Model/StatusTest.php -test/Model/SyncNumberLookupResultTest.php -test/Model/SyncNumberLookupSuccessTest.php -test/Model/TelegramTest.php -test/Model/TextStoreTest.php -test/Model/ViberTest.php -test/Model/WhatsAppAudioTest.php -test/Model/WhatsAppDocumentTest.php -test/Model/WhatsAppImageTest.php -test/Model/WhatsAppTest.php -test/Model/WhatsAppTextTest.php diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index e230c83..93c8dda 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -5.3.0 \ No newline at end of file +7.6.0 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..af9cf39 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,29 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') +; + +$config = new PhpCsFixer\Config(); +return $config->setRules([ + '@PSR12' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + 'no_leading_import_slash' => false, + ]) + ->setFinder($finder) +; diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 4fbe53e..0000000 --- a/.php_cs +++ /dev/null @@ -1,23 +0,0 @@ -setUsingCache(true) - ->setRules([ - '@PSR2' => true, - 'ordered_imports' => true, - 'phpdoc_order' => true, - 'array_syntax' => [ 'syntax' => 'short' ], - 'strict_comparison' => true, - 'strict_param' => true, - 'no_trailing_whitespace' => false, - 'no_trailing_whitespace_in_comment' => false, - 'braces' => false, - 'single_blank_line_at_eof' => false, - 'blank_line_after_namespace' => false, - ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude('test') - ->exclude('tests') - ->in(__DIR__) - ); diff --git a/.travis.yml b/.travis.yml index 714772e..667b815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ language: php # https://docs.travis-ci.com/user/reference/bionic/#php-support dist: bionic php: - - 7.3 - 7.4 before_install: "composer install" script: "vendor/bin/phpunit" diff --git a/README.md b/README.md index 9611f74..3ad019b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Messente API Library - Messente API version: 2.0.0 -- PHP artifact version: 2.1.0 +- PHP artifact version: 3.0.0 [Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world. @@ -73,13 +73,14 @@ Read the [external getting-started article](https://messente.com/documentation/g "Hello SMS!", "sender" => "MySmsSender"] ); - -$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]); +$whatsAppParameters = [new WhatsAppParameter(['type' => 'text', 'text' => 'hello whatsapp'])]; +$whatsAppComponent = new WhatsAppComponent(['type' => 'body', 'parameters' => $whatsAppParameters]); +$whatsAppLanguage = new WhatsAppLanguage(['code' => '']); +$whatsAppTemplate = new WhatsAppTemplate( + [ + 'name'=> '', + 'language'=> $whatsAppLanguage, + 'components' => [$whatsAppComponent] + ] +); $whatsapp = new WhatsApp( - ['text' => $whatsAppText, "sender" => "MyWhatsAppSender"] + [ + 'sender' => '', + 'template' => $whatsAppTemplate, + ] ); $omnimessage->setMessages([$whatsapp, $viber, $sms]); diff --git a/composer.json b/composer.json index 5c1fe20..9985e13 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "messente/messente-api-php", - "version": "2.1.0", + "version": "3.0.0", "description": "[Messente](https://messente.com) is a global provider of messaging and user verification services. * Send and receive SMS, Viber, WhatsApp and Telegram messages. * Manage contacts and groups. * Fetch detailed info about phone numbers. * Blacklist phone numbers to make sure you're not sending any unwanted messages. Messente builds [tools](https://messente.com/documentation) to help organizations connect their services to people anywhere in the world.", "keywords": ["viber", "telegram", "sms", "whatsapp", "phonebook", "openapitools", "openapi-generator", @@ -26,10 +26,6 @@ "guzzlehttp/guzzle": "^6.2 || ^7.0", "guzzlehttp/psr7": "^1.8" }, - "require-dev": { - "phpunit/phpunit": "^7.4", - "friendsofphp/php-cs-fixer": "^2.12" - }, "autoload": { "psr-4": { "Messente\\Api\\" : "lib/" } }, diff --git a/docs/Api/BlacklistApi.md b/docs/Api/BlacklistApi.md index 7bd8656..26c6414 100644 --- a/docs/Api/BlacklistApi.md +++ b/docs/Api/BlacklistApi.md @@ -1,13 +1,13 @@ # Messente\Api\BlacklistApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist -[**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist -[**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers -[**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addToBlacklist()**](BlacklistApi.md#addToBlacklist) | **POST** /phonebook/blacklist | Adds a phone number to the blacklist | +| [**deleteFromBlacklist()**](BlacklistApi.md#deleteFromBlacklist) | **DELETE** /phonebook/blacklist/{phone} | Deletes a phone number from the blacklist | +| [**fetchBlacklist()**](BlacklistApi.md#fetchBlacklist) | **GET** /phonebook/blacklist | Returns all blacklisted phone numbers | +| [**isBlacklisted()**](BlacklistApi.md#isBlacklisted) | **GET** /phonebook/blacklist/{phone} | Checks if a phone number is blacklisted | ## `addToBlacklist()` @@ -48,9 +48,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numberToBlacklist** | [**\Messente\Api\Model\NumberToBlacklist**](../Model/NumberToBlacklist.md)| Phone number to be blacklisted | | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -223,9 +223,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type diff --git a/docs/Api/ContactsApi.md b/docs/Api/ContactsApi.md index 970e008..a99a3ad 100644 --- a/docs/Api/ContactsApi.md +++ b/docs/Api/ContactsApi.md @@ -1,17 +1,17 @@ # Messente\Api\ContactsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group -[**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact -[**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact -[**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact -[**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact -[**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts -[**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group -[**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**addContactToGroup()**](ContactsApi.md#addContactToGroup) | **POST** /phonebook/groups/{groupId}/contacts/{phone} | Adds a contact to a group | +| [**createContact()**](ContactsApi.md#createContact) | **POST** /phonebook/contacts | Creates a new contact | +| [**deleteContact()**](ContactsApi.md#deleteContact) | **DELETE** /phonebook/contacts/{phone} | Deletes a contact | +| [**fetchContact()**](ContactsApi.md#fetchContact) | **GET** /phonebook/contacts/{phone} | Lists a contact | +| [**fetchContactGroups()**](ContactsApi.md#fetchContactGroups) | **GET** /phonebook/contacts/{phone}/groups | Lists groups of a contact | +| [**fetchContacts()**](ContactsApi.md#fetchContacts) | **GET** /phonebook/contacts | Returns all contacts | +| [**removeContactFromGroup()**](ContactsApi.md#removeContactFromGroup) | **DELETE** /phonebook/groups/{groupId}/contacts/{phone} | Removes a contact from a group | +| [**updateContact()**](ContactsApi.md#updateContact) | **PATCH** /phonebook/contacts/{phone} | Updates a contact | ## `addContactToGroup()` @@ -54,10 +54,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | ### Return type @@ -115,9 +115,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **contactFields** | [**\Messente\Api\Model\ContactFields**](../Model/ContactFields.md)| | | ### Return type @@ -174,9 +174,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -234,9 +234,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -294,9 +294,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | ### Return type @@ -354,9 +354,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupIds** | [**string[]**](../Model/string.md)| Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" | [optional] | ### Return type @@ -414,10 +414,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **phone** | **string**| A phone number | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **phone** | **string**| A phone number | | ### Return type @@ -476,10 +476,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **phone** | **string**| A phone number | - **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **phone** | **string**| A phone number | | +| **contactUpdateFields** | [**\Messente\Api\Model\ContactUpdateFields**](../Model/ContactUpdateFields.md)| | | ### Return type diff --git a/docs/Api/DeliveryReportApi.md b/docs/Api/DeliveryReportApi.md index ef62c6f..622fe6f 100644 --- a/docs/Api/DeliveryReportApi.md +++ b/docs/Api/DeliveryReportApi.md @@ -1,10 +1,10 @@ # Messente\Api\DeliveryReportApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**retrieveDeliveryReport()**](DeliveryReportApi.md#retrieveDeliveryReport) | **GET** /omnimessage/{omnimessageId}/status | Retrieves the delivery report for the Omnimessage | ## `retrieveDeliveryReport()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the omnimessage to for which the delivery report is to be retrieved | | ### Return type diff --git a/docs/Api/GroupsApi.md b/docs/Api/GroupsApi.md index f511a0e..8ad8bb9 100644 --- a/docs/Api/GroupsApi.md +++ b/docs/Api/GroupsApi.md @@ -1,14 +1,14 @@ # Messente\Api\GroupsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name -[**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group -[**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group -[**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups -[**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createGroup()**](GroupsApi.md#createGroup) | **POST** /phonebook/groups | Creates a new group with the provided name | +| [**deleteGroup()**](GroupsApi.md#deleteGroup) | **DELETE** /phonebook/groups/{groupId} | Deletes a group | +| [**fetchGroup()**](GroupsApi.md#fetchGroup) | **GET** /phonebook/groups/{groupId} | Lists a group | +| [**fetchGroups()**](GroupsApi.md#fetchGroups) | **GET** /phonebook/groups | Returns all groups | +| [**updateGroup()**](GroupsApi.md#updateGroup) | **PUT** /phonebook/groups/{groupId} | Updates a group with the provided name | ## `createGroup()` @@ -50,9 +50,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | ### Return type @@ -109,9 +109,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | ### Return type @@ -169,9 +169,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | ### Return type @@ -287,10 +287,10 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **groupId** | **string**| String in UUID format | - **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **groupId** | **string**| String in UUID format | | +| **groupName** | [**\Messente\Api\Model\GroupName**](../Model/GroupName.md)| | | ### Return type diff --git a/docs/Api/NumberLookupApi.md b/docs/Api/NumberLookupApi.md index c671dfe..01fa35c 100644 --- a/docs/Api/NumberLookupApi.md +++ b/docs/Api/NumberLookupApi.md @@ -1,10 +1,10 @@ # Messente\Api\NumberLookupApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**fetchInfo()**](NumberLookupApi.md#fetchInfo) | **POST** /hlr/sync | Requests info about phone numbers | ## `fetchInfo()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **numbersToInvestigate** | [**\Messente\Api\Model\NumbersToInvestigate**](../Model/NumbersToInvestigate.md)| Numbers for lookup | | ### Return type diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md index c07dc9b..b4317da 100644 --- a/docs/Api/OmnimessageApi.md +++ b/docs/Api/OmnimessageApi.md @@ -1,11 +1,11 @@ # Messente\Api\OmnimessageApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage -[**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | +| [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | ## `cancelScheduledMessage()` @@ -47,9 +47,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessageId** | **string**| UUID of the scheduled omnimessage to be cancelled | | ### Return type @@ -107,9 +107,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **omnimessage** | [**\Messente\Api\Model\Omnimessage**](../Model/Omnimessage.md)| Omnimessage to be sent | | ### Return type diff --git a/docs/Api/StatisticsApi.md b/docs/Api/StatisticsApi.md index 4cfe438..be19360 100644 --- a/docs/Api/StatisticsApi.md +++ b/docs/Api/StatisticsApi.md @@ -1,10 +1,10 @@ # Messente\Api\StatisticsApi -All URIs are relative to https://api.messente.com/v1. +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. -Method | HTTP request | Description -------------- | ------------- | ------------- -[**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**createStatisticsReport()**](StatisticsApi.md#createStatisticsReport) | **POST** /statistics/reports | Requests statistics reports for each country | ## `createStatisticsReport()` @@ -46,9 +46,9 @@ try { ### Parameters -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **statisticsReportSettings** | [**\Messente\Api\Model\StatisticsReportSettings**](../Model/StatisticsReportSettings.md)| Settings for statistics report | | ### Return type diff --git a/docs/Model/Omnimessage.md b/docs/Model/Omnimessage.md index 9f218f0..b5d8079 100644 --- a/docs/Model/Omnimessage.md +++ b/docs/Model/Omnimessage.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **to** | **string** | Phone number in e.164 format | -**messages** | [**OneOfViberSMSWhatsAppTelegram[]**](OneOfViberSMSWhatsAppTelegram.md) | An array of messages | +**messages** | [**\Messente\Api\Model\OmnimessageMessagesInner[]**](OmnimessageMessagesInner.md) | An array of messages | **dlrUrl** | **string** | URL where the delivery report will be sent | [optional] **textStore** | [**\Messente\Api\Model\TextStore**](TextStore.md) | | [optional] **timeToSend** | **\DateTime** | Optional parameter for sending messages at some specific time in the future. Time must be specified in the ISO-8601 format. If no timezone is specified, then the timezone is assumed to be UTC Examples: * Time specified with timezone: 2018-06-22T09:05:07+00:00 Time specified in UTC: 2018-06-22T09:05:07Z * Time specified without timezone: 2018-06-22T09:05 (equivalent to 2018-06-22T09:05+00:00) | [optional] diff --git a/docs/Model/OmnimessageMessagesInner.md b/docs/Model/OmnimessageMessagesInner.md new file mode 100644 index 0000000..fa0bdf7 --- /dev/null +++ b/docs/Model/OmnimessageMessagesInner.md @@ -0,0 +1,21 @@ +# # OmnimessageMessagesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**sender** | **string** | Phone number or alphanumeric sender name | [optional] +**validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] +**ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] +**text** | **string** | Plaintext content for Telegram | +**imageUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" | [optional] +**buttonUrl** | **string** | URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) | [optional] +**buttonText** | **string** | Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) | [optional] +**channel** | **string** | The channel used to deliver the message | [optional] [default to 'telegram'] +**autoconvert** | **string** | Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way | [optional] +**udh** | **string** | hex-encoded string containing SMS UDH | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] +**documentUrl** | **string** | URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" | [optional] +**audioUrl** | **string** | URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsApp.md b/docs/Model/WhatsApp.md index 95aab88..ae5bbdd 100644 --- a/docs/Model/WhatsApp.md +++ b/docs/Model/WhatsApp.md @@ -7,10 +7,7 @@ Name | Type | Description | Notes **sender** | **string** | Phone number or alphanumeric sender name | [optional] **validity** | **int** | After how many minutes this channel is considered as failed and the next channel is attempted | [optional] **ttl** | **int** | After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. | [optional] -**text** | [**\Messente\Api\Model\WhatsAppText**](WhatsAppText.md) | | [optional] -**image** | [**\Messente\Api\Model\WhatsAppImage**](WhatsAppImage.md) | | [optional] -**document** | [**\Messente\Api\Model\WhatsAppDocument**](WhatsAppDocument.md) | | [optional] -**audio** | [**\Messente\Api\Model\WhatsAppAudio**](WhatsAppAudio.md) | | [optional] +**template** | [**\Messente\Api\Model\WhatsAppTemplate**](WhatsAppTemplate.md) | | [optional] **channel** | **string** | The channel used to deliver the message | [optional] [default to 'whatsapp'] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppComponent.md b/docs/Model/WhatsAppComponent.md new file mode 100644 index 0000000..8e0104c --- /dev/null +++ b/docs/Model/WhatsAppComponent.md @@ -0,0 +1,12 @@ +# # WhatsAppComponent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of the component | +**subType** | **string** | Sub-type of the component | [optional] +**index** | **int** | index used to position buttons | [optional] +**parameters** | [**\Messente\Api\Model\WhatsAppParameter[]**](WhatsAppParameter.md) | List of parameters for the component | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppDocument.md b/docs/Model/WhatsAppCurrency.md similarity index 53% rename from docs/Model/WhatsAppDocument.md rename to docs/Model/WhatsAppCurrency.md index 1183cd3..660a79e 100644 --- a/docs/Model/WhatsAppDocument.md +++ b/docs/Model/WhatsAppCurrency.md @@ -1,10 +1,11 @@ -# # WhatsAppDocument +# # WhatsAppCurrency ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**caption** | **string** | Description for the document | [optional] -**content** | **string** | Base64-encoded image | +**fallbackValue** | **string** | Default text if localization fails. | +**code** | **string** | Currency code as defined in ISO 4217. | +**amount1000** | **string** | Amount multiplied by 1000. | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppAudio.md b/docs/Model/WhatsAppDatetime.md similarity index 77% rename from docs/Model/WhatsAppAudio.md rename to docs/Model/WhatsAppDatetime.md index ff0e201..571a030 100644 --- a/docs/Model/WhatsAppAudio.md +++ b/docs/Model/WhatsAppDatetime.md @@ -1,9 +1,9 @@ -# # WhatsAppAudio +# # WhatsAppDatetime ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**content** | **string** | Base64-encoded audio | +**fallbackValue** | **string** | Default text. | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppImage.md b/docs/Model/WhatsAppLanguage.md similarity index 64% rename from docs/Model/WhatsAppImage.md rename to docs/Model/WhatsAppLanguage.md index fff678f..d202598 100644 --- a/docs/Model/WhatsAppImage.md +++ b/docs/Model/WhatsAppLanguage.md @@ -1,10 +1,10 @@ -# # WhatsAppImage +# # WhatsAppLanguage ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**caption** | **string** | Description for the image | [optional] -**content** | **string** | Base64-encoded image | +**code** | **string** | Language code | +**policy** | **string** | Language policy | [optional] [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppMedia.md b/docs/Model/WhatsAppMedia.md new file mode 100644 index 0000000..085f11c --- /dev/null +++ b/docs/Model/WhatsAppMedia.md @@ -0,0 +1,12 @@ +# # WhatsAppMedia + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | The media object ID. Do not use this field when message type is set to text. | [optional] +**link** | **string** | The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. | [optional] +**caption** | **string** | Media asset caption. Do not use with audio or sticker media. | [optional] +**filename** | **string** | Describes the filename for the specific document. Use only with document media. | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppParameter.md b/docs/Model/WhatsAppParameter.md new file mode 100644 index 0000000..6cbabae --- /dev/null +++ b/docs/Model/WhatsAppParameter.md @@ -0,0 +1,15 @@ +# # WhatsAppParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **string** | Type of the parameter. | +**text** | **string** | A text. | [optional] +**currency** | [**\Messente\Api\Model\WhatsAppCurrency**](WhatsAppCurrency.md) | | [optional] +**dateTime** | [**\Messente\Api\Model\WhatsAppDatetime**](WhatsAppDatetime.md) | | [optional] +**image** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] +**document** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] +**video** | [**\Messente\Api\Model\WhatsAppMedia**](WhatsAppMedia.md) | | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppTemplate.md b/docs/Model/WhatsAppTemplate.md new file mode 100644 index 0000000..a63f2a3 --- /dev/null +++ b/docs/Model/WhatsAppTemplate.md @@ -0,0 +1,11 @@ +# # WhatsAppTemplate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Name of the template | +**language** | [**\Messente\Api\Model\WhatsAppLanguage**](WhatsAppLanguage.md) | | +**components** | [**\Messente\Api\Model\WhatsAppComponent[]**](WhatsAppComponent.md) | List of template components | [optional] + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/WhatsAppText.md b/docs/Model/WhatsAppText.md deleted file mode 100644 index 5a801c0..0000000 --- a/docs/Model/WhatsAppText.md +++ /dev/null @@ -1,10 +0,0 @@ -# # WhatsAppText - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**previewUrl** | **bool** | Whether to display link preview if the message contains a hyperlink | [optional] [default to true] -**body** | **string** | Plaintext content for WhatsApp, can contain URLs, emojis and formatting | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/BlacklistApi.php b/lib/Api/BlacklistApi.php index dfa0ecd..bec68a5 100644 --- a/lib/Api/BlacklistApi.php +++ b/lib/Api/BlacklistApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'deleteFromBlacklist' => [ + 'application/json', + ], + 'fetchBlacklist' => [ + 'application/json', + ], + 'isBlacklisted' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +138,15 @@ public function getConfig() * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function addToBlacklist($numberToBlacklist) + public function addToBlacklist($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - $this->addToBlacklistWithHttpInfo($numberToBlacklist); + $this->addToBlacklistWithHttpInfo($numberToBlacklist, $contentType); } /** @@ -138,14 +155,15 @@ public function addToBlacklist($numberToBlacklist) * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function addToBlacklistWithHttpInfo($numberToBlacklist) + public function addToBlacklistWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - $request = $this->addToBlacklistRequest($numberToBlacklist); + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); try { $options = $this->createHttpClientOption(); @@ -229,13 +247,14 @@ public function addToBlacklistWithHttpInfo($numberToBlacklist) * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsync($numberToBlacklist) + public function addToBlacklistAsync($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { - return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist) + return $this->addToBlacklistAsyncWithHttpInfo($numberToBlacklist, $contentType) ->then( function ($response) { return $response[0]; @@ -249,14 +268,15 @@ function ($response) { * Adds a phone number to the blacklist * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist) + public function addToBlacklistAsyncWithHttpInfo($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { $returnType = ''; - $request = $this->addToBlacklistRequest($numberToBlacklist); + $request = $this->addToBlacklistRequest($numberToBlacklist, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -285,12 +305,14 @@ function ($exception) { * Create request for operation 'addToBlacklist' * * @param \Messente\Api\Model\NumberToBlacklist $numberToBlacklist Phone number to be blacklisted (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addToBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addToBlacklistRequest($numberToBlacklist) + public function addToBlacklistRequest($numberToBlacklist, string $contentType = self::contentTypes['addToBlacklist'][0]) { + // verify the required parameter 'numberToBlacklist' is set if ($numberToBlacklist === null || (is_array($numberToBlacklist) && count($numberToBlacklist) === 0)) { throw new \InvalidArgumentException( @@ -298,6 +320,7 @@ public function addToBlacklistRequest($numberToBlacklist) ); } + $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -309,21 +332,17 @@ public function addToBlacklistRequest($numberToBlacklist) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($numberToBlacklist)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numberToBlacklist)); } else { $httpBody = $numberToBlacklist; } @@ -342,12 +361,12 @@ public function addToBlacklistRequest($numberToBlacklist) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -367,10 +386,11 @@ public function addToBlacklistRequest($numberToBlacklist) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -382,14 +402,15 @@ public function addToBlacklistRequest($numberToBlacklist) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteFromBlacklist($phone) + public function deleteFromBlacklist($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - $this->deleteFromBlacklistWithHttpInfo($phone); + $this->deleteFromBlacklistWithHttpInfo($phone, $contentType); } /** @@ -398,14 +419,15 @@ public function deleteFromBlacklist($phone) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteFromBlacklistWithHttpInfo($phone) + public function deleteFromBlacklistWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - $request = $this->deleteFromBlacklistRequest($phone); + $request = $this->deleteFromBlacklistRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -489,13 +511,14 @@ public function deleteFromBlacklistWithHttpInfo($phone) * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsync($phone) + public function deleteFromBlacklistAsync($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { - return $this->deleteFromBlacklistAsyncWithHttpInfo($phone) + return $this->deleteFromBlacklistAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -509,14 +532,15 @@ function ($response) { * Deletes a phone number from the blacklist * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteFromBlacklistAsyncWithHttpInfo($phone) + public function deleteFromBlacklistAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { $returnType = ''; - $request = $this->deleteFromBlacklistRequest($phone); + $request = $this->deleteFromBlacklistRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -545,12 +569,14 @@ function ($exception) { * Create request for operation 'deleteFromBlacklist' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteFromBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteFromBlacklistRequest($phone) + public function deleteFromBlacklistRequest($phone, string $contentType = self::contentTypes['deleteFromBlacklist'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -558,6 +584,7 @@ public function deleteFromBlacklistRequest($phone) ); } + $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -577,16 +604,11 @@ public function deleteFromBlacklistRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -604,12 +626,12 @@ public function deleteFromBlacklistRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -629,10 +651,11 @@ public function deleteFromBlacklistRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -643,14 +666,15 @@ public function deleteFromBlacklistRequest($phone) * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchBlacklist() + public function fetchBlacklist(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - list($response) = $this->fetchBlacklistWithHttpInfo(); + list($response) = $this->fetchBlacklistWithHttpInfo($contentType); return $response; } @@ -659,14 +683,15 @@ public function fetchBlacklist() * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\FetchBlacklistSuccess|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchBlacklistWithHttpInfo() + public function fetchBlacklistWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - $request = $this->fetchBlacklistRequest(); + $request = $this->fetchBlacklistRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -709,6 +734,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\FetchBlacklistSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -721,6 +761,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -733,6 +788,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -747,6 +817,21 @@ public function fetchBlacklistWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -791,13 +876,14 @@ public function fetchBlacklistWithHttpInfo() * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsync() + public function fetchBlacklistAsync(string $contentType = self::contentTypes['fetchBlacklist'][0]) { - return $this->fetchBlacklistAsyncWithHttpInfo() + return $this->fetchBlacklistAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -810,14 +896,15 @@ function ($response) { * * Returns all blacklisted phone numbers * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchBlacklistAsyncWithHttpInfo() + public function fetchBlacklistAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchBlacklist'][0]) { $returnType = '\Messente\Api\Model\FetchBlacklistSuccess'; - $request = $this->fetchBlacklistRequest(); + $request = $this->fetchBlacklistRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -827,6 +914,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -855,13 +945,15 @@ function ($exception) { /** * Create request for operation 'fetchBlacklist' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchBlacklist'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchBlacklistRequest() + public function fetchBlacklistRequest(string $contentType = self::contentTypes['fetchBlacklist'][0]) { + $resourcePath = '/phonebook/blacklist'; $formParams = []; $queryParams = []; @@ -873,16 +965,11 @@ public function fetchBlacklistRequest() - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -900,12 +987,12 @@ public function fetchBlacklistRequest() // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -925,10 +1012,11 @@ public function fetchBlacklistRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -940,14 +1028,15 @@ public function fetchBlacklistRequest() * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function isBlacklisted($phone) + public function isBlacklisted($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - $this->isBlacklistedWithHttpInfo($phone); + $this->isBlacklistedWithHttpInfo($phone, $contentType); } /** @@ -956,14 +1045,15 @@ public function isBlacklisted($phone) * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function isBlacklistedWithHttpInfo($phone) + public function isBlacklistedWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - $request = $this->isBlacklistedRequest($phone); + $request = $this->isBlacklistedRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1039,13 +1129,14 @@ public function isBlacklistedWithHttpInfo($phone) * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsync($phone) + public function isBlacklistedAsync($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { - return $this->isBlacklistedAsyncWithHttpInfo($phone) + return $this->isBlacklistedAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1059,14 +1150,15 @@ function ($response) { * Checks if a phone number is blacklisted * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function isBlacklistedAsyncWithHttpInfo($phone) + public function isBlacklistedAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { $returnType = ''; - $request = $this->isBlacklistedRequest($phone); + $request = $this->isBlacklistedRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1095,12 +1187,14 @@ function ($exception) { * Create request for operation 'isBlacklisted' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['isBlacklisted'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function isBlacklistedRequest($phone) + public function isBlacklistedRequest($phone, string $contentType = self::contentTypes['isBlacklisted'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1108,6 +1202,7 @@ public function isBlacklistedRequest($phone) ); } + $resourcePath = '/phonebook/blacklist/{phone}'; $formParams = []; $queryParams = []; @@ -1127,16 +1222,11 @@ public function isBlacklistedRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1154,12 +1244,12 @@ public function isBlacklistedRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1179,10 +1269,11 @@ public function isBlacklistedRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/ContactsApi.php b/lib/Api/ContactsApi.php index 73fc90b..4b8ca37 100644 --- a/lib/Api/ContactsApi.php +++ b/lib/Api/ContactsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'createContact' => [ + 'application/json', + ], + 'deleteContact' => [ + 'application/json', + ], + 'fetchContact' => [ + 'application/json', + ], + 'fetchContactGroups' => [ + 'application/json', + ], + 'fetchContacts' => [ + 'application/json', + ], + 'removeContactFromGroup' => [ + 'application/json', + ], + 'updateContact' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -123,14 +151,15 @@ public function getConfig() * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function addContactToGroup($groupId, $phone) + public function addContactToGroup($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone); + list($response) = $this->addContactToGroupWithHttpInfo($groupId, $phone, $contentType); return $response; } @@ -141,14 +170,15 @@ public function addContactToGroup($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function addContactToGroupWithHttpInfo($groupId, $phone) + public function addContactToGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - $request = $this->addContactToGroupRequest($groupId, $phone); + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -191,6 +221,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -203,6 +248,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -215,6 +275,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +302,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +329,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -251,6 +356,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -265,6 +385,21 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -335,13 +470,14 @@ public function addContactToGroupWithHttpInfo($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsync($groupId, $phone) + public function addContactToGroupAsync($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { - return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone) + return $this->addContactToGroupAsyncWithHttpInfo($groupId, $phone, $contentType) ->then( function ($response) { return $response[0]; @@ -356,14 +492,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function addContactToGroupAsyncWithHttpInfo($groupId, $phone) + public function addContactToGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { $returnType = 'object'; - $request = $this->addContactToGroupRequest($groupId, $phone); + $request = $this->addContactToGroupRequest($groupId, $phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -373,6 +510,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -403,18 +543,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['addContactToGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function addContactToGroupRequest($groupId, $phone) + public function addContactToGroupRequest($groupId, $phone, string $contentType = self::contentTypes['addContactToGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling addContactToGroup' ); } + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -422,6 +565,7 @@ public function addContactToGroupRequest($groupId, $phone) ); } + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -449,16 +593,11 @@ public function addContactToGroupRequest($groupId, $phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -476,12 +615,12 @@ public function addContactToGroupRequest($groupId, $phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -501,10 +640,11 @@ public function addContactToGroupRequest($groupId, $phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -516,14 +656,15 @@ public function addContactToGroupRequest($groupId, $phone) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createContact($contactFields) + public function createContact($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - list($response) = $this->createContactWithHttpInfo($contactFields); + list($response) = $this->createContactWithHttpInfo($contactFields, $contentType); return $response; } @@ -533,14 +674,15 @@ public function createContact($contactFields) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createContactWithHttpInfo($contactFields) + public function createContactWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - $request = $this->createContactRequest($contactFields); + $request = $this->createContactRequest($contactFields, $contentType); try { $options = $this->createHttpClientOption(); @@ -583,6 +725,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -595,6 +752,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -607,6 +779,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -619,6 +806,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -631,6 +833,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -645,6 +862,21 @@ public function createContactWithHttpInfo($contactFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -706,13 +938,14 @@ public function createContactWithHttpInfo($contactFields) * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsync($contactFields) + public function createContactAsync($contactFields, string $contentType = self::contentTypes['createContact'][0]) { - return $this->createContactAsyncWithHttpInfo($contactFields) + return $this->createContactAsyncWithHttpInfo($contactFields, $contentType) ->then( function ($response) { return $response[0]; @@ -726,14 +959,15 @@ function ($response) { * Creates a new contact * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createContactAsyncWithHttpInfo($contactFields) + public function createContactAsyncWithHttpInfo($contactFields, string $contentType = self::contentTypes['createContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->createContactRequest($contactFields); + $request = $this->createContactRequest($contactFields, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -743,6 +977,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -772,12 +1009,14 @@ function ($exception) { * Create request for operation 'createContact' * * @param \Messente\Api\Model\ContactFields $contactFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createContactRequest($contactFields) + public function createContactRequest($contactFields, string $contentType = self::contentTypes['createContact'][0]) { + // verify the required parameter 'contactFields' is set if ($contactFields === null || (is_array($contactFields) && count($contactFields) === 0)) { throw new \InvalidArgumentException( @@ -785,6 +1024,7 @@ public function createContactRequest($contactFields) ); } + $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -796,21 +1036,17 @@ public function createContactRequest($contactFields) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($contactFields)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactFields)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactFields)); } else { $httpBody = $contactFields; } @@ -829,12 +1065,12 @@ public function createContactRequest($contactFields) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -854,10 +1090,11 @@ public function createContactRequest($contactFields) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -869,14 +1106,15 @@ public function createContactRequest($contactFields) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteContact($phone) + public function deleteContact($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - $this->deleteContactWithHttpInfo($phone); + $this->deleteContactWithHttpInfo($phone, $contentType); } /** @@ -885,14 +1123,15 @@ public function deleteContact($phone) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteContactWithHttpInfo($phone) + public function deleteContactWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - $request = $this->deleteContactRequest($phone); + $request = $this->deleteContactRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -976,13 +1215,14 @@ public function deleteContactWithHttpInfo($phone) * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsync($phone) + public function deleteContactAsync($phone, string $contentType = self::contentTypes['deleteContact'][0]) { - return $this->deleteContactAsyncWithHttpInfo($phone) + return $this->deleteContactAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -996,14 +1236,15 @@ function ($response) { * Deletes a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteContactAsyncWithHttpInfo($phone) + public function deleteContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['deleteContact'][0]) { $returnType = ''; - $request = $this->deleteContactRequest($phone); + $request = $this->deleteContactRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1032,12 +1273,14 @@ function ($exception) { * Create request for operation 'deleteContact' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteContactRequest($phone) + public function deleteContactRequest($phone, string $contentType = self::contentTypes['deleteContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1045,6 +1288,7 @@ public function deleteContactRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1064,16 +1308,11 @@ public function deleteContactRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1091,12 +1330,12 @@ public function deleteContactRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1116,10 +1355,11 @@ public function deleteContactRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1131,14 +1371,15 @@ public function deleteContactRequest($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContact($phone) + public function fetchContact($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - list($response) = $this->fetchContactWithHttpInfo($phone); + list($response) = $this->fetchContactWithHttpInfo($phone, $contentType); return $response; } @@ -1148,14 +1389,15 @@ public function fetchContact($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactWithHttpInfo($phone) + public function fetchContactWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - $request = $this->fetchContactRequest($phone); + $request = $this->fetchContactRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1198,6 +1440,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1210,6 +1467,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1222,6 +1494,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1234,6 +1521,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1248,6 +1550,21 @@ public function fetchContactWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1301,13 +1618,14 @@ public function fetchContactWithHttpInfo($phone) * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsync($phone) + public function fetchContactAsync($phone, string $contentType = self::contentTypes['fetchContact'][0]) { - return $this->fetchContactAsyncWithHttpInfo($phone) + return $this->fetchContactAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1321,14 +1639,15 @@ function ($response) { * Lists a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactAsyncWithHttpInfo($phone) + public function fetchContactAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->fetchContactRequest($phone); + $request = $this->fetchContactRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1338,6 +1657,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1367,12 +1689,14 @@ function ($exception) { * Create request for operation 'fetchContact' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactRequest($phone) + public function fetchContactRequest($phone, string $contentType = self::contentTypes['fetchContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1380,6 +1704,7 @@ public function fetchContactRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -1399,16 +1724,11 @@ public function fetchContactRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1426,12 +1746,12 @@ public function fetchContactRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1451,10 +1771,11 @@ public function fetchContactRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1466,14 +1787,15 @@ public function fetchContactRequest($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContactGroups($phone) + public function fetchContactGroups($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - list($response) = $this->fetchContactGroupsWithHttpInfo($phone); + list($response) = $this->fetchContactGroupsWithHttpInfo($phone, $contentType); return $response; } @@ -1483,14 +1805,15 @@ public function fetchContactGroups($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactGroupsWithHttpInfo($phone) + public function fetchContactGroupsWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - $request = $this->fetchContactGroupsRequest($phone); + $request = $this->fetchContactGroupsRequest($phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -1533,6 +1856,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1545,6 +1883,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1557,6 +1910,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1569,6 +1937,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1583,6 +1966,21 @@ public function fetchContactGroupsWithHttpInfo($phone) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1636,13 +2034,14 @@ public function fetchContactGroupsWithHttpInfo($phone) * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsync($phone) + public function fetchContactGroupsAsync($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { - return $this->fetchContactGroupsAsyncWithHttpInfo($phone) + return $this->fetchContactGroupsAsyncWithHttpInfo($phone, $contentType) ->then( function ($response) { return $response[0]; @@ -1656,14 +2055,15 @@ function ($response) { * Lists groups of a contact * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactGroupsAsyncWithHttpInfo($phone) + public function fetchContactGroupsAsyncWithHttpInfo($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchContactGroupsRequest($phone); + $request = $this->fetchContactGroupsRequest($phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1673,6 +2073,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1702,12 +2105,14 @@ function ($exception) { * Create request for operation 'fetchContactGroups' * * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContactGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactGroupsRequest($phone) + public function fetchContactGroupsRequest($phone, string $contentType = self::contentTypes['fetchContactGroups'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -1715,6 +2120,7 @@ public function fetchContactGroupsRequest($phone) ); } + $resourcePath = '/phonebook/contacts/{phone}/groups'; $formParams = []; $queryParams = []; @@ -1734,16 +2140,11 @@ public function fetchContactGroupsRequest($phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1761,12 +2162,12 @@ public function fetchContactGroupsRequest($phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1786,10 +2187,11 @@ public function fetchContactGroupsRequest($phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1801,14 +2203,15 @@ public function fetchContactGroupsRequest($phone) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchContacts($groupIds = null) + public function fetchContacts($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - list($response) = $this->fetchContactsWithHttpInfo($groupIds); + list($response) = $this->fetchContactsWithHttpInfo($groupIds, $contentType); return $response; } @@ -1818,14 +2221,15 @@ public function fetchContacts($groupIds = null) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchContactsWithHttpInfo($groupIds = null) + public function fetchContactsWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - $request = $this->fetchContactsRequest($groupIds); + $request = $this->fetchContactsRequest($groupIds, $contentType); try { $options = $this->createHttpClientOption(); @@ -1868,6 +2272,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1880,6 +2299,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1892,6 +2326,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1904,6 +2353,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1918,6 +2382,21 @@ public function fetchContactsWithHttpInfo($groupIds = null) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1971,13 +2450,14 @@ public function fetchContactsWithHttpInfo($groupIds = null) * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsync($groupIds = null) + public function fetchContactsAsync($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { - return $this->fetchContactsAsyncWithHttpInfo($groupIds) + return $this->fetchContactsAsyncWithHttpInfo($groupIds, $contentType) ->then( function ($response) { return $response[0]; @@ -1991,14 +2471,15 @@ function ($response) { * Returns all contacts * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchContactsAsyncWithHttpInfo($groupIds = null) + public function fetchContactsAsyncWithHttpInfo($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { $returnType = '\Messente\Api\Model\ContactListEnvelope'; - $request = $this->fetchContactsRequest($groupIds); + $request = $this->fetchContactsRequest($groupIds, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2008,6 +2489,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2037,13 +2521,16 @@ function ($exception) { * Create request for operation 'fetchContacts' * * @param string[] $groupIds Optional one or many group id strings in UUID format. For example: \"/contacts?groupIds=group_id_one&groupIds=group_id_two\" (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchContacts'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchContactsRequest($groupIds = null) + public function fetchContactsRequest($groupIds = null, string $contentType = self::contentTypes['fetchContacts'][0]) { + + $resourcePath = '/phonebook/contacts'; $formParams = []; $queryParams = []; @@ -2052,30 +2539,23 @@ public function fetchContactsRequest($groupIds = null) $multipart = false; // query params - if ($groupIds !== null) { - if('form' === 'form' && is_array($groupIds)) { - foreach($groupIds as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['groupIds'] = $groupIds; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $groupIds, + 'groupIds', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2093,12 +2573,12 @@ public function fetchContactsRequest($groupIds = null) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2118,10 +2598,11 @@ public function fetchContactsRequest($groupIds = null) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2134,14 +2615,15 @@ public function fetchContactsRequest($groupIds = null) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function removeContactFromGroup($groupId, $phone) + public function removeContactFromGroup($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - $this->removeContactFromGroupWithHttpInfo($groupId, $phone); + $this->removeContactFromGroupWithHttpInfo($groupId, $phone, $contentType); } /** @@ -2151,14 +2633,15 @@ public function removeContactFromGroup($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function removeContactFromGroupWithHttpInfo($groupId, $phone) + public function removeContactFromGroupWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - $request = $this->removeContactFromGroupRequest($groupId, $phone); + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); try { $options = $this->createHttpClientOption(); @@ -2243,13 +2726,14 @@ public function removeContactFromGroupWithHttpInfo($groupId, $phone) * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsync($groupId, $phone) + public function removeContactFromGroupAsync($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { - return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) + return $this->removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, $contentType) ->then( function ($response) { return $response[0]; @@ -2264,14 +2748,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone) + public function removeContactFromGroupAsyncWithHttpInfo($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { $returnType = ''; - $request = $this->removeContactFromGroupRequest($groupId, $phone); + $request = $this->removeContactFromGroupRequest($groupId, $phone, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2301,18 +2786,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param string $phone A phone number (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['removeContactFromGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function removeContactFromGroupRequest($groupId, $phone) + public function removeContactFromGroupRequest($groupId, $phone, string $contentType = self::contentTypes['removeContactFromGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling removeContactFromGroup' ); } + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( @@ -2320,6 +2808,7 @@ public function removeContactFromGroupRequest($groupId, $phone) ); } + $resourcePath = '/phonebook/groups/{groupId}/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -2347,16 +2836,11 @@ public function removeContactFromGroupRequest($groupId, $phone) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2374,12 +2858,12 @@ public function removeContactFromGroupRequest($groupId, $phone) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2399,10 +2883,11 @@ public function removeContactFromGroupRequest($groupId, $phone) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2415,14 +2900,15 @@ public function removeContactFromGroupRequest($groupId, $phone) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateContact($phone, $contactUpdateFields) + public function updateContact($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields); + list($response) = $this->updateContactWithHttpInfo($phone, $contactUpdateFields, $contentType); return $response; } @@ -2433,14 +2919,15 @@ public function updateContact($phone, $contactUpdateFields) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\ContactEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateContactWithHttpInfo($phone, $contactUpdateFields) + public function updateContactWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - $request = $this->updateContactRequest($phone, $contactUpdateFields); + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); try { $options = $this->createHttpClientOption(); @@ -2483,6 +2970,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ContactEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2495,6 +2997,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2507,6 +3024,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2519,6 +3051,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2531,6 +3078,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2545,6 +3107,21 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -2607,13 +3184,14 @@ public function updateContactWithHttpInfo($phone, $contactUpdateFields) * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsync($phone, $contactUpdateFields) + public function updateContactAsync($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { - return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) + return $this->updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, $contentType) ->then( function ($response) { return $response[0]; @@ -2628,14 +3206,15 @@ function ($response) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields) + public function updateContactAsyncWithHttpInfo($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { $returnType = '\Messente\Api\Model\ContactEnvelope'; - $request = $this->updateContactRequest($phone, $contactUpdateFields); + $request = $this->updateContactRequest($phone, $contactUpdateFields, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2645,6 +3224,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2675,18 +3257,21 @@ function ($exception) { * * @param string $phone A phone number (required) * @param \Messente\Api\Model\ContactUpdateFields $contactUpdateFields (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateContact'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateContactRequest($phone, $contactUpdateFields) + public function updateContactRequest($phone, $contactUpdateFields, string $contentType = self::contentTypes['updateContact'][0]) { + // verify the required parameter 'phone' is set if ($phone === null || (is_array($phone) && count($phone) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $phone when calling updateContact' ); } + // verify the required parameter 'contactUpdateFields' is set if ($contactUpdateFields === null || (is_array($contactUpdateFields) && count($contactUpdateFields) === 0)) { throw new \InvalidArgumentException( @@ -2694,6 +3279,7 @@ public function updateContactRequest($phone, $contactUpdateFields) ); } + $resourcePath = '/phonebook/contacts/{phone}'; $formParams = []; $queryParams = []; @@ -2713,21 +3299,17 @@ public function updateContactRequest($phone, $contactUpdateFields) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($contactUpdateFields)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($contactUpdateFields)); } else { $httpBody = $contactUpdateFields; } @@ -2746,12 +3328,12 @@ public function updateContactRequest($phone, $contactUpdateFields) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2771,10 +3353,11 @@ public function updateContactRequest($phone, $contactUpdateFields) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PATCH', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/DeliveryReportApi.php b/lib/Api/DeliveryReportApi.php index dec10da..037e7ff 100644 --- a/lib/Api/DeliveryReportApi.php +++ b/lib/Api/DeliveryReportApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function retrieveDeliveryReport($omnimessageId) + public function retrieveDeliveryReport($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId); + list($response) = $this->retrieveDeliveryReportWithHttpInfo($omnimessageId, $contentType); return $response; } @@ -139,14 +147,15 @@ public function retrieveDeliveryReport($omnimessageId) * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\DeliveryReportResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function retrieveDeliveryReportWithHttpInfo($omnimessageId) + public function retrieveDeliveryReportWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - $request = $this->retrieveDeliveryReportRequest($omnimessageId); + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\DeliveryReportResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +281,21 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -272,13 +341,14 @@ public function retrieveDeliveryReportWithHttpInfo($omnimessageId) * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsync($omnimessageId) + public function retrieveDeliveryReportAsync($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { - return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) + return $this->retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, $contentType) ->then( function ($response) { return $response[0]; @@ -292,14 +362,15 @@ function ($response) { * Retrieves the delivery report for the Omnimessage * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId) + public function retrieveDeliveryReportAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { $returnType = '\Messente\Api\Model\DeliveryReportResponse'; - $request = $this->retrieveDeliveryReportRequest($omnimessageId); + $request = $this->retrieveDeliveryReportRequest($omnimessageId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -309,6 +380,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -338,12 +412,14 @@ function ($exception) { * Create request for operation 'retrieveDeliveryReport' * * @param string $omnimessageId UUID of the omnimessage to for which the delivery report is to be retrieved (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['retrieveDeliveryReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function retrieveDeliveryReportRequest($omnimessageId) + public function retrieveDeliveryReportRequest($omnimessageId, string $contentType = self::contentTypes['retrieveDeliveryReport'][0]) { + // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -351,6 +427,7 @@ public function retrieveDeliveryReportRequest($omnimessageId) ); } + $resourcePath = '/omnimessage/{omnimessageId}/status'; $formParams = []; $queryParams = []; @@ -370,16 +447,11 @@ public function retrieveDeliveryReportRequest($omnimessageId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -397,12 +469,12 @@ public function retrieveDeliveryReportRequest($omnimessageId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -422,10 +494,11 @@ public function retrieveDeliveryReportRequest($omnimessageId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/GroupsApi.php b/lib/Api/GroupsApi.php index 8bfaca6..0b4c8e5 100644 --- a/lib/Api/GroupsApi.php +++ b/lib/Api/GroupsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'deleteGroup' => [ + 'application/json', + ], + 'fetchGroup' => [ + 'application/json', + ], + 'fetchGroups' => [ + 'application/json', + ], + 'updateGroup' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +141,15 @@ public function getConfig() * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function createGroup($groupName) + public function createGroup($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - list($response) = $this->createGroupWithHttpInfo($groupName); + list($response) = $this->createGroupWithHttpInfo($groupName, $contentType); return $response; } @@ -139,14 +159,15 @@ public function createGroup($groupName) * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function createGroupWithHttpInfo($groupName) + public function createGroupWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - $request = $this->createGroupRequest($groupName); + $request = $this->createGroupRequest($groupName, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +210,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +237,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +264,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +291,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +320,21 @@ public function createGroupWithHttpInfo($groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -292,13 +388,14 @@ public function createGroupWithHttpInfo($groupName) * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsync($groupName) + public function createGroupAsync($groupName, string $contentType = self::contentTypes['createGroup'][0]) { - return $this->createGroupAsyncWithHttpInfo($groupName) + return $this->createGroupAsyncWithHttpInfo($groupName, $contentType) ->then( function ($response) { return $response[0]; @@ -312,14 +409,15 @@ function ($response) { * Creates a new group with the provided name * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createGroupAsyncWithHttpInfo($groupName) + public function createGroupAsyncWithHttpInfo($groupName, string $contentType = self::contentTypes['createGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->createGroupRequest($groupName); + $request = $this->createGroupRequest($groupName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,6 +427,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -358,12 +459,14 @@ function ($exception) { * Create request for operation 'createGroup' * * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createGroupRequest($groupName) + public function createGroupRequest($groupName, string $contentType = self::contentTypes['createGroup'][0]) { + // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -371,6 +474,7 @@ public function createGroupRequest($groupName) ); } + $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -382,21 +486,17 @@ public function createGroupRequest($groupName) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($groupName)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -415,12 +515,12 @@ public function createGroupRequest($groupName) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -440,10 +540,11 @@ public function createGroupRequest($groupName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -455,14 +556,15 @@ public function createGroupRequest($groupName) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return void */ - public function deleteGroup($groupId) + public function deleteGroup($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - $this->deleteGroupWithHttpInfo($groupId); + $this->deleteGroupWithHttpInfo($groupId, $contentType); } /** @@ -471,14 +573,15 @@ public function deleteGroup($groupId) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteGroupWithHttpInfo($groupId) + public function deleteGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - $request = $this->deleteGroupRequest($groupId); + $request = $this->deleteGroupRequest($groupId, $contentType); try { $options = $this->createHttpClientOption(); @@ -554,13 +657,14 @@ public function deleteGroupWithHttpInfo($groupId) * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsync($groupId) + public function deleteGroupAsync($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { - return $this->deleteGroupAsyncWithHttpInfo($groupId) + return $this->deleteGroupAsyncWithHttpInfo($groupId, $contentType) ->then( function ($response) { return $response[0]; @@ -574,14 +678,15 @@ function ($response) { * Deletes a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteGroupAsyncWithHttpInfo($groupId) + public function deleteGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { $returnType = ''; - $request = $this->deleteGroupRequest($groupId); + $request = $this->deleteGroupRequest($groupId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -610,12 +715,14 @@ function ($exception) { * Create request for operation 'deleteGroup' * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['deleteGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteGroupRequest($groupId) + public function deleteGroupRequest($groupId, string $contentType = self::contentTypes['deleteGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -623,6 +730,7 @@ public function deleteGroupRequest($groupId) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -642,16 +750,11 @@ public function deleteGroupRequest($groupId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -669,12 +772,12 @@ public function deleteGroupRequest($groupId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -694,10 +797,11 @@ public function deleteGroupRequest($groupId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -709,14 +813,15 @@ public function deleteGroupRequest($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroup($groupId) + public function fetchGroup($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - list($response) = $this->fetchGroupWithHttpInfo($groupId); + list($response) = $this->fetchGroupWithHttpInfo($groupId, $contentType); return $response; } @@ -726,14 +831,15 @@ public function fetchGroup($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupWithHttpInfo($groupId) + public function fetchGroupWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - $request = $this->fetchGroupRequest($groupId); + $request = $this->fetchGroupRequest($groupId, $contentType); try { $options = $this->createHttpClientOption(); @@ -776,6 +882,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -788,6 +909,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -800,6 +936,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -814,6 +965,21 @@ public function fetchGroupWithHttpInfo($groupId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -859,13 +1025,14 @@ public function fetchGroupWithHttpInfo($groupId) * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsync($groupId) + public function fetchGroupAsync($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { - return $this->fetchGroupAsyncWithHttpInfo($groupId) + return $this->fetchGroupAsyncWithHttpInfo($groupId, $contentType) ->then( function ($response) { return $response[0]; @@ -879,14 +1046,15 @@ function ($response) { * Lists a group * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupAsyncWithHttpInfo($groupId) + public function fetchGroupAsyncWithHttpInfo($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->fetchGroupRequest($groupId); + $request = $this->fetchGroupRequest($groupId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -896,6 +1064,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -925,12 +1096,14 @@ function ($exception) { * Create request for operation 'fetchGroup' * * @param string $groupId String in UUID format (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupRequest($groupId) + public function fetchGroupRequest($groupId, string $contentType = self::contentTypes['fetchGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( @@ -938,6 +1111,7 @@ public function fetchGroupRequest($groupId) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -957,16 +1131,11 @@ public function fetchGroupRequest($groupId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -984,12 +1153,12 @@ public function fetchGroupRequest($groupId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1009,10 +1178,11 @@ public function fetchGroupRequest($groupId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1023,14 +1193,15 @@ public function fetchGroupRequest($groupId) * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function fetchGroups() + public function fetchGroups(string $contentType = self::contentTypes['fetchGroups'][0]) { - list($response) = $this->fetchGroupsWithHttpInfo(); + list($response) = $this->fetchGroupsWithHttpInfo($contentType); return $response; } @@ -1039,14 +1210,15 @@ public function fetchGroups() * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupListEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function fetchGroupsWithHttpInfo() + public function fetchGroupsWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) { - $request = $this->fetchGroupsRequest(); + $request = $this->fetchGroupsRequest($contentType); try { $options = $this->createHttpClientOption(); @@ -1089,6 +1261,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupListEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1101,6 +1288,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1113,6 +1315,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1127,6 +1344,21 @@ public function fetchGroupsWithHttpInfo() $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1171,13 +1403,14 @@ public function fetchGroupsWithHttpInfo() * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsync() + public function fetchGroupsAsync(string $contentType = self::contentTypes['fetchGroups'][0]) { - return $this->fetchGroupsAsyncWithHttpInfo() + return $this->fetchGroupsAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1190,14 +1423,15 @@ function ($response) { * * Returns all groups * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchGroupsAsyncWithHttpInfo() + public function fetchGroupsAsyncWithHttpInfo(string $contentType = self::contentTypes['fetchGroups'][0]) { $returnType = '\Messente\Api\Model\GroupListEnvelope'; - $request = $this->fetchGroupsRequest(); + $request = $this->fetchGroupsRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1207,6 +1441,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1235,13 +1472,15 @@ function ($exception) { /** * Create request for operation 'fetchGroups' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchGroups'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchGroupsRequest() + public function fetchGroupsRequest(string $contentType = self::contentTypes['fetchGroups'][0]) { + $resourcePath = '/phonebook/groups'; $formParams = []; $queryParams = []; @@ -1253,16 +1492,11 @@ public function fetchGroupsRequest() - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1280,12 +1514,12 @@ public function fetchGroupsRequest() // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1305,10 +1539,11 @@ public function fetchGroupsRequest() $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1321,14 +1556,15 @@ public function fetchGroupsRequest() * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook */ - public function updateGroup($groupId, $groupName) + public function updateGroup($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName); + list($response) = $this->updateGroupWithHttpInfo($groupId, $groupName, $contentType); return $response; } @@ -1339,14 +1575,15 @@ public function updateGroup($groupId, $groupName) * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\GroupEnvelope|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook|\Messente\Api\Model\ErrorPhonebook, HTTP status code, HTTP response headers (array of strings) */ - public function updateGroupWithHttpInfo($groupId, $groupName) + public function updateGroupWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - $request = $this->updateGroupRequest($groupId, $groupName); + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); try { $options = $this->createHttpClientOption(); @@ -1389,6 +1626,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\GroupEnvelope' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1401,6 +1653,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1413,6 +1680,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1425,6 +1707,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1437,6 +1734,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorPhonebook' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1451,6 +1763,21 @@ public function updateGroupWithHttpInfo($groupId, $groupName) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -1513,13 +1840,14 @@ public function updateGroupWithHttpInfo($groupId, $groupName) * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsync($groupId, $groupName) + public function updateGroupAsync($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { - return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName) + return $this->updateGroupAsyncWithHttpInfo($groupId, $groupName, $contentType) ->then( function ($response) { return $response[0]; @@ -1534,14 +1862,15 @@ function ($response) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateGroupAsyncWithHttpInfo($groupId, $groupName) + public function updateGroupAsyncWithHttpInfo($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { $returnType = '\Messente\Api\Model\GroupEnvelope'; - $request = $this->updateGroupRequest($groupId, $groupName); + $request = $this->updateGroupRequest($groupId, $groupName, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1551,6 +1880,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1581,18 +1913,21 @@ function ($exception) { * * @param string $groupId String in UUID format (required) * @param \Messente\Api\Model\GroupName $groupName (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateGroup'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateGroupRequest($groupId, $groupName) + public function updateGroupRequest($groupId, $groupName, string $contentType = self::contentTypes['updateGroup'][0]) { + // verify the required parameter 'groupId' is set if ($groupId === null || (is_array($groupId) && count($groupId) === 0)) { throw new \InvalidArgumentException( 'Missing the required parameter $groupId when calling updateGroup' ); } + // verify the required parameter 'groupName' is set if ($groupName === null || (is_array($groupName) && count($groupName) === 0)) { throw new \InvalidArgumentException( @@ -1600,6 +1935,7 @@ public function updateGroupRequest($groupId, $groupName) ); } + $resourcePath = '/phonebook/groups/{groupId}'; $formParams = []; $queryParams = []; @@ -1619,21 +1955,17 @@ public function updateGroupRequest($groupId, $groupName) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($groupName)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($groupName)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($groupName)); } else { $httpBody = $groupName; } @@ -1652,12 +1984,12 @@ public function updateGroupRequest($groupId, $groupName) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1677,10 +2009,11 @@ public function updateGroupRequest($groupId, $groupName) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/NumberLookupApi.php b/lib/Api/NumberLookupApi.php index 54abbe4..4bea0f0 100644 --- a/lib/Api/NumberLookupApi.php +++ b/lib/Api/NumberLookupApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup */ - public function fetchInfo($numbersToInvestigate) + public function fetchInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate); + list($response) = $this->fetchInfoWithHttpInfo($numbersToInvestigate, $contentType); return $response; } @@ -139,14 +147,15 @@ public function fetchInfo($numbersToInvestigate) * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\SyncNumberLookupSuccess|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup|\Messente\Api\Model\ErrorNumberLookup, HTTP status code, HTTP response headers (array of strings) */ - public function fetchInfoWithHttpInfo($numbersToInvestigate) + public function fetchInfoWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - $request = $this->fetchInfoRequest($numbersToInvestigate); + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\SyncNumberLookupSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +279,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorNumberLookup' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -239,6 +308,21 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -292,13 +376,14 @@ public function fetchInfoWithHttpInfo($numbersToInvestigate) * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsync($numbersToInvestigate) + public function fetchInfoAsync($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { - return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate) + return $this->fetchInfoAsyncWithHttpInfo($numbersToInvestigate, $contentType) ->then( function ($response) { return $response[0]; @@ -312,14 +397,15 @@ function ($response) { * Requests info about phone numbers * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate) + public function fetchInfoAsyncWithHttpInfo($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { $returnType = '\Messente\Api\Model\SyncNumberLookupSuccess'; - $request = $this->fetchInfoRequest($numbersToInvestigate); + $request = $this->fetchInfoRequest($numbersToInvestigate, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -329,6 +415,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -358,12 +447,14 @@ function ($exception) { * Create request for operation 'fetchInfo' * * @param \Messente\Api\Model\NumbersToInvestigate $numbersToInvestigate Numbers for lookup (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['fetchInfo'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function fetchInfoRequest($numbersToInvestigate) + public function fetchInfoRequest($numbersToInvestigate, string $contentType = self::contentTypes['fetchInfo'][0]) { + // verify the required parameter 'numbersToInvestigate' is set if ($numbersToInvestigate === null || (is_array($numbersToInvestigate) && count($numbersToInvestigate) === 0)) { throw new \InvalidArgumentException( @@ -371,6 +462,7 @@ public function fetchInfoRequest($numbersToInvestigate) ); } + $resourcePath = '/hlr/sync'; $formParams = []; $queryParams = []; @@ -382,21 +474,17 @@ public function fetchInfoRequest($numbersToInvestigate) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($numbersToInvestigate)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($numbersToInvestigate)); } else { $httpBody = $numbersToInvestigate; } @@ -415,12 +503,12 @@ public function fetchInfoRequest($numbersToInvestigate) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -440,10 +528,11 @@ public function fetchInfoRequest($numbersToInvestigate) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php index bcda4cb..1cc0442 100644 --- a/lib/Api/OmnimessageApi.php +++ b/lib/Api/OmnimessageApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + 'sendOmnimessage' => [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +132,15 @@ public function getConfig() * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function cancelScheduledMessage($omnimessageId) + public function cancelScheduledMessage($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId); + list($response) = $this->cancelScheduledMessageWithHttpInfo($omnimessageId, $contentType); return $response; } @@ -139,14 +150,15 @@ public function cancelScheduledMessage($omnimessageId) * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of object|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function cancelScheduledMessageWithHttpInfo($omnimessageId) + public function cancelScheduledMessageWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - $request = $this->cancelScheduledMessageRequest($omnimessageId); + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +201,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('object' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +228,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +255,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -227,6 +284,21 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -272,13 +344,14 @@ public function cancelScheduledMessageWithHttpInfo($omnimessageId) * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsync($omnimessageId) + public function cancelScheduledMessageAsync($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { - return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) + return $this->cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, $contentType) ->then( function ($response) { return $response[0]; @@ -292,14 +365,15 @@ function ($response) { * Cancels a scheduled Omnimessage * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId) + public function cancelScheduledMessageAsyncWithHttpInfo($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { $returnType = 'object'; - $request = $this->cancelScheduledMessageRequest($omnimessageId); + $request = $this->cancelScheduledMessageRequest($omnimessageId, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -309,6 +383,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -338,12 +415,14 @@ function ($exception) { * Create request for operation 'cancelScheduledMessage' * * @param string $omnimessageId UUID of the scheduled omnimessage to be cancelled (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['cancelScheduledMessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function cancelScheduledMessageRequest($omnimessageId) + public function cancelScheduledMessageRequest($omnimessageId, string $contentType = self::contentTypes['cancelScheduledMessage'][0]) { + // verify the required parameter 'omnimessageId' is set if ($omnimessageId === null || (is_array($omnimessageId) && count($omnimessageId) === 0)) { throw new \InvalidArgumentException( @@ -351,6 +430,7 @@ public function cancelScheduledMessageRequest($omnimessageId) ); } + $resourcePath = '/omnimessage/{omnimessageId}'; $formParams = []; $queryParams = []; @@ -370,16 +450,11 @@ public function cancelScheduledMessageRequest($omnimessageId) } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -397,12 +472,12 @@ public function cancelScheduledMessageRequest($omnimessageId) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -422,10 +497,11 @@ public function cancelScheduledMessageRequest($omnimessageId) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -437,14 +513,15 @@ public function cancelScheduledMessageRequest($omnimessageId) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel */ - public function sendOmnimessage($omnimessage) + public function sendOmnimessage($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage); + list($response) = $this->sendOmnimessageWithHttpInfo($omnimessage, $contentType); return $response; } @@ -454,14 +531,15 @@ public function sendOmnimessage($omnimessage) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\OmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) */ - public function sendOmnimessageWithHttpInfo($omnimessage) + public function sendOmnimessageWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - $request = $this->sendOmnimessageRequest($omnimessage); + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); try { $options = $this->createHttpClientOption(); @@ -504,6 +582,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\OmniMessageCreateSuccessResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -516,6 +609,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -528,6 +636,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -542,6 +665,21 @@ public function sendOmnimessageWithHttpInfo($omnimessage) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -587,13 +725,14 @@ public function sendOmnimessageWithHttpInfo($omnimessage) * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsync($omnimessage) + public function sendOmnimessageAsync($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { - return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage) + return $this->sendOmnimessageAsyncWithHttpInfo($omnimessage, $contentType) ->then( function ($response) { return $response[0]; @@ -607,14 +746,15 @@ function ($response) { * Sends an Omnimessage * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function sendOmnimessageAsyncWithHttpInfo($omnimessage) + public function sendOmnimessageAsyncWithHttpInfo($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { $returnType = '\Messente\Api\Model\OmniMessageCreateSuccessResponse'; - $request = $this->sendOmnimessageRequest($omnimessage); + $request = $this->sendOmnimessageRequest($omnimessage, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -624,6 +764,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -653,12 +796,14 @@ function ($exception) { * Create request for operation 'sendOmnimessage' * * @param \Messente\Api\Model\Omnimessage $omnimessage Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendOmnimessage'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function sendOmnimessageRequest($omnimessage) + public function sendOmnimessageRequest($omnimessage, string $contentType = self::contentTypes['sendOmnimessage'][0]) { + // verify the required parameter 'omnimessage' is set if ($omnimessage === null || (is_array($omnimessage) && count($omnimessage) === 0)) { throw new \InvalidArgumentException( @@ -666,6 +811,7 @@ public function sendOmnimessageRequest($omnimessage) ); } + $resourcePath = '/omnimessage'; $formParams = []; $queryParams = []; @@ -677,21 +823,17 @@ public function sendOmnimessageRequest($omnimessage) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($omnimessage)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($omnimessage)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($omnimessage)); } else { $httpBody = $omnimessage; } @@ -710,12 +852,12 @@ public function sendOmnimessageRequest($omnimessage) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -735,10 +877,11 @@ public function sendOmnimessageRequest($omnimessage) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/Api/StatisticsApi.php b/lib/Api/StatisticsApi.php index a5b109f..0d70d5a 100644 --- a/lib/Api/StatisticsApi.php +++ b/lib/Api/StatisticsApi.php @@ -1,7 +1,7 @@ [ + 'application/json', + ], + ]; + /** * @param ClientInterface $client * @param Configuration $config @@ -122,14 +129,15 @@ public function getConfig() * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics */ - public function createStatisticsReport($statisticsReportSettings) + public function createStatisticsReport($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings); + list($response) = $this->createStatisticsReportWithHttpInfo($statisticsReportSettings, $contentType); return $response; } @@ -139,14 +147,15 @@ public function createStatisticsReport($statisticsReportSettings) * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * - * @throws \Messente\Api\ApiException on non-2xx response + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of \Messente\Api\Model\StatisticsReportSuccess|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics|\Messente\Api\Model\ErrorStatistics, HTTP status code, HTTP response headers (array of strings) */ - public function createStatisticsReportWithHttpInfo($statisticsReportSettings) + public function createStatisticsReportWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - $request = $this->createStatisticsReportRequest($statisticsReportSettings); + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); try { $options = $this->createHttpClientOption(); @@ -189,6 +198,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\StatisticsReportSuccess' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -201,6 +225,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -213,6 +252,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -225,6 +279,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -237,6 +306,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorStatistics' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -251,6 +335,21 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } } return [ @@ -312,13 +411,14 @@ public function createStatisticsReportWithHttpInfo($statisticsReportSettings) * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsync($statisticsReportSettings) + public function createStatisticsReportAsync($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { - return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) + return $this->createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, $contentType) ->then( function ($response) { return $response[0]; @@ -332,14 +432,15 @@ function ($response) { * Requests statistics reports for each country * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings) + public function createStatisticsReportAsyncWithHttpInfo($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { $returnType = '\Messente\Api\Model\StatisticsReportSuccess'; - $request = $this->createStatisticsReportRequest($statisticsReportSettings); + $request = $this->createStatisticsReportRequest($statisticsReportSettings, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -349,6 +450,9 @@ function ($response) use ($returnType) { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -378,12 +482,14 @@ function ($exception) { * Create request for operation 'createStatisticsReport' * * @param \Messente\Api\Model\StatisticsReportSettings $statisticsReportSettings Settings for statistics report (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['createStatisticsReport'] to see the possible values for this operation * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createStatisticsReportRequest($statisticsReportSettings) + public function createStatisticsReportRequest($statisticsReportSettings, string $contentType = self::contentTypes['createStatisticsReport'][0]) { + // verify the required parameter 'statisticsReportSettings' is set if ($statisticsReportSettings === null || (is_array($statisticsReportSettings) && count($statisticsReportSettings) === 0)) { throw new \InvalidArgumentException( @@ -391,6 +497,7 @@ public function createStatisticsReportRequest($statisticsReportSettings) ); } + $resourcePath = '/statistics/reports'; $formParams = []; $queryParams = []; @@ -402,21 +509,17 @@ public function createStatisticsReportRequest($statisticsReportSettings) - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['application/json'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); // for model (json/xml) if (isset($statisticsReportSettings)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($statisticsReportSettings)); } else { $httpBody = $statisticsReportSettings; } @@ -435,12 +538,12 @@ public function createStatisticsReportRequest($statisticsReportSettings) // for HTTP post (form) $httpBody = new MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($formParams); - + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); } else { // for HTTP post (form) - $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -460,10 +563,11 @@ public function createStatisticsReportRequest($statisticsReportSettings) $headers ); - $query = \GuzzleHttp\Psr7\Query::build($queryParams); + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); diff --git a/lib/ApiException.php b/lib/ApiException.php index 5e918bc..a61f0f5 100644 --- a/lib/ApiException.php +++ b/lib/ApiException.php @@ -1,7 +1,7 @@ accessToken; } + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + /** * Sets the username for HTTP basic authentication * @@ -400,7 +434,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the OpenAPI document: 2.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 2.1.0' . PHP_EOL; + $report .= ' SDK Package Version: 3.0.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; @@ -447,32 +481,31 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) { if (null === $variables) { $variables = []; } - $hosts = $this->getHostSettings(); - // check array index out of bound - if ($index < 0 || $index >= sizeof($hosts)) { - throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); } - $host = $hosts[$index]; + $host = $hostSettings[$hostIndex]; $url = $host["url"]; // go through variable and assign a value foreach ($host["variables"] ?? [] as $name => $variable) { if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum $url = str_replace("{".$name."}", $variables[$name], $url); } else { throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); @@ -485,4 +518,16 @@ public function getHostFromSettings($index, $variables = null) return $url; } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } } diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php index a149e1d..d28cb40 100644 --- a/lib/HeaderSelector.php +++ b/lib/HeaderSelector.php @@ -1,7 +1,7 @@ selectContentTypeHeader($contentTypes); - return $headers; - } + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } - /** - * @param string[] $accept - * @return array - */ - public function selectHeadersForMultipart($accept) - { - $headers = $this->selectHeaders($accept, []); + $headers['Content-Type'] = $contentType; + } - unset($headers['Content-Type']); return $headers; } /** - * Return the header 'Accept' based on an array of Accept provided + * Return the header 'Accept' based on an array of Accept provided. * * @param string[] $accept Array of header * * @return null|string Accept (e.g. application/json) */ - private function selectAcceptHeader($accept) + private function selectAcceptHeader(array $accept): ?string { - if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { return null; - } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { - return implode(',', $jsonAccept); - } else { + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept); + if (count($headersWithJson) === 0) { return implode(',', $accept); } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); } /** - * Return the content type based on an array of content-type provided + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight * - * @param string[] $contentType Array fo content-type + * @param string $header "Accept" Header * - * @return string Content-Type (e.g. application/json) + * @return array with the header and its weight */ - private function selectContentTypeHeader($contentType) + private function getHeaderAndWeight(string $header): array { - if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { - return 'application/json'; - } elseif (preg_grep("/application\/json/i", $contentType)) { - return 'application/json'; + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; } else { - return implode(',', $contentType); + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); } } diff --git a/lib/Model/Channel.php b/lib/Model/Channel.php index e9c9a37..e48e7d4 100644 --- a/lib/Model/Channel.php +++ b/lib/Model/Channel.php @@ -2,7 +2,7 @@ /** * Channel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,13 +44,13 @@ class Channel /** * Possible values of this enum */ - const SMS = 'sms'; + public const SMS = 'sms'; - const VIBER = 'viber'; + public const VIBER = 'viber'; - const WHATSAPP = 'whatsapp'; + public const WHATSAPP = 'whatsapp'; - const TELEGRAM = 'telegram'; + public const TELEGRAM = 'telegram'; /** * Gets allowable values of the enum diff --git a/lib/Model/ContactEnvelope.php b/lib/Model/ContactEnvelope.php index f1e0dd9..1c1bb3c 100644 --- a/lib/Model/ContactEnvelope.php +++ b/lib/Model/ContactEnvelope.php @@ -2,7 +2,7 @@ /** * ContactEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ContactEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'contact' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contact' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['contact'] = $data['contact'] ?? null; + $this->setIfExists('contact', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getContact() */ public function setContact($contact) { + if (is_null($contact)) { + throw new \InvalidArgumentException('non-nullable contact cannot be null'); + } $this->container['contact'] = $contact; return $this; @@ -237,7 +324,7 @@ public function setContact($contact) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -249,6 +336,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -262,7 +350,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -278,7 +366,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -290,6 +378,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactFields.php b/lib/Model/ContactFields.php index 7fc55a0..971bc81 100644 --- a/lib/Model/ContactFields.php +++ b/lib/Model/ContactFields.php @@ -2,7 +2,7 @@ /** * ContactFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -93,6 +91,31 @@ class ContactFields implements ModelInterface, ArrayAccess, \JsonSerializable 'custom4' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -113,6 +136,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -225,16 +300,34 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -283,6 +376,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -307,6 +403,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -331,6 +437,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -355,6 +471,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -379,6 +505,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -403,6 +539,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -427,6 +573,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -451,6 +607,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -475,6 +641,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -499,6 +675,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -510,7 +696,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -522,6 +708,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -535,7 +722,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -551,7 +738,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -563,6 +750,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactListEnvelope.php b/lib/Model/ContactListEnvelope.php index b225830..81b91ea 100644 --- a/lib/Model/ContactListEnvelope.php +++ b/lib/Model/ContactListEnvelope.php @@ -2,7 +2,7 @@ /** * ContactListEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ContactListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializa 'contacts' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contacts' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['contacts'] = $data['contacts'] ?? null; + $this->setIfExists('contacts', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getContacts() */ public function setContacts($contacts) { + if (is_null($contacts)) { + throw new \InvalidArgumentException('non-nullable contacts cannot be null'); + } $this->container['contacts'] = $contacts; @@ -239,7 +326,7 @@ public function setContacts($contacts) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactResponseFields.php b/lib/Model/ContactResponseFields.php index 1b44998..06a560d 100644 --- a/lib/Model/ContactResponseFields.php +++ b/lib/Model/ContactResponseFields.php @@ -2,7 +2,7 @@ /** * ContactResponseFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -95,6 +93,32 @@ class ContactResponseFields implements ModelInterface, ArrayAccess, \JsonSeriali 'scheduledDeletionDate' => 'date' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false, + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true, + 'scheduledDeletionDate' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -115,6 +139,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -230,17 +306,35 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; - $this->container['scheduledDeletionDate'] = $data['scheduledDeletionDate'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + $this->setIfExists('scheduledDeletionDate', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -286,6 +380,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -310,6 +407,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -334,6 +441,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -358,6 +475,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -382,6 +509,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -406,6 +543,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -430,6 +577,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -454,6 +611,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -478,6 +645,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -502,6 +679,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -526,6 +713,16 @@ public function getScheduledDeletionDate() */ public function setScheduledDeletionDate($scheduledDeletionDate) { + if (is_null($scheduledDeletionDate)) { + array_push($this->openAPINullablesSetToNull, 'scheduledDeletionDate'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('scheduledDeletionDate', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['scheduledDeletionDate'] = $scheduledDeletionDate; return $this; @@ -537,7 +734,7 @@ public function setScheduledDeletionDate($scheduledDeletionDate) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -549,6 +746,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -562,7 +760,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -578,7 +776,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -590,6 +788,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ContactUpdateFields.php b/lib/Model/ContactUpdateFields.php index 1f4c757..8f2b5a5 100644 --- a/lib/Model/ContactUpdateFields.php +++ b/lib/Model/ContactUpdateFields.php @@ -2,7 +2,7 @@ /** * ContactUpdateFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -91,6 +89,30 @@ class ContactUpdateFields implements ModelInterface, ArrayAccess, \JsonSerializa 'custom4' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'email' => true, + 'firstName' => true, + 'lastName' => true, + 'company' => true, + 'title' => true, + 'custom' => true, + 'custom2' => true, + 'custom3' => true, + 'custom4' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -111,6 +133,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -220,15 +294,33 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['email'] = $data['email'] ?? null; - $this->container['firstName'] = $data['firstName'] ?? null; - $this->container['lastName'] = $data['lastName'] ?? null; - $this->container['company'] = $data['company'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['custom'] = $data['custom'] ?? null; - $this->container['custom2'] = $data['custom2'] ?? null; - $this->container['custom3'] = $data['custom3'] ?? null; - $this->container['custom4'] = $data['custom4'] ?? null; + $this->setIfExists('email', $data ?? [], null); + $this->setIfExists('firstName', $data ?? [], null); + $this->setIfExists('lastName', $data ?? [], null); + $this->setIfExists('company', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('custom', $data ?? [], null); + $this->setIfExists('custom2', $data ?? [], null); + $this->setIfExists('custom3', $data ?? [], null); + $this->setIfExists('custom4', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -274,6 +366,16 @@ public function getEmail() */ public function setEmail($email) { + if (is_null($email)) { + array_push($this->openAPINullablesSetToNull, 'email'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('email', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['email'] = $email; return $this; @@ -298,6 +400,16 @@ public function getFirstName() */ public function setFirstName($firstName) { + if (is_null($firstName)) { + array_push($this->openAPINullablesSetToNull, 'firstName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('firstName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['firstName'] = $firstName; return $this; @@ -322,6 +434,16 @@ public function getLastName() */ public function setLastName($lastName) { + if (is_null($lastName)) { + array_push($this->openAPINullablesSetToNull, 'lastName'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('lastName', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['lastName'] = $lastName; return $this; @@ -346,6 +468,16 @@ public function getCompany() */ public function setCompany($company) { + if (is_null($company)) { + array_push($this->openAPINullablesSetToNull, 'company'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('company', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['company'] = $company; return $this; @@ -370,6 +502,16 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + array_push($this->openAPINullablesSetToNull, 'title'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('title', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['title'] = $title; return $this; @@ -394,6 +536,16 @@ public function getCustom() */ public function setCustom($custom) { + if (is_null($custom)) { + array_push($this->openAPINullablesSetToNull, 'custom'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom'] = $custom; return $this; @@ -418,6 +570,16 @@ public function getCustom2() */ public function setCustom2($custom2) { + if (is_null($custom2)) { + array_push($this->openAPINullablesSetToNull, 'custom2'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom2', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom2'] = $custom2; return $this; @@ -442,6 +604,16 @@ public function getCustom3() */ public function setCustom3($custom3) { + if (is_null($custom3)) { + array_push($this->openAPINullablesSetToNull, 'custom3'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom3', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom3'] = $custom3; return $this; @@ -466,6 +638,16 @@ public function getCustom4() */ public function setCustom4($custom4) { + if (is_null($custom4)) { + array_push($this->openAPINullablesSetToNull, 'custom4'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom4', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom4'] = $custom4; return $this; @@ -477,7 +659,7 @@ public function setCustom4($custom4) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -489,6 +671,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -502,7 +685,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -518,7 +701,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -530,6 +713,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryReportResponse.php b/lib/Model/DeliveryReportResponse.php index 0ac1bdb..39c14ed 100644 --- a/lib/Model/DeliveryReportResponse.php +++ b/lib/Model/DeliveryReportResponse.php @@ -2,7 +2,7 @@ /** * DeliveryReportResponse * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class DeliveryReportResponse implements ModelInterface, ArrayAccess, \JsonSerial 'omnimessageId' => 'UUID' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'statuses' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['statuses'] = $data['statuses'] ?? null; - $this->container['to'] = $data['to'] ?? null; - $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; + $this->setIfExists('statuses', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getStatuses() */ public function setStatuses($statuses) { + if (is_null($statuses)) { + throw new \InvalidArgumentException('non-nullable statuses cannot be null'); + } $this->container['statuses'] = $statuses; return $this; @@ -271,6 +360,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -295,6 +387,9 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -306,7 +401,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/DeliveryResult.php b/lib/Model/DeliveryResult.php index 049d5e3..09858a8 100644 --- a/lib/Model/DeliveryResult.php +++ b/lib/Model/DeliveryResult.php @@ -2,7 +2,7 @@ /** * DeliveryResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -85,6 +83,27 @@ class DeliveryResult implements ModelInterface, ArrayAccess, \JsonSerializable 'timestamp' => 'date-time' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'status' => false, + 'channel' => false, + 'messageId' => false, + 'error' => true, + 'err' => false, + 'timestamp' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +124,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -205,12 +276,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['status'] = $data['status'] ?? null; - $this->container['channel'] = $data['channel'] ?? null; - $this->container['messageId'] = $data['messageId'] ?? null; - $this->container['error'] = $data['error'] ?? null; - $this->container['err'] = $data['err'] ?? null; - $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + $this->setIfExists('err', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -256,6 +345,9 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $this->container['status'] = $status; return $this; @@ -280,6 +372,9 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $this->container['channel'] = $channel; return $this; @@ -304,6 +399,9 @@ public function getMessageId() */ public function setMessageId($messageId) { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -328,6 +426,16 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['error'] = $error; return $this; @@ -352,6 +460,9 @@ public function getErr() */ public function setErr($err) { + if (is_null($err)) { + throw new \InvalidArgumentException('non-nullable err cannot be null'); + } $this->container['err'] = $err; return $this; @@ -376,6 +487,9 @@ public function getTimestamp() */ public function setTimestamp($timestamp) { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } $this->container['timestamp'] = $timestamp; return $this; @@ -387,7 +501,7 @@ public function setTimestamp($timestamp) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -399,6 +513,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -412,7 +527,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -428,7 +543,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -440,6 +555,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorCodeOmnichannel.php b/lib/Model/ErrorCodeOmnichannel.php index 5f88cd2..51e6e9c 100644 --- a/lib/Model/ErrorCodeOmnichannel.php +++ b/lib/Model/ErrorCodeOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,19 +44,19 @@ class ErrorCodeOmnichannel /** * Possible values of this enum */ - const _101 = '101'; + public const _101 = '101'; - const _102 = '102'; + public const _102 = '102'; - const _103 = '103'; + public const _103 = '103'; - const _104 = '104'; + public const _104 = '104'; - const _105 = '105'; + public const _105 = '105'; - const _106 = '106'; + public const _106 = '106'; - const _107 = '107'; + public const _107 = '107'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeOmnichannelMachine.php b/lib/Model/ErrorCodeOmnichannelMachine.php index 50b2f5f..8dd9e02 100644 --- a/lib/Model/ErrorCodeOmnichannelMachine.php +++ b/lib/Model/ErrorCodeOmnichannelMachine.php @@ -2,7 +2,7 @@ /** * ErrorCodeOmnichannelMachine * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,29 +44,29 @@ class ErrorCodeOmnichannelMachine /** * Possible values of this enum */ - const NUMBER_0 = 0; + public const NUMBER_0 = 0; - const NUMBER_1 = 1; + public const NUMBER_1 = 1; - const NUMBER_2 = 2; + public const NUMBER_2 = 2; - const NUMBER_3 = 3; + public const NUMBER_3 = 3; - const NUMBER_4 = 4; + public const NUMBER_4 = 4; - const NUMBER_5 = 5; + public const NUMBER_5 = 5; - const NUMBER_6 = 6; + public const NUMBER_6 = 6; - const NUMBER_7 = 7; + public const NUMBER_7 = 7; - const NUMBER_8 = 8; + public const NUMBER_8 = 8; - const NUMBER_9 = 9; + public const NUMBER_9 = 9; - const NUMBER_10 = 10; + public const NUMBER_10 = 10; - const NUMBER_999 = 999; + public const NUMBER_999 = 999; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodePhonebook.php b/lib/Model/ErrorCodePhonebook.php index 37fdb89..1d455bd 100644 --- a/lib/Model/ErrorCodePhonebook.php +++ b/lib/Model/ErrorCodePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorCodePhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,17 +44,17 @@ class ErrorCodePhonebook /** * Possible values of this enum */ - const _201 = '201'; + public const _201 = '201'; - const _202 = '202'; + public const _202 = '202'; - const _203 = '203'; + public const _203 = '203'; - const _204 = '204'; + public const _204 = '204'; - const _244 = '244'; + public const _244 = '244'; - const _205 = '205'; + public const _205 = '205'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorCodeStatistics.php b/lib/Model/ErrorCodeStatistics.php index 6b082f7..aa373bf 100644 --- a/lib/Model/ErrorCodeStatistics.php +++ b/lib/Model/ErrorCodeStatistics.php @@ -2,7 +2,7 @@ /** * ErrorCodeStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,13 +44,13 @@ class ErrorCodeStatistics /** * Possible values of this enum */ - const _100 = '100'; + public const _100 = '100'; - const _103 = '103'; + public const _103 = '103'; - const _104 = '104'; + public const _104 = '104'; - const _105 = '105'; + public const _105 = '105'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorItemNumberLookup.php b/lib/Model/ErrorItemNumberLookup.php index 1173426..1fe0fe4 100644 --- a/lib/Model/ErrorItemNumberLookup.php +++ b/lib/Model/ErrorItemNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookup * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorItemNumberLookup implements ModelInterface, ArrayAccess, \JsonSeriali 'error' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'error' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['error'] = $data['error'] ?? null; + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + throw new \InvalidArgumentException('non-nullable error cannot be null'); + } $this->container['error'] = $error; return $this; @@ -240,7 +327,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemNumberLookupError.php b/lib/Model/ErrorItemNumberLookupError.php index b8f6254..54436a2 100644 --- a/lib/Model/ErrorItemNumberLookupError.php +++ b/lib/Model/ErrorItemNumberLookupError.php @@ -2,7 +2,7 @@ /** * ErrorItemNumberLookupError * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,6 +75,23 @@ class ErrorItemNumberLookupError implements ModelInterface, ArrayAccess, \JsonSe 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'description' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['description'] = $data['description'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('description', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -246,6 +331,9 @@ public function getDescription() */ public function setDescription($description) { + if (is_null($description)) { + throw new \InvalidArgumentException('non-nullable description cannot be null'); + } $this->container['description'] = $description; return $this; @@ -270,6 +358,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } if (($code > 106)) { throw new \InvalidArgumentException('invalid value for $code when calling ErrorItemNumberLookupError., must be smaller than or equal to 106.'); @@ -289,7 +380,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -301,6 +392,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -314,7 +406,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -330,7 +422,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -342,6 +434,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemOmnichannel.php b/lib/Model/ErrorItemOmnichannel.php index dd1cad6..afd0fc5 100644 --- a/lib/Model/ErrorItemOmnichannel.php +++ b/lib/Model/ErrorItemOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorItemOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -81,6 +79,25 @@ class ErrorItemOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializ 'source' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false, + 'source' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -195,10 +264,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['detail'] = $data['detail'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['source'] = $data['source'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('source', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -256,6 +343,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -280,6 +370,9 @@ public function getDetail() */ public function setDetail($detail) { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } $this->container['detail'] = $detail; return $this; @@ -304,6 +397,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -328,6 +424,16 @@ public function getSource() */ public function setSource($source) { + if (is_null($source)) { + array_push($this->openAPINullablesSetToNull, 'source'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('source', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['source'] = $source; return $this; @@ -339,7 +445,7 @@ public function setSource($source) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -351,6 +457,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -364,7 +471,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -380,7 +487,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -392,6 +499,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemPhonebook.php b/lib/Model/ErrorItemPhonebook.php index 8e0cb54..2a3b976 100644 --- a/lib/Model/ErrorItemPhonebook.php +++ b/lib/Model/ErrorItemPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorItemPhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class ErrorItemPhonebook implements ModelInterface, ArrayAccess, \JsonSerializab 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'detail' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['detail'] = $data['detail'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('detail', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -271,6 +360,9 @@ public function getDetail() */ public function setDetail($detail) { + if (is_null($detail)) { + throw new \InvalidArgumentException('non-nullable detail cannot be null'); + } $this->container['detail'] = $detail; return $this; @@ -295,6 +387,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -306,7 +401,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorItemStatistics.php b/lib/Model/ErrorItemStatistics.php index 1c794d4..d01b438 100644 --- a/lib/Model/ErrorItemStatistics.php +++ b/lib/Model/ErrorItemStatistics.php @@ -2,7 +2,7 @@ /** * ErrorItemStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class ErrorItemStatistics implements ModelInterface, ArrayAccess, \JsonSerializa 'code' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'title' => false, + 'details' => false, + 'code' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['title'] = $data['title'] ?? null; - $this->container['details'] = $data['details'] ?? null; - $this->container['code'] = $data['code'] ?? null; + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('details', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTitle() */ public function setTitle($title) { + if (is_null($title)) { + throw new \InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -271,6 +360,9 @@ public function getDetails() */ public function setDetails($details) { + if (is_null($details)) { + throw new \InvalidArgumentException('non-nullable details cannot be null'); + } $this->container['details'] = $details; return $this; @@ -295,6 +387,9 @@ public function getCode() */ public function setCode($code) { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -306,7 +401,7 @@ public function setCode($code) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorNumberLookup.php b/lib/Model/ErrorNumberLookup.php index 1e4d769..fce5576 100644 --- a/lib/Model/ErrorNumberLookup.php +++ b/lib/Model/ErrorNumberLookup.php @@ -2,7 +2,7 @@ /** * ErrorNumberLookup * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorNumberLookup implements ModelInterface, ArrayAccess, \JsonSerializabl 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorOmnichannel.php b/lib/Model/ErrorOmnichannel.php index ff18c12..d613256 100644 --- a/lib/Model/ErrorOmnichannel.php +++ b/lib/Model/ErrorOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorOmnichannel implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorPhonebook.php b/lib/Model/ErrorPhonebook.php index 6f5f502..4a42fb3 100644 --- a/lib/Model/ErrorPhonebook.php +++ b/lib/Model/ErrorPhonebook.php @@ -2,7 +2,7 @@ /** * ErrorPhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorPhonebook implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorStatistics.php b/lib/Model/ErrorStatistics.php index dec3d64..1c49519 100644 --- a/lib/Model/ErrorStatistics.php +++ b/lib/Model/ErrorStatistics.php @@ -2,7 +2,7 @@ /** * ErrorStatistics * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class ErrorStatistics implements ModelInterface, ArrayAccess, \JsonSerializable 'errors' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['errors'] = $data['errors'] ?? null; + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getErrors() */ public function setErrors($errors) { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } $this->container['errors'] = $errors; return $this; @@ -240,7 +327,7 @@ public function setErrors($errors) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ErrorTitleOmnichannel.php b/lib/Model/ErrorTitleOmnichannel.php index e5a0b6b..2538506 100644 --- a/lib/Model/ErrorTitleOmnichannel.php +++ b/lib/Model/ErrorTitleOmnichannel.php @@ -2,7 +2,7 @@ /** * ErrorTitleOmnichannel * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,19 +44,19 @@ class ErrorTitleOmnichannel /** * Possible values of this enum */ - const NOT_FOUND = 'Not found'; + public const NOT_FOUND = 'Not found'; - const FORBIDDEN = 'Forbidden'; + public const FORBIDDEN = 'Forbidden'; - const UNAUTHORIZED = 'Unauthorized'; + public const UNAUTHORIZED = 'Unauthorized'; - const INVALID_DATA = 'Invalid data'; + public const INVALID_DATA = 'Invalid data'; - const INTERNAL_SERVER_ERROR = 'Internal Server Error'; + public const INTERNAL_SERVER_ERROR = 'Internal Server Error'; - const MISSING_DATA = 'Missing data'; + public const MISSING_DATA = 'Missing data'; - const METHOD_NOT_ALLOWED = 'Method not allowed'; + public const METHOD_NOT_ALLOWED = 'Method not allowed'; /** * Gets allowable values of the enum diff --git a/lib/Model/ErrorTitlePhonebook.php b/lib/Model/ErrorTitlePhonebook.php index 5fe8354..e7c0305 100644 --- a/lib/Model/ErrorTitlePhonebook.php +++ b/lib/Model/ErrorTitlePhonebook.php @@ -2,7 +2,7 @@ /** * ErrorTitlePhonebook * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,17 +44,17 @@ class ErrorTitlePhonebook /** * Possible values of this enum */ - const INVALID_DATA = 'Invalid data'; + public const INVALID_DATA = 'Invalid data'; - const UNAUTHORIZED = 'Unauthorized'; + public const UNAUTHORIZED = 'Unauthorized'; - const MISSING_RESOURCE = 'Missing resource'; + public const MISSING_RESOURCE = 'Missing resource'; - const CONFLICT = 'Conflict'; + public const CONFLICT = 'Conflict'; - const CLIENT_ERROR = 'Client error'; + public const CLIENT_ERROR = 'Client error'; - const GENERAL_ERROR = 'General error'; + public const GENERAL_ERROR = 'General error'; /** * Gets allowable values of the enum diff --git a/lib/Model/FetchBlacklistSuccess.php b/lib/Model/FetchBlacklistSuccess.php index 55fe1a5..12fd322 100644 --- a/lib/Model/FetchBlacklistSuccess.php +++ b/lib/Model/FetchBlacklistSuccess.php @@ -2,7 +2,7 @@ /** * FetchBlacklistSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class FetchBlacklistSuccess implements ModelInterface, ArrayAccess, \JsonSeriali 'phoneNumbers' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumbers'] = $data['phoneNumbers'] ?? null; + $this->setIfExists('phoneNumbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getPhoneNumbers() */ public function setPhoneNumbers($phoneNumbers) { + if (is_null($phoneNumbers)) { + throw new \InvalidArgumentException('non-nullable phoneNumbers cannot be null'); + } $this->container['phoneNumbers'] = $phoneNumbers; @@ -239,7 +326,7 @@ public function setPhoneNumbers($phoneNumbers) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupEnvelope.php b/lib/Model/GroupEnvelope.php index d2fd51c..60a9d7b 100644 --- a/lib/Model/GroupEnvelope.php +++ b/lib/Model/GroupEnvelope.php @@ -2,7 +2,7 @@ /** * GroupEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable 'group' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'group' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('group', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getGroup() */ public function setGroup($group) { + if (is_null($group)) { + throw new \InvalidArgumentException('non-nullable group cannot be null'); + } $this->container['group'] = $group; return $this; @@ -237,7 +324,7 @@ public function setGroup($group) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -249,6 +336,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -262,7 +350,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -278,7 +366,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -290,6 +378,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupListEnvelope.php b/lib/Model/GroupListEnvelope.php index da5982b..b0fc28c 100644 --- a/lib/Model/GroupListEnvelope.php +++ b/lib/Model/GroupListEnvelope.php @@ -2,7 +2,7 @@ /** * GroupListEnvelope * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupListEnvelope implements ModelInterface, ArrayAccess, \JsonSerializabl 'groups' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'groups' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['groups'] = $data['groups'] ?? null; + $this->setIfExists('groups', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -226,6 +310,9 @@ public function getGroups() */ public function setGroups($groups) { + if (is_null($groups)) { + throw new \InvalidArgumentException('non-nullable groups cannot be null'); + } $this->container['groups'] = $groups; @@ -239,7 +326,7 @@ public function setGroups($groups) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -251,6 +338,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -264,7 +352,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -280,7 +368,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -292,6 +380,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupName.php b/lib/Model/GroupName.php index 5d6f31b..17725d9 100644 --- a/lib/Model/GroupName.php +++ b/lib/Model/GroupName.php @@ -2,7 +2,7 @@ /** * GroupName * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class GroupName implements ModelInterface, ArrayAccess, \JsonSerializable 'name' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -233,6 +317,9 @@ public function getName() */ public function setName($name) { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } if ((mb_strlen($name) < 1)) { throw new \InvalidArgumentException('invalid length for $name when calling GroupName., must be bigger than or equal to 1.'); @@ -249,7 +336,7 @@ public function setName($name) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -261,6 +348,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -274,7 +362,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -290,7 +378,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -302,6 +390,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/GroupResponseFields.php b/lib/Model/GroupResponseFields.php index 8da8935..e2632ba 100644 --- a/lib/Model/GroupResponseFields.php +++ b/lib/Model/GroupResponseFields.php @@ -2,7 +2,7 @@ /** * GroupResponseFields * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -81,6 +79,25 @@ class GroupResponseFields implements ModelInterface, ArrayAccess, \JsonSerializa 'contactsCount' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'name' => false, + 'createdOn' => true, + 'contactsCount' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -195,10 +264,28 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['createdOn'] = $data['createdOn'] ?? null; - $this->container['contactsCount'] = $data['contactsCount'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('createdOn', $data ?? [], null); + $this->setIfExists('contactsCount', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -253,6 +340,9 @@ public function getId() */ public function setId($id) { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -277,6 +367,9 @@ public function getName() */ public function setName($name) { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -301,6 +394,16 @@ public function getCreatedOn() */ public function setCreatedOn($createdOn) { + if (is_null($createdOn)) { + array_push($this->openAPINullablesSetToNull, 'createdOn'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('createdOn', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['createdOn'] = $createdOn; return $this; @@ -325,6 +428,9 @@ public function getContactsCount() */ public function setContactsCount($contactsCount) { + if (is_null($contactsCount)) { + throw new \InvalidArgumentException('non-nullable contactsCount cannot be null'); + } $this->container['contactsCount'] = $contactsCount; return $this; @@ -336,7 +442,7 @@ public function setContactsCount($contactsCount) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -348,6 +454,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -361,7 +468,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -377,7 +484,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -389,6 +496,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MessageResult.php b/lib/Model/MessageResult.php index 5955d04..1aa0a00 100644 --- a/lib/Model/MessageResult.php +++ b/lib/Model/MessageResult.php @@ -2,7 +2,7 @@ /** * MessageResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class MessageResult implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messageId' => false, + 'channel' => false, + 'sender' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['messageId'] = $data['messageId'] ?? null; - $this->container['channel'] = $data['channel'] ?? null; - $this->container['sender'] = $data['sender'] ?? null; + $this->setIfExists('messageId', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getMessageId() */ public function setMessageId($messageId) { + if (is_null($messageId)) { + throw new \InvalidArgumentException('non-nullable messageId cannot be null'); + } $this->container['messageId'] = $messageId; return $this; @@ -271,6 +360,9 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $this->container['channel'] = $channel; return $this; @@ -295,6 +387,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -306,7 +401,7 @@ public function setSender($sender) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/MobileNetwork.php b/lib/Model/MobileNetwork.php index 8309511..009d7f5 100644 --- a/lib/Model/MobileNetwork.php +++ b/lib/Model/MobileNetwork.php @@ -2,7 +2,7 @@ /** * MobileNetwork * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -83,6 +81,26 @@ class MobileNetwork implements ModelInterface, ArrayAccess, \JsonSerializable 'countryCode' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'mccmnc' => false, + 'networkName' => false, + 'countryName' => false, + 'countryPrefix' => false, + 'countryCode' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +121,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -200,11 +270,29 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['mccmnc'] = $data['mccmnc'] ?? null; - $this->container['networkName'] = $data['networkName'] ?? null; - $this->container['countryName'] = $data['countryName'] ?? null; - $this->container['countryPrefix'] = $data['countryPrefix'] ?? null; - $this->container['countryCode'] = $data['countryCode'] ?? null; + $this->setIfExists('mccmnc', $data ?? [], null); + $this->setIfExists('networkName', $data ?? [], null); + $this->setIfExists('countryName', $data ?? [], null); + $this->setIfExists('countryPrefix', $data ?? [], null); + $this->setIfExists('countryCode', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -250,6 +338,9 @@ public function getMccmnc() */ public function setMccmnc($mccmnc) { + if (is_null($mccmnc)) { + throw new \InvalidArgumentException('non-nullable mccmnc cannot be null'); + } $this->container['mccmnc'] = $mccmnc; return $this; @@ -274,6 +365,9 @@ public function getNetworkName() */ public function setNetworkName($networkName) { + if (is_null($networkName)) { + throw new \InvalidArgumentException('non-nullable networkName cannot be null'); + } $this->container['networkName'] = $networkName; return $this; @@ -298,6 +392,9 @@ public function getCountryName() */ public function setCountryName($countryName) { + if (is_null($countryName)) { + throw new \InvalidArgumentException('non-nullable countryName cannot be null'); + } $this->container['countryName'] = $countryName; return $this; @@ -322,6 +419,9 @@ public function getCountryPrefix() */ public function setCountryPrefix($countryPrefix) { + if (is_null($countryPrefix)) { + throw new \InvalidArgumentException('non-nullable countryPrefix cannot be null'); + } $this->container['countryPrefix'] = $countryPrefix; return $this; @@ -346,6 +446,9 @@ public function getCountryCode() */ public function setCountryCode($countryCode) { + if (is_null($countryCode)) { + throw new \InvalidArgumentException('non-nullable countryCode cannot be null'); + } $this->container['countryCode'] = $countryCode; return $this; @@ -357,7 +460,7 @@ public function setCountryCode($countryCode) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -369,6 +472,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -382,7 +486,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -398,7 +502,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -410,6 +514,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php index 672465c..da1a39e 100644 --- a/lib/Model/ModelInterface.php +++ b/lib/Model/ModelInterface.php @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api\Model @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -93,4 +93,20 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/lib/Model/NumberToBlacklist.php b/lib/Model/NumberToBlacklist.php index 59d996c..0c647b5 100644 --- a/lib/Model/NumberToBlacklist.php +++ b/lib/Model/NumberToBlacklist.php @@ -2,7 +2,7 @@ /** * NumberToBlacklist * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class NumberToBlacklist implements ModelInterface, ArrayAccess, \JsonSerializabl 'phoneNumber' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'phoneNumber' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['phoneNumber'] = $data['phoneNumber'] ?? null; + $this->setIfExists('phoneNumber', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getPhoneNumber() */ public function setPhoneNumber($phoneNumber) { + if (is_null($phoneNumber)) { + throw new \InvalidArgumentException('non-nullable phoneNumber cannot be null'); + } $this->container['phoneNumber'] = $phoneNumber; return $this; @@ -240,7 +327,7 @@ public function setPhoneNumber($phoneNumber) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/NumbersToInvestigate.php b/lib/Model/NumbersToInvestigate.php index 5f5b95c..fcdb632 100644 --- a/lib/Model/NumbersToInvestigate.php +++ b/lib/Model/NumbersToInvestigate.php @@ -2,7 +2,7 @@ /** * NumbersToInvestigate * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class NumbersToInvestigate implements ModelInterface, ArrayAccess, \JsonSerializ 'numbers' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'numbers' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['numbers'] = $data['numbers'] ?? null; + $this->setIfExists('numbers', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -237,6 +321,9 @@ public function getNumbers() */ public function setNumbers($numbers) { + if (is_null($numbers)) { + throw new \InvalidArgumentException('non-nullable numbers cannot be null'); + } if ((count($numbers) > 10)) { throw new \InvalidArgumentException('invalid value for $numbers when calling NumbersToInvestigate., number of items must be less than or equal to 10.'); @@ -255,7 +342,7 @@ public function setNumbers($numbers) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -267,6 +354,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -280,7 +368,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -296,7 +384,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,6 +396,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmniMessageCreateSuccessResponse.php b/lib/Model/OmniMessageCreateSuccessResponse.php index 387711d..51f9bf1 100644 --- a/lib/Model/OmniMessageCreateSuccessResponse.php +++ b/lib/Model/OmniMessageCreateSuccessResponse.php @@ -2,7 +2,7 @@ /** * OmniMessageCreateSuccessResponse * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class OmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \ 'omnimessageId' => 'UUID' ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false, + 'to' => false, + 'omnimessageId' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['messages'] = $data['messages'] ?? null; - $this->container['to'] = $data['to'] ?? null; - $this->container['omnimessageId'] = $data['omnimessageId'] ?? null; + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getMessages() */ public function setMessages($messages) { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } $this->container['messages'] = $messages; return $this; @@ -271,6 +360,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -295,6 +387,9 @@ public function getOmnimessageId() */ public function setOmnimessageId($omnimessageId) { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } $this->container['omnimessageId'] = $omnimessageId; return $this; @@ -306,7 +401,7 @@ public function setOmnimessageId($omnimessageId) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Omnimessage.php b/lib/Model/Omnimessage.php index f312944..873874f 100644 --- a/lib/Model/Omnimessage.php +++ b/lib/Model/Omnimessage.php @@ -2,7 +2,7 @@ /** * Omnimessage * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -62,7 +60,7 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $openAPITypes = [ 'to' => 'string', - 'messages' => 'OneOfViberSMSWhatsAppTelegram[]', + 'messages' => '\Messente\Api\Model\OmnimessageMessagesInner[]', 'dlrUrl' => 'string', 'textStore' => '\Messente\Api\Model\TextStore', 'timeToSend' => '\DateTime', @@ -85,6 +83,27 @@ class Omnimessage implements ModelInterface, ArrayAccess, \JsonSerializable 'priority' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'to' => false, + 'messages' => false, + 'dlrUrl' => false, + 'textStore' => false, + 'timeToSend' => false, + 'priority' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +124,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -205,12 +276,30 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['to'] = $data['to'] ?? null; - $this->container['messages'] = $data['messages'] ?? null; - $this->container['dlrUrl'] = $data['dlrUrl'] ?? null; - $this->container['textStore'] = $data['textStore'] ?? null; - $this->container['timeToSend'] = $data['timeToSend'] ?? null; - $this->container['priority'] = $data['priority'] ?? null; + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('dlrUrl', $data ?? [], null); + $this->setIfExists('textStore', $data ?? [], null); + $this->setIfExists('timeToSend', $data ?? [], null); + $this->setIfExists('priority', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -262,6 +351,9 @@ public function getTo() */ public function setTo($to) { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } $this->container['to'] = $to; return $this; @@ -270,7 +362,7 @@ public function setTo($to) /** * Gets messages * - * @return OneOfViberSMSWhatsAppTelegram[] + * @return \Messente\Api\Model\OmnimessageMessagesInner[] */ public function getMessages() { @@ -280,12 +372,15 @@ public function getMessages() /** * Sets messages * - * @param OneOfViberSMSWhatsAppTelegram[] $messages An array of messages + * @param \Messente\Api\Model\OmnimessageMessagesInner[] $messages An array of messages * * @return self */ public function setMessages($messages) { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } $this->container['messages'] = $messages; return $this; @@ -310,6 +405,9 @@ public function getDlrUrl() */ public function setDlrUrl($dlrUrl) { + if (is_null($dlrUrl)) { + throw new \InvalidArgumentException('non-nullable dlrUrl cannot be null'); + } $this->container['dlrUrl'] = $dlrUrl; return $this; @@ -334,6 +432,9 @@ public function getTextStore() */ public function setTextStore($textStore) { + if (is_null($textStore)) { + throw new \InvalidArgumentException('non-nullable textStore cannot be null'); + } $this->container['textStore'] = $textStore; return $this; @@ -358,6 +459,9 @@ public function getTimeToSend() */ public function setTimeToSend($timeToSend) { + if (is_null($timeToSend)) { + throw new \InvalidArgumentException('non-nullable timeToSend cannot be null'); + } $this->container['timeToSend'] = $timeToSend; return $this; @@ -382,6 +486,9 @@ public function getPriority() */ public function setPriority($priority) { + if (is_null($priority)) { + throw new \InvalidArgumentException('non-nullable priority cannot be null'); + } $this->container['priority'] = $priority; return $this; @@ -393,7 +500,7 @@ public function setPriority($priority) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -405,6 +512,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -418,7 +526,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -434,7 +542,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -446,6 +554,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/OmnimessageMessagesInner.php b/lib/Model/OmnimessageMessagesInner.php new file mode 100644 index 0000000..efdac3d --- /dev/null +++ b/lib/Model/OmnimessageMessagesInner.php @@ -0,0 +1,889 @@ + + */ +class OmnimessageMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Omnimessage_messages_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sender' => 'string', + 'validity' => 'int', + 'ttl' => 'int', + 'text' => 'string', + 'imageUrl' => 'string', + 'buttonUrl' => 'string', + 'buttonText' => 'string', + 'channel' => 'string', + 'autoconvert' => 'string', + 'udh' => 'string', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', + 'documentUrl' => 'string', + 'audioUrl' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sender' => null, + 'validity' => null, + 'ttl' => null, + 'text' => null, + 'imageUrl' => null, + 'buttonUrl' => null, + 'buttonText' => null, + 'channel' => null, + 'autoconvert' => null, + 'udh' => null, + 'template' => null, + 'documentUrl' => null, + 'audioUrl' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false, + 'autoconvert' => false, + 'udh' => false, + 'template' => false, + 'documentUrl' => false, + 'audioUrl' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sender' => 'sender', + 'validity' => 'validity', + 'ttl' => 'ttl', + 'text' => 'text', + 'imageUrl' => 'image_url', + 'buttonUrl' => 'button_url', + 'buttonText' => 'button_text', + 'channel' => 'channel', + 'autoconvert' => 'autoconvert', + 'udh' => 'udh', + 'template' => 'template', + 'documentUrl' => 'document_url', + 'audioUrl' => 'audio_url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sender' => 'setSender', + 'validity' => 'setValidity', + 'ttl' => 'setTtl', + 'text' => 'setText', + 'imageUrl' => 'setImageUrl', + 'buttonUrl' => 'setButtonUrl', + 'buttonText' => 'setButtonText', + 'channel' => 'setChannel', + 'autoconvert' => 'setAutoconvert', + 'udh' => 'setUdh', + 'template' => 'setTemplate', + 'documentUrl' => 'setDocumentUrl', + 'audioUrl' => 'setAudioUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sender' => 'getSender', + 'validity' => 'getValidity', + 'ttl' => 'getTtl', + 'text' => 'getText', + 'imageUrl' => 'getImageUrl', + 'buttonUrl' => 'getButtonUrl', + 'buttonText' => 'getButtonText', + 'channel' => 'getChannel', + 'autoconvert' => 'getAutoconvert', + 'udh' => 'getUdh', + 'template' => 'getTemplate', + 'documentUrl' => 'getDocumentUrl', + 'audioUrl' => 'getAudioUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const CHANNEL_TELEGRAM = 'telegram'; + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getChannelAllowableValues() + { + return [ + self::CHANNEL_TELEGRAM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAutoconvertAllowableValues() + { + return [ + self::AUTOCONVERT_FULL, + self::AUTOCONVERT_ON, + self::AUTOCONVERT_OFF, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['text'] === null) { + $invalidProperties[] = "'text' can't be null"; + } + $allowedValues = $this->getChannelAllowableValues(); + if (!is_null($this->container['channel']) && !in_array($this->container['channel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'channel', must be one of '%s'", + $this->container['channel'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!is_null($this->container['autoconvert']) && !in_array($this->container['autoconvert'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'autoconvert', must be one of '%s'", + $this->container['autoconvert'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets sender + * + * @return string|null + */ + public function getSender() + { + return $this->container['sender']; + } + + /** + * Sets sender + * + * @param string|null $sender Phone number or alphanumeric sender name + * + * @return self + */ + public function setSender($sender) + { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } + $this->container['sender'] = $sender; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity After how many minutes this channel is considered as failed and the next channel is attempted + * + * @return self + */ + public function setValidity($validity) + { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets ttl + * + * @return int|null + */ + public function getTtl() + { + return $this->container['ttl']; + } + + /** + * Sets ttl + * + * @param int|null $ttl After how many seconds this channel is considered as failed and the next channel is attempted. Only one of \"ttl\" and \"validity\" can be used. + * + * @return self + */ + public function setTtl($ttl) + { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } + $this->container['ttl'] = $ttl; + + return $this; + } + + /** + * Gets text + * + * @return string + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string $text Plaintext content for Telegram + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets imageUrl + * + * @return string|null + */ + public function getImageUrl() + { + return $this->container['imageUrl']; + } + + /** + * Sets imageUrl + * + * @param string|null $imageUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"audio_url\" + * + * @return self + */ + public function setImageUrl($imageUrl) + { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } + $this->container['imageUrl'] = $imageUrl; + + return $this; + } + + /** + * Gets buttonUrl + * + * @return string|null + */ + public function getButtonUrl() + { + return $this->container['buttonUrl']; + } + + /** + * Sets buttonUrl + * + * @param string|null $buttonUrl URL of the button, must be specified along with ''text'', ''button_text'' and ''image_url'' (optional) + * + * @return self + */ + public function setButtonUrl($buttonUrl) + { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } + $this->container['buttonUrl'] = $buttonUrl; + + return $this; + } + + /** + * Gets buttonText + * + * @return string|null + */ + public function getButtonText() + { + return $this->container['buttonText']; + } + + /** + * Sets buttonText + * + * @param string|null $buttonText Must be specified along with ''text'', ''button_url'', ''button_text'', ''image_url'' (optional) + * + * @return self + */ + public function setButtonText($buttonText) + { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } + $this->container['buttonText'] = $buttonText; + + return $this; + } + + /** + * Gets channel + * + * @return string|null + */ + public function getChannel() + { + return $this->container['channel']; + } + + /** + * Sets channel + * + * @param string|null $channel The channel used to deliver the message + * + * @return self + */ + public function setChannel($channel) + { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } + $allowedValues = $this->getChannelAllowableValues(); + if (!in_array($channel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'channel', must be one of '%s'", + $channel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['channel'] = $channel; + + return $this; + } + + /** + * Gets autoconvert + * + * @return string|null + */ + public function getAutoconvert() + { + return $this->container['autoconvert']; + } + + /** + * Sets autoconvert + * + * @param string|null $autoconvert Defines how non-GSM characters will be treated: - \"on\" Use replacement settings from the account's [API Auto Replace settings page](https://dashboard.messente.com/api-settings/auto-replace) (default) - \"full\" All non GSM 03.38 characters will be replaced with suitable alternatives - \"off\" Message content is not modified in any way + * + * @return self + */ + public function setAutoconvert($autoconvert) + { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } + $allowedValues = $this->getAutoconvertAllowableValues(); + if (!in_array($autoconvert, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'autoconvert', must be one of '%s'", + $autoconvert, + implode("', '", $allowedValues) + ) + ); + } + $this->container['autoconvert'] = $autoconvert; + + return $this; + } + + /** + * Gets udh + * + * @return string|null + */ + public function getUdh() + { + return $this->container['udh']; + } + + /** + * Sets udh + * + * @param string|null $udh hex-encoded string containing SMS UDH + * + * @return self + */ + public function setUdh($udh) + { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } + $this->container['udh'] = $udh; + + return $this; + } + + /** + * Gets template + * + * @return \Messente\Api\Model\WhatsAppTemplate|null + */ + public function getTemplate() + { + return $this->container['template']; + } + + /** + * Sets template + * + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template + * + * @return self + */ + public function setTemplate($template) + { + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } + $this->container['template'] = $template; + + return $this; + } + + /** + * Gets documentUrl + * + * @return string|null + */ + public function getDocumentUrl() + { + return $this->container['documentUrl']; + } + + /** + * Sets documentUrl + * + * @param string|null $documentUrl URL for the embedded image. Mutually exclusive with \"audio_url\" and \"image_url\" + * + * @return self + */ + public function setDocumentUrl($documentUrl) + { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } + $this->container['documentUrl'] = $documentUrl; + + return $this; + } + + /** + * Gets audioUrl + * + * @return string|null + */ + public function getAudioUrl() + { + return $this->container['audioUrl']; + } + + /** + * Sets audioUrl + * + * @param string|null $audioUrl URL for the embedded image. Mutually exclusive with \"document_url\" and \"image_url\" + * + * @return self + */ + public function setAudioUrl($audioUrl) + { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } + $this->container['audioUrl'] = $audioUrl; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Priority.php b/lib/Model/Priority.php index 609f6b5..716c782 100644 --- a/lib/Model/Priority.php +++ b/lib/Model/Priority.php @@ -2,7 +2,7 @@ /** * Priority * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,11 +44,11 @@ class Priority /** * Possible values of this enum */ - const LOW = 'low'; + public const LOW = 'low'; - const REGULAR = 'regular'; + public const REGULAR = 'regular'; - const HIGH = 'high'; + public const HIGH = 'high'; /** * Gets allowable values of the enum diff --git a/lib/Model/SMS.php b/lib/Model/SMS.php index 44acc1c..20c3614 100644 --- a/lib/Model/SMS.php +++ b/lib/Model/SMS.php @@ -2,7 +2,7 @@ /** * SMS * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -87,6 +85,28 @@ class SMS implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'text' => false, + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'autoconvert' => false, + 'udh' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -107,6 +127,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -194,10 +266,10 @@ public function getModelName() return self::$openAPIModelName; } - const AUTOCONVERT_FULL = 'full'; - const AUTOCONVERT_ON = 'on'; - const AUTOCONVERT_OFF = 'off'; - const CHANNEL_SMS = 'sms'; + public const AUTOCONVERT_FULL = 'full'; + public const AUTOCONVERT_ON = 'on'; + public const AUTOCONVERT_OFF = 'off'; + public const CHANNEL_SMS = 'sms'; /** * Gets allowable values of the enum @@ -240,13 +312,31 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['text'] = $data['text'] ?? null; - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['autoconvert'] = $data['autoconvert'] ?? null; - $this->container['udh'] = $data['udh'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'sms'; + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('autoconvert', $data ?? [], null); + $this->setIfExists('udh', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'sms'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -313,6 +403,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -337,6 +430,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -361,6 +457,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -385,6 +484,9 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; @@ -409,8 +511,11 @@ public function getAutoconvert() */ public function setAutoconvert($autoconvert) { + if (is_null($autoconvert)) { + throw new \InvalidArgumentException('non-nullable autoconvert cannot be null'); + } $allowedValues = $this->getAutoconvertAllowableValues(); - if (!is_null($autoconvert) && !in_array($autoconvert, $allowedValues, true)) { + if (!in_array($autoconvert, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'autoconvert', must be one of '%s'", @@ -443,6 +548,9 @@ public function getUdh() */ public function setUdh($udh) { + if (is_null($udh)) { + throw new \InvalidArgumentException('non-nullable udh cannot be null'); + } $this->container['udh'] = $udh; return $this; @@ -467,8 +575,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -488,7 +599,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -500,6 +611,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -513,7 +625,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -529,7 +641,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -541,6 +653,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReport.php b/lib/Model/StatisticsReport.php index 3e7d658..92e1647 100644 --- a/lib/Model/StatisticsReport.php +++ b/lib/Model/StatisticsReport.php @@ -2,7 +2,7 @@ /** * StatisticsReport * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class StatisticsReport implements ModelInterface, ArrayAccess, \JsonSerializable 'country' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'totalMessages' => false, + 'totalPrice' => false, + 'country' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['totalMessages'] = $data['totalMessages'] ?? null; - $this->container['totalPrice'] = $data['totalPrice'] ?? null; - $this->container['country'] = $data['country'] ?? null; + $this->setIfExists('totalMessages', $data ?? [], null); + $this->setIfExists('totalPrice', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -247,6 +333,9 @@ public function getTotalMessages() */ public function setTotalMessages($totalMessages) { + if (is_null($totalMessages)) { + throw new \InvalidArgumentException('non-nullable totalMessages cannot be null'); + } $this->container['totalMessages'] = $totalMessages; return $this; @@ -271,6 +360,9 @@ public function getTotalPrice() */ public function setTotalPrice($totalPrice) { + if (is_null($totalPrice)) { + throw new \InvalidArgumentException('non-nullable totalPrice cannot be null'); + } $this->container['totalPrice'] = $totalPrice; return $this; @@ -295,6 +387,9 @@ public function getCountry() */ public function setCountry($country) { + if (is_null($country)) { + throw new \InvalidArgumentException('non-nullable country cannot be null'); + } $this->container['country'] = $country; return $this; @@ -306,7 +401,7 @@ public function setCountry($country) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -318,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -331,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -347,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -359,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSettings.php b/lib/Model/StatisticsReportSettings.php index 74991c1..3d6ab50 100644 --- a/lib/Model/StatisticsReportSettings.php +++ b/lib/Model/StatisticsReportSettings.php @@ -2,7 +2,7 @@ /** * StatisticsReportSettings * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -79,6 +77,24 @@ class StatisticsReportSettings implements ModelInterface, ArrayAccess, \JsonSeri 'messageTypes' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'startDate' => false, + 'endDate' => false, + 'messageTypes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -190,9 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['startDate'] = $data['startDate'] ?? null; - $this->container['endDate'] = $data['endDate'] ?? null; - $this->container['messageTypes'] = $data['messageTypes'] ?? null; + $this->setIfExists('startDate', $data ?? [], null); + $this->setIfExists('endDate', $data ?? [], null); + $this->setIfExists('messageTypes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -244,6 +330,9 @@ public function getStartDate() */ public function setStartDate($startDate) { + if (is_null($startDate)) { + throw new \InvalidArgumentException('non-nullable startDate cannot be null'); + } $this->container['startDate'] = $startDate; return $this; @@ -268,6 +357,9 @@ public function getEndDate() */ public function setEndDate($endDate) { + if (is_null($endDate)) { + throw new \InvalidArgumentException('non-nullable endDate cannot be null'); + } $this->container['endDate'] = $endDate; return $this; @@ -292,6 +384,9 @@ public function getMessageTypes() */ public function setMessageTypes($messageTypes) { + if (is_null($messageTypes)) { + throw new \InvalidArgumentException('non-nullable messageTypes cannot be null'); + } $this->container['messageTypes'] = $messageTypes; return $this; @@ -303,7 +398,7 @@ public function setMessageTypes($messageTypes) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -315,6 +410,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -328,7 +424,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -344,7 +440,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -356,6 +452,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/StatisticsReportSuccess.php b/lib/Model/StatisticsReportSuccess.php index 0178992..9fd94d0 100644 --- a/lib/Model/StatisticsReportSuccess.php +++ b/lib/Model/StatisticsReportSuccess.php @@ -2,7 +2,7 @@ /** * StatisticsReportSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -75,6 +73,22 @@ class StatisticsReportSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'reports' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'reports' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -180,7 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['reports'] = $data['reports'] ?? null; + $this->setIfExists('reports', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -229,6 +313,9 @@ public function getReports() */ public function setReports($reports) { + if (is_null($reports)) { + throw new \InvalidArgumentException('non-nullable reports cannot be null'); + } $this->container['reports'] = $reports; return $this; @@ -240,7 +327,7 @@ public function setReports($reports) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Status.php b/lib/Model/Status.php index dcfbfeb..1fd018f 100644 --- a/lib/Model/Status.php +++ b/lib/Model/Status.php @@ -2,7 +2,7 @@ /** * Status * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,27 +44,27 @@ class Status /** * Possible values of this enum */ - const ACK = 'ACK'; + public const ACK = 'ACK'; - const DELIVRD = 'DELIVRD'; + public const DELIVRD = 'DELIVRD'; - const UNDELIV = 'UNDELIV'; + public const UNDELIV = 'UNDELIV'; - const FAILED = 'FAILED'; + public const FAILED = 'FAILED'; - const UNKNOWN = 'UNKNOWN'; + public const UNKNOWN = 'UNKNOWN'; - const ACCEPTD = 'ACCEPTD'; + public const ACCEPTD = 'ACCEPTD'; - const REJECTD = 'REJECTD'; + public const REJECTD = 'REJECTD'; - const DELETED = 'DELETED'; + public const DELETED = 'DELETED'; - const EXPIRED = 'EXPIRED'; + public const EXPIRED = 'EXPIRED'; - const NACK = 'NACK'; + public const NACK = 'NACK'; - const SEEN = 'SEEN'; + public const SEEN = 'SEEN'; /** * Gets allowable values of the enum diff --git a/lib/Model/SyncNumberLookupResult.php b/lib/Model/SyncNumberLookupResult.php index 15f25c9..a291c18 100644 --- a/lib/Model/SyncNumberLookupResult.php +++ b/lib/Model/SyncNumberLookupResult.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupResult * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -91,6 +89,30 @@ class SyncNumberLookupResult implements ModelInterface, ArrayAccess, \JsonSerial 'error' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'roaming' => true, + 'ported' => true, + 'roamingNetwork' => true, + 'currentNetwork' => true, + 'originalNetwork' => true, + 'portedNetwork' => true, + 'status' => false, + 'error' => true + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -111,6 +133,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -204,10 +278,10 @@ public function getModelName() return self::$openAPIModelName; } - const STATUS_ON = 'ON'; - const STATUS_OFF = 'OFF'; - const STATUS_INVALID = 'INVALID'; - const STATUS_UNKNOWN = 'UNKNOWN'; + public const STATUS_ON = 'ON'; + public const STATUS_OFF = 'OFF'; + public const STATUS_INVALID = 'INVALID'; + public const STATUS_UNKNOWN = 'UNKNOWN'; /** * Gets allowable values of the enum @@ -239,15 +313,33 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; - $this->container['roaming'] = $data['roaming'] ?? null; - $this->container['ported'] = $data['ported'] ?? null; - $this->container['roamingNetwork'] = $data['roamingNetwork'] ?? null; - $this->container['currentNetwork'] = $data['currentNetwork'] ?? null; - $this->container['originalNetwork'] = $data['originalNetwork'] ?? null; - $this->container['portedNetwork'] = $data['portedNetwork'] ?? null; - $this->container['status'] = $data['status'] ?? null; - $this->container['error'] = $data['error'] ?? null; + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('roaming', $data ?? [], null); + $this->setIfExists('ported', $data ?? [], null); + $this->setIfExists('roamingNetwork', $data ?? [], null); + $this->setIfExists('currentNetwork', $data ?? [], null); + $this->setIfExists('originalNetwork', $data ?? [], null); + $this->setIfExists('portedNetwork', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -305,6 +397,9 @@ public function getNumber() */ public function setNumber($number) { + if (is_null($number)) { + throw new \InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -329,6 +424,16 @@ public function getRoaming() */ public function setRoaming($roaming) { + if (is_null($roaming)) { + array_push($this->openAPINullablesSetToNull, 'roaming'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roaming', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['roaming'] = $roaming; return $this; @@ -353,6 +458,16 @@ public function getPorted() */ public function setPorted($ported) { + if (is_null($ported)) { + array_push($this->openAPINullablesSetToNull, 'ported'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('ported', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['ported'] = $ported; return $this; @@ -377,6 +492,16 @@ public function getRoamingNetwork() */ public function setRoamingNetwork($roamingNetwork) { + if (is_null($roamingNetwork)) { + array_push($this->openAPINullablesSetToNull, 'roamingNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('roamingNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['roamingNetwork'] = $roamingNetwork; return $this; @@ -401,6 +526,16 @@ public function getCurrentNetwork() */ public function setCurrentNetwork($currentNetwork) { + if (is_null($currentNetwork)) { + array_push($this->openAPINullablesSetToNull, 'currentNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('currentNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['currentNetwork'] = $currentNetwork; return $this; @@ -425,6 +560,16 @@ public function getOriginalNetwork() */ public function setOriginalNetwork($originalNetwork) { + if (is_null($originalNetwork)) { + array_push($this->openAPINullablesSetToNull, 'originalNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('originalNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['originalNetwork'] = $originalNetwork; return $this; @@ -449,6 +594,16 @@ public function getPortedNetwork() */ public function setPortedNetwork($portedNetwork) { + if (is_null($portedNetwork)) { + array_push($this->openAPINullablesSetToNull, 'portedNetwork'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('portedNetwork', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['portedNetwork'] = $portedNetwork; return $this; @@ -473,8 +628,11 @@ public function getStatus() */ public function setStatus($status) { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { + if (!in_array($status, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'status', must be one of '%s'", @@ -507,6 +665,16 @@ public function getError() */ public function setError($error) { + if (is_null($error)) { + array_push($this->openAPINullablesSetToNull, 'error'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('error', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['error'] = $error; return $this; @@ -518,7 +686,7 @@ public function setError($error) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -530,6 +698,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -543,7 +712,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -559,7 +728,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -571,6 +740,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/SyncNumberLookupSuccess.php b/lib/Model/SyncNumberLookupSuccess.php index c00b889..95b8e82 100644 --- a/lib/Model/SyncNumberLookupSuccess.php +++ b/lib/Model/SyncNumberLookupSuccess.php @@ -2,7 +2,7 @@ /** * SyncNumberLookupSuccess * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -77,6 +75,23 @@ class SyncNumberLookupSuccess implements ModelInterface, ArrayAccess, \JsonSeria 'result' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'requestId' => false, + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['requestId'] = $data['requestId'] ?? null; - $this->container['result'] = $data['result'] ?? null; + $this->setIfExists('requestId', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -238,6 +323,9 @@ public function getRequestId() */ public function setRequestId($requestId) { + if (is_null($requestId)) { + throw new \InvalidArgumentException('non-nullable requestId cannot be null'); + } $this->container['requestId'] = $requestId; return $this; @@ -262,6 +350,9 @@ public function getResult() */ public function setResult($result) { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } $this->container['result'] = $result; return $this; @@ -273,7 +364,7 @@ public function setResult($result) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,6 +376,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -298,7 +390,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -314,7 +406,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -326,6 +418,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/Telegram.php b/lib/Model/Telegram.php index f033906..438ca6f 100644 --- a/lib/Model/Telegram.php +++ b/lib/Model/Telegram.php @@ -2,7 +2,7 @@ /** * Telegram * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -87,6 +85,28 @@ class Telegram implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'text' => false, + 'imageUrl' => false, + 'documentUrl' => false, + 'audioUrl' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -107,6 +127,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -194,7 +266,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_TELEGRAM = 'telegram'; + public const CHANNEL_TELEGRAM = 'telegram'; /** * Gets allowable values of the enum @@ -223,13 +295,31 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['imageUrl'] = $data['imageUrl'] ?? null; - $this->container['documentUrl'] = $data['documentUrl'] ?? null; - $this->container['audioUrl'] = $data['audioUrl'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'telegram'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('documentUrl', $data ?? [], null); + $this->setIfExists('audioUrl', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'telegram'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -284,6 +374,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -308,6 +401,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -332,6 +428,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -356,6 +455,9 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -380,6 +482,9 @@ public function getDocumentUrl() */ public function setDocumentUrl($documentUrl) { + if (is_null($documentUrl)) { + throw new \InvalidArgumentException('non-nullable documentUrl cannot be null'); + } $this->container['documentUrl'] = $documentUrl; return $this; @@ -404,6 +509,9 @@ public function getAudioUrl() */ public function setAudioUrl($audioUrl) { + if (is_null($audioUrl)) { + throw new \InvalidArgumentException('non-nullable audioUrl cannot be null'); + } $this->container['audioUrl'] = $audioUrl; return $this; @@ -428,8 +536,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -449,7 +560,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -461,6 +572,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -474,7 +586,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -490,7 +602,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -502,6 +614,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/TextStore.php b/lib/Model/TextStore.php index e06dd53..ad7e107 100644 --- a/lib/Model/TextStore.php +++ b/lib/Model/TextStore.php @@ -2,7 +2,7 @@ /** * TextStore * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -44,11 +44,11 @@ class TextStore /** * Possible values of this enum */ - const NOSTORE = 'nostore'; + public const NOSTORE = 'nostore'; - const PLAINTEXT = 'plaintext'; + public const PLAINTEXT = 'plaintext'; - const SHA256 = 'sha256'; + public const SHA256 = 'sha256'; /** * Gets allowable values of the enum diff --git a/lib/Model/Viber.php b/lib/Model/Viber.php index 0447d57..af4db61 100644 --- a/lib/Model/Viber.php +++ b/lib/Model/Viber.php @@ -2,7 +2,7 @@ /** * Viber * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -89,6 +87,29 @@ class Viber implements ModelInterface, ArrayAccess, \JsonSerializable 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'text' => false, + 'imageUrl' => false, + 'buttonUrl' => false, + 'buttonText' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -109,6 +130,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -199,7 +272,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_VIBER = 'viber'; + public const CHANNEL_VIBER = 'viber'; /** * Gets allowable values of the enum @@ -228,14 +301,32 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['imageUrl'] = $data['imageUrl'] ?? null; - $this->container['buttonUrl'] = $data['buttonUrl'] ?? null; - $this->container['buttonText'] = $data['buttonText'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'viber'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('imageUrl', $data ?? [], null); + $this->setIfExists('buttonUrl', $data ?? [], null); + $this->setIfExists('buttonText', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'viber'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -290,6 +381,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -314,6 +408,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -338,6 +435,9 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; @@ -362,6 +462,9 @@ public function getText() */ public function setText($text) { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } $this->container['text'] = $text; return $this; @@ -386,6 +489,9 @@ public function getImageUrl() */ public function setImageUrl($imageUrl) { + if (is_null($imageUrl)) { + throw new \InvalidArgumentException('non-nullable imageUrl cannot be null'); + } $this->container['imageUrl'] = $imageUrl; return $this; @@ -410,6 +516,9 @@ public function getButtonUrl() */ public function setButtonUrl($buttonUrl) { + if (is_null($buttonUrl)) { + throw new \InvalidArgumentException('non-nullable buttonUrl cannot be null'); + } $this->container['buttonUrl'] = $buttonUrl; return $this; @@ -434,6 +543,9 @@ public function getButtonText() */ public function setButtonText($buttonText) { + if (is_null($buttonText)) { + throw new \InvalidArgumentException('non-nullable buttonText cannot be null'); + } $this->container['buttonText'] = $buttonText; return $this; @@ -458,8 +570,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -479,7 +594,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -491,6 +606,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -504,7 +620,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -520,7 +636,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -532,6 +648,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsApp.php b/lib/Model/WhatsApp.php index d55da7a..ae2ef73 100644 --- a/lib/Model/WhatsApp.php +++ b/lib/Model/WhatsApp.php @@ -2,7 +2,7 @@ /** * WhatsApp * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -40,9 +40,7 @@ * @package Messente\Api * @author OpenAPI Generator team * @link https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable { @@ -64,10 +62,7 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => 'string', 'validity' => 'int', 'ttl' => 'int', - 'text' => '\Messente\Api\Model\WhatsAppText', - 'image' => '\Messente\Api\Model\WhatsAppImage', - 'document' => '\Messente\Api\Model\WhatsAppDocument', - 'audio' => '\Messente\Api\Model\WhatsAppAudio', + 'template' => '\Messente\Api\Model\WhatsAppTemplate', 'channel' => 'string' ]; @@ -82,13 +77,30 @@ class WhatsApp implements ModelInterface, ArrayAccess, \JsonSerializable 'sender' => null, 'validity' => null, 'ttl' => null, - 'text' => null, - 'image' => null, - 'document' => null, - 'audio' => null, + 'template' => null, 'channel' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'sender' => false, + 'validity' => false, + 'ttl' => false, + 'template' => false, + 'channel' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -109,6 +121,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -119,10 +183,7 @@ public static function openAPIFormats() 'sender' => 'sender', 'validity' => 'validity', 'ttl' => 'ttl', - 'text' => 'text', - 'image' => 'image', - 'document' => 'document', - 'audio' => 'audio', + 'template' => 'template', 'channel' => 'channel' ]; @@ -135,10 +196,7 @@ public static function openAPIFormats() 'sender' => 'setSender', 'validity' => 'setValidity', 'ttl' => 'setTtl', - 'text' => 'setText', - 'image' => 'setImage', - 'document' => 'setDocument', - 'audio' => 'setAudio', + 'template' => 'setTemplate', 'channel' => 'setChannel' ]; @@ -151,10 +209,7 @@ public static function openAPIFormats() 'sender' => 'getSender', 'validity' => 'getValidity', 'ttl' => 'getTtl', - 'text' => 'getText', - 'image' => 'getImage', - 'document' => 'getDocument', - 'audio' => 'getAudio', + 'template' => 'getTemplate', 'channel' => 'getChannel' ]; @@ -199,7 +254,7 @@ public function getModelName() return self::$openAPIModelName; } - const CHANNEL_WHATSAPP = 'whatsapp'; + public const CHANNEL_WHATSAPP = 'whatsapp'; /** * Gets allowable values of the enum @@ -228,14 +283,29 @@ public function getChannelAllowableValues() */ public function __construct(array $data = null) { - $this->container['sender'] = $data['sender'] ?? null; - $this->container['validity'] = $data['validity'] ?? null; - $this->container['ttl'] = $data['ttl'] ?? null; - $this->container['text'] = $data['text'] ?? null; - $this->container['image'] = $data['image'] ?? null; - $this->container['document'] = $data['document'] ?? null; - $this->container['audio'] = $data['audio'] ?? null; - $this->container['channel'] = $data['channel'] ?? 'whatsapp'; + $this->setIfExists('sender', $data ?? [], null); + $this->setIfExists('validity', $data ?? [], null); + $this->setIfExists('ttl', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('channel', $data ?? [], 'whatsapp'); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -290,6 +360,9 @@ public function getSender() */ public function setSender($sender) { + if (is_null($sender)) { + throw new \InvalidArgumentException('non-nullable sender cannot be null'); + } $this->container['sender'] = $sender; return $this; @@ -314,6 +387,9 @@ public function getValidity() */ public function setValidity($validity) { + if (is_null($validity)) { + throw new \InvalidArgumentException('non-nullable validity cannot be null'); + } $this->container['validity'] = $validity; return $this; @@ -338,103 +414,37 @@ public function getTtl() */ public function setTtl($ttl) { + if (is_null($ttl)) { + throw new \InvalidArgumentException('non-nullable ttl cannot be null'); + } $this->container['ttl'] = $ttl; return $this; } /** - * Gets text + * Gets template * - * @return \Messente\Api\Model\WhatsAppText|null + * @return \Messente\Api\Model\WhatsAppTemplate|null */ - public function getText() + public function getTemplate() { - return $this->container['text']; + return $this->container['template']; } /** - * Sets text + * Sets template * - * @param \Messente\Api\Model\WhatsAppText|null $text text + * @param \Messente\Api\Model\WhatsAppTemplate|null $template template * * @return self */ - public function setText($text) + public function setTemplate($template) { - $this->container['text'] = $text; - - return $this; - } - - /** - * Gets image - * - * @return \Messente\Api\Model\WhatsAppImage|null - */ - public function getImage() - { - return $this->container['image']; - } - - /** - * Sets image - * - * @param \Messente\Api\Model\WhatsAppImage|null $image image - * - * @return self - */ - public function setImage($image) - { - $this->container['image'] = $image; - - return $this; - } - - /** - * Gets document - * - * @return \Messente\Api\Model\WhatsAppDocument|null - */ - public function getDocument() - { - return $this->container['document']; - } - - /** - * Sets document - * - * @param \Messente\Api\Model\WhatsAppDocument|null $document document - * - * @return self - */ - public function setDocument($document) - { - $this->container['document'] = $document; - - return $this; - } - - /** - * Gets audio - * - * @return \Messente\Api\Model\WhatsAppAudio|null - */ - public function getAudio() - { - return $this->container['audio']; - } - - /** - * Sets audio - * - * @param \Messente\Api\Model\WhatsAppAudio|null $audio audio - * - * @return self - */ - public function setAudio($audio) - { - $this->container['audio'] = $audio; + if (is_null($template)) { + throw new \InvalidArgumentException('non-nullable template cannot be null'); + } + $this->container['template'] = $template; return $this; } @@ -458,8 +468,11 @@ public function getChannel() */ public function setChannel($channel) { + if (is_null($channel)) { + throw new \InvalidArgumentException('non-nullable channel cannot be null'); + } $allowedValues = $this->getChannelAllowableValues(); - if (!is_null($channel) && !in_array($channel, $allowedValues, true)) { + if (!in_array($channel, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for 'channel', must be one of '%s'", @@ -479,7 +492,7 @@ public function setChannel($channel) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -491,6 +504,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -504,7 +518,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -520,7 +534,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -532,6 +546,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppComponent.php b/lib/Model/WhatsAppComponent.php new file mode 100644 index 0000000..630b72b --- /dev/null +++ b/lib/Model/WhatsAppComponent.php @@ -0,0 +1,516 @@ + + */ +class WhatsAppComponent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppComponent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'subType' => 'string', + 'index' => 'int', + 'parameters' => '\Messente\Api\Model\WhatsAppParameter[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'subType' => null, + 'index' => null, + 'parameters' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'subType' => false, + 'index' => false, + 'parameters' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'subType' => 'sub_type', + 'index' => 'index', + 'parameters' => 'parameters' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'subType' => 'setSubType', + 'index' => 'setIndex', + 'parameters' => 'setParameters' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'subType' => 'getSubType', + 'index' => 'getIndex', + 'parameters' => 'getParameters' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('subType', $data ?? [], null); + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('parameters', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of the component + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets subType + * + * @return string|null + */ + public function getSubType() + { + return $this->container['subType']; + } + + /** + * Sets subType + * + * @param string|null $subType Sub-type of the component + * + * @return self + */ + public function setSubType($subType) + { + if (is_null($subType)) { + throw new \InvalidArgumentException('non-nullable subType cannot be null'); + } + $this->container['subType'] = $subType; + + return $this; + } + + /** + * Gets index + * + * @return int|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int|null $index index used to position buttons + * + * @return self + */ + public function setIndex($index) + { + if (is_null($index)) { + throw new \InvalidArgumentException('non-nullable index cannot be null'); + } + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets parameters + * + * @return \Messente\Api\Model\WhatsAppParameter[]|null + */ + public function getParameters() + { + return $this->container['parameters']; + } + + /** + * Sets parameters + * + * @param \Messente\Api\Model\WhatsAppParameter[]|null $parameters List of parameters for the component + * + * @return self + */ + public function setParameters($parameters) + { + if (is_null($parameters)) { + throw new \InvalidArgumentException('non-nullable parameters cannot be null'); + } + $this->container['parameters'] = $parameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppAudio.php b/lib/Model/WhatsAppCurrency.php similarity index 52% rename from lib/Model/WhatsAppAudio.php rename to lib/Model/WhatsAppCurrency.php index eb67bc9..c44abd7 100644 --- a/lib/Model/WhatsAppAudio.php +++ b/lib/Model/WhatsAppCurrency.php @@ -1,8 +1,8 @@ - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ -class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppCurrency implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -53,7 +51,7 @@ class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppAudio'; + protected static $openAPIModelName = 'WhatsAppCurrency'; /** * Array of property to type mappings. Used for (de)serialization @@ -61,7 +59,9 @@ class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'content' => 'string' + 'fallbackValue' => 'string', + 'code' => 'string', + 'amount1000' => 'string' ]; /** @@ -72,9 +72,29 @@ class WhatsAppAudio implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'content' => null + 'fallbackValue' => null, + 'code' => null, + 'amount1000' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fallbackValue' => false, + 'code' => false, + 'amount1000' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -102,7 +174,9 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'content' => 'content' + 'fallbackValue' => 'fallback_value', + 'code' => 'code', + 'amount1000' => 'amount_1000' ]; /** @@ -111,7 +185,9 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'content' => 'setContent' + 'fallbackValue' => 'setFallbackValue', + 'code' => 'setCode', + 'amount1000' => 'setAmount1000' ]; /** @@ -120,7 +196,9 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'content' => 'getContent' + 'fallbackValue' => 'getFallbackValue', + 'code' => 'getCode', + 'amount1000' => 'getAmount1000' ]; /** @@ -180,7 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['content'] = $data['content'] ?? null; + $this->setIfExists('fallbackValue', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('amount1000', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -192,8 +290,14 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['fallbackValue'] === null) { + $invalidProperties[] = "'fallbackValue' can't be null"; + } + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; + } + if ($this->container['amount1000'] === null) { + $invalidProperties[] = "'amount1000' can't be null"; } return $invalidProperties; } @@ -211,25 +315,82 @@ public function valid() /** - * Gets content + * Gets fallbackValue + * + * @return string + */ + public function getFallbackValue() + { + return $this->container['fallbackValue']; + } + + /** + * Sets fallbackValue + * + * @param string $fallbackValue Default text if localization fails. + * + * @return self + */ + public function setFallbackValue($fallbackValue) + { + if (is_null($fallbackValue)) { + throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); + } + $this->container['fallbackValue'] = $fallbackValue; + + return $this; + } + + /** + * Gets code + * + * @return string + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string $code Currency code as defined in ISO 4217. + * + * @return self + */ + public function setCode($code) + { + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets amount1000 * * @return string */ - public function getContent() + public function getAmount1000() { - return $this->container['content']; + return $this->container['amount1000']; } /** - * Sets content + * Sets amount1000 * - * @param string $content Base64-encoded audio + * @param string $amount1000 Amount multiplied by 1000. * * @return self */ - public function setContent($content) + public function setAmount1000($amount1000) { - $this->container['content'] = $content; + if (is_null($amount1000)) { + throw new \InvalidArgumentException('non-nullable amount1000 cannot be null'); + } + $this->container['amount1000'] = $amount1000; return $this; } @@ -240,7 +401,7 @@ public function setContent($content) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -252,6 +413,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -265,7 +427,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -281,7 +443,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -293,6 +455,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppDocument.php b/lib/Model/WhatsAppDatetime.php similarity index 63% rename from lib/Model/WhatsAppDocument.php rename to lib/Model/WhatsAppDatetime.php index fe15f48..063cd68 100644 --- a/lib/Model/WhatsAppDocument.php +++ b/lib/Model/WhatsAppDatetime.php @@ -1,8 +1,8 @@ - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ -class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppDatetime implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -53,7 +51,7 @@ class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppDocument'; + protected static $openAPIModelName = 'WhatsAppDatetime'; /** * Array of property to type mappings. Used for (de)serialization @@ -61,8 +59,7 @@ class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'caption' => 'string', - 'content' => 'string' + 'fallbackValue' => 'string' ]; /** @@ -73,10 +70,25 @@ class WhatsAppDocument implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'caption' => null, - 'content' => null + 'fallbackValue' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'fallbackValue' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +109,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -104,8 +168,7 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'caption' => 'caption', - 'content' => 'content' + 'fallbackValue' => 'fallback_value' ]; /** @@ -114,8 +177,7 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'caption' => 'setCaption', - 'content' => 'setContent' + 'fallbackValue' => 'setFallbackValue' ]; /** @@ -124,8 +186,7 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'caption' => 'getCaption', - 'content' => 'getContent' + 'fallbackValue' => 'getFallbackValue' ]; /** @@ -185,8 +246,25 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['caption'] = $data['caption'] ?? null; - $this->container['content'] = $data['content'] ?? null; + $this->setIfExists('fallbackValue', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -198,8 +276,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['fallbackValue'] === null) { + $invalidProperties[] = "'fallbackValue' can't be null"; } return $invalidProperties; } @@ -217,49 +295,28 @@ public function valid() /** - * Gets caption - * - * @return string|null - */ - public function getCaption() - { - return $this->container['caption']; - } - - /** - * Sets caption - * - * @param string|null $caption Description for the document - * - * @return self - */ - public function setCaption($caption) - { - $this->container['caption'] = $caption; - - return $this; - } - - /** - * Gets content + * Gets fallbackValue * * @return string */ - public function getContent() + public function getFallbackValue() { - return $this->container['content']; + return $this->container['fallbackValue']; } /** - * Sets content + * Sets fallbackValue * - * @param string $content Base64-encoded image + * @param string $fallbackValue Default text. * * @return self */ - public function setContent($content) + public function setFallbackValue($fallbackValue) { - $this->container['content'] = $content; + if (is_null($fallbackValue)) { + throw new \InvalidArgumentException('non-nullable fallbackValue cannot be null'); + } + $this->container['fallbackValue'] = $fallbackValue; return $this; } @@ -270,7 +327,7 @@ public function setContent($content) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +339,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +353,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +369,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +381,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppImage.php b/lib/Model/WhatsAppLanguage.php similarity index 60% rename from lib/Model/WhatsAppImage.php rename to lib/Model/WhatsAppLanguage.php index 3e6545b..96e31e8 100644 --- a/lib/Model/WhatsAppImage.php +++ b/lib/Model/WhatsAppLanguage.php @@ -1,8 +1,8 @@ - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ -class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppLanguage implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -53,7 +51,7 @@ class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppImage'; + protected static $openAPIModelName = 'WhatsAppLanguage'; /** * Array of property to type mappings. Used for (de)serialization @@ -61,8 +59,8 @@ class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'caption' => 'string', - 'content' => 'string' + 'code' => 'string', + 'policy' => 'string' ]; /** @@ -73,10 +71,27 @@ class WhatsAppImage implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'caption' => null, - 'content' => null + 'code' => null, + 'policy' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'code' => false, + 'policy' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -104,8 +171,8 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'caption' => 'caption', - 'content' => 'content' + 'code' => 'code', + 'policy' => 'policy' ]; /** @@ -114,8 +181,8 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'caption' => 'setCaption', - 'content' => 'setContent' + 'code' => 'setCode', + 'policy' => 'setPolicy' ]; /** @@ -124,8 +191,8 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'caption' => 'getCaption', - 'content' => 'getContent' + 'code' => 'getCode', + 'policy' => 'getPolicy' ]; /** @@ -185,8 +252,26 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['caption'] = $data['caption'] ?? null; - $this->container['content'] = $data['content'] ?? null; + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('policy', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -198,8 +283,8 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['content'] === null) { - $invalidProperties[] = "'content' can't be null"; + if ($this->container['code'] === null) { + $invalidProperties[] = "'code' can't be null"; } return $invalidProperties; } @@ -217,49 +302,55 @@ public function valid() /** - * Gets caption + * Gets code * - * @return string|null + * @return string */ - public function getCaption() + public function getCode() { - return $this->container['caption']; + return $this->container['code']; } /** - * Sets caption + * Sets code * - * @param string|null $caption Description for the image + * @param string $code Language code * * @return self */ - public function setCaption($caption) + public function setCode($code) { - $this->container['caption'] = $caption; + if (is_null($code)) { + throw new \InvalidArgumentException('non-nullable code cannot be null'); + } + $this->container['code'] = $code; return $this; } /** - * Gets content + * Gets policy * - * @return string + * @return string|null */ - public function getContent() + public function getPolicy() { - return $this->container['content']; + return $this->container['policy']; } /** - * Sets content + * Sets policy * - * @param string $content Base64-encoded image + * @param string|null $policy Language policy * * @return self */ - public function setContent($content) + public function setPolicy($policy) { - $this->container['content'] = $content; + if (is_null($policy)) { + throw new \InvalidArgumentException('non-nullable policy cannot be null'); + } + $this->container['policy'] = $policy; return $this; } @@ -270,7 +361,7 @@ public function setContent($content) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +373,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +387,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +403,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +415,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/Model/WhatsAppMedia.php b/lib/Model/WhatsAppMedia.php new file mode 100644 index 0000000..fc7208c --- /dev/null +++ b/lib/Model/WhatsAppMedia.php @@ -0,0 +1,513 @@ + + */ +class WhatsAppMedia implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppMedia'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'link' => 'string', + 'caption' => 'string', + 'filename' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'link' => null, + 'caption' => null, + 'filename' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'link' => false, + 'caption' => false, + 'filename' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'link' => 'link', + 'caption' => 'caption', + 'filename' => 'filename' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'link' => 'setLink', + 'caption' => 'setCaption', + 'filename' => 'setFilename' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'link' => 'getLink', + 'caption' => 'getCaption', + 'filename' => 'getFilename' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('link', $data ?? [], null); + $this->setIfExists('caption', $data ?? [], null); + $this->setIfExists('filename', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id The media object ID. Do not use this field when message type is set to text. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets link + * + * @return string|null + */ + public function getLink() + { + return $this->container['link']; + } + + /** + * Sets link + * + * @param string|null $link The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. Do not use this field when message type is set to text. + * + * @return self + */ + public function setLink($link) + { + if (is_null($link)) { + throw new \InvalidArgumentException('non-nullable link cannot be null'); + } + $this->container['link'] = $link; + + return $this; + } + + /** + * Gets caption + * + * @return string|null + */ + public function getCaption() + { + return $this->container['caption']; + } + + /** + * Sets caption + * + * @param string|null $caption Media asset caption. Do not use with audio or sticker media. + * + * @return self + */ + public function setCaption($caption) + { + if (is_null($caption)) { + throw new \InvalidArgumentException('non-nullable caption cannot be null'); + } + $this->container['caption'] = $caption; + + return $this; + } + + /** + * Gets filename + * + * @return string|null + */ + public function getFilename() + { + return $this->container['filename']; + } + + /** + * Sets filename + * + * @param string|null $filename Describes the filename for the specific document. Use only with document media. + * + * @return self + */ + public function setFilename($filename) + { + if (is_null($filename)) { + throw new \InvalidArgumentException('non-nullable filename cannot be null'); + } + $this->container['filename'] = $filename; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppParameter.php b/lib/Model/WhatsAppParameter.php new file mode 100644 index 0000000..2fb4408 --- /dev/null +++ b/lib/Model/WhatsAppParameter.php @@ -0,0 +1,618 @@ + + */ +class WhatsAppParameter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'WhatsAppParameter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => 'string', + 'text' => 'string', + 'currency' => '\Messente\Api\Model\WhatsAppCurrency', + 'dateTime' => '\Messente\Api\Model\WhatsAppDatetime', + 'image' => '\Messente\Api\Model\WhatsAppMedia', + 'document' => '\Messente\Api\Model\WhatsAppMedia', + 'video' => '\Messente\Api\Model\WhatsAppMedia' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'text' => null, + 'currency' => null, + 'dateTime' => null, + 'image' => null, + 'document' => null, + 'video' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'text' => false, + 'currency' => false, + 'dateTime' => false, + 'image' => false, + 'document' => false, + 'video' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'type' => 'type', + 'text' => 'text', + 'currency' => 'currency', + 'dateTime' => 'date_time', + 'image' => 'image', + 'document' => 'document', + 'video' => 'video' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'text' => 'setText', + 'currency' => 'setCurrency', + 'dateTime' => 'setDateTime', + 'image' => 'setImage', + 'document' => 'setDocument', + 'video' => 'setVideo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'text' => 'getText', + 'currency' => 'getCurrency', + 'dateTime' => 'getDateTime', + 'image' => 'getImage', + 'document' => 'getDocument', + 'video' => 'getVideo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('text', $data ?? [], null); + $this->setIfExists('currency', $data ?? [], null); + $this->setIfExists('dateTime', $data ?? [], null); + $this->setIfExists('image', $data ?? [], null); + $this->setIfExists('document', $data ?? [], null); + $this->setIfExists('video', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['type'] === null) { + $invalidProperties[] = "'type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets type + * + * @return string + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string $type Type of the parameter. + * + * @return self + */ + public function setType($type) + { + if (is_null($type)) { + throw new \InvalidArgumentException('non-nullable type cannot be null'); + } + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets text + * + * @return string|null + */ + public function getText() + { + return $this->container['text']; + } + + /** + * Sets text + * + * @param string|null $text A text. + * + * @return self + */ + public function setText($text) + { + if (is_null($text)) { + throw new \InvalidArgumentException('non-nullable text cannot be null'); + } + $this->container['text'] = $text; + + return $this; + } + + /** + * Gets currency + * + * @return \Messente\Api\Model\WhatsAppCurrency|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param \Messente\Api\Model\WhatsAppCurrency|null $currency currency + * + * @return self + */ + public function setCurrency($currency) + { + if (is_null($currency)) { + throw new \InvalidArgumentException('non-nullable currency cannot be null'); + } + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets dateTime + * + * @return \Messente\Api\Model\WhatsAppDatetime|null + */ + public function getDateTime() + { + return $this->container['dateTime']; + } + + /** + * Sets dateTime + * + * @param \Messente\Api\Model\WhatsAppDatetime|null $dateTime dateTime + * + * @return self + */ + public function setDateTime($dateTime) + { + if (is_null($dateTime)) { + throw new \InvalidArgumentException('non-nullable dateTime cannot be null'); + } + $this->container['dateTime'] = $dateTime; + + return $this; + } + + /** + * Gets image + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getImage() + { + return $this->container['image']; + } + + /** + * Sets image + * + * @param \Messente\Api\Model\WhatsAppMedia|null $image image + * + * @return self + */ + public function setImage($image) + { + if (is_null($image)) { + throw new \InvalidArgumentException('non-nullable image cannot be null'); + } + $this->container['image'] = $image; + + return $this; + } + + /** + * Gets document + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getDocument() + { + return $this->container['document']; + } + + /** + * Sets document + * + * @param \Messente\Api\Model\WhatsAppMedia|null $document document + * + * @return self + */ + public function setDocument($document) + { + if (is_null($document)) { + throw new \InvalidArgumentException('non-nullable document cannot be null'); + } + $this->container['document'] = $document; + + return $this; + } + + /** + * Gets video + * + * @return \Messente\Api\Model\WhatsAppMedia|null + */ + public function getVideo() + { + return $this->container['video']; + } + + /** + * Sets video + * + * @param \Messente\Api\Model\WhatsAppMedia|null $video video + * + * @return self + */ + public function setVideo($video) + { + if (is_null($video)) { + throw new \InvalidArgumentException('non-nullable video cannot be null'); + } + $this->container['video'] = $video; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/WhatsAppText.php b/lib/Model/WhatsAppTemplate.php similarity index 54% rename from lib/Model/WhatsAppText.php rename to lib/Model/WhatsAppTemplate.php index c3f257b..06d3d7c 100644 --- a/lib/Model/WhatsAppText.php +++ b/lib/Model/WhatsAppTemplate.php @@ -1,8 +1,8 @@ - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ -class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable +class WhatsAppTemplate implements ModelInterface, ArrayAccess, \JsonSerializable { public const DISCRIMINATOR = null; @@ -53,7 +51,7 @@ class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable * * @var string */ - protected static $openAPIModelName = 'WhatsAppText'; + protected static $openAPIModelName = 'WhatsAppTemplate'; /** * Array of property to type mappings. Used for (de)serialization @@ -61,8 +59,9 @@ class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'previewUrl' => 'bool', - 'body' => 'string' + 'name' => 'string', + 'language' => '\Messente\Api\Model\WhatsAppLanguage', + 'components' => '\Messente\Api\Model\WhatsAppComponent[]' ]; /** @@ -73,10 +72,29 @@ class WhatsAppText implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'previewUrl' => null, - 'body' => null + 'name' => null, + 'language' => null, + 'components' => null ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'language' => false, + 'components' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +115,58 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + /** * Array of attributes where the key is the local name, * and the value is the original name @@ -104,8 +174,9 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'previewUrl' => 'preview_url', - 'body' => 'body' + 'name' => 'name', + 'language' => 'language', + 'components' => 'components' ]; /** @@ -114,8 +185,9 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'previewUrl' => 'setPreviewUrl', - 'body' => 'setBody' + 'name' => 'setName', + 'language' => 'setLanguage', + 'components' => 'setComponents' ]; /** @@ -124,8 +196,9 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'previewUrl' => 'getPreviewUrl', - 'body' => 'getBody' + 'name' => 'getName', + 'language' => 'getLanguage', + 'components' => 'getComponents' ]; /** @@ -185,8 +258,27 @@ public function getModelName() */ public function __construct(array $data = null) { - $this->container['previewUrl'] = $data['previewUrl'] ?? true; - $this->container['body'] = $data['body'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('language', $data ?? [], null); + $this->setIfExists('components', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -198,8 +290,11 @@ public function listInvalidProperties() { $invalidProperties = []; - if ($this->container['body'] === null) { - $invalidProperties[] = "'body' can't be null"; + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['language'] === null) { + $invalidProperties[] = "'language' can't be null"; } return $invalidProperties; } @@ -217,49 +312,82 @@ public function valid() /** - * Gets previewUrl + * Gets name * - * @return bool|null + * @return string */ - public function getPreviewUrl() + public function getName() { - return $this->container['previewUrl']; + return $this->container['name']; } /** - * Sets previewUrl + * Sets name * - * @param bool|null $previewUrl Whether to display link preview if the message contains a hyperlink + * @param string $name Name of the template * * @return self */ - public function setPreviewUrl($previewUrl) + public function setName($name) { - $this->container['previewUrl'] = $previewUrl; + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; return $this; } /** - * Gets body + * Gets language * - * @return string + * @return \Messente\Api\Model\WhatsAppLanguage + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param \Messente\Api\Model\WhatsAppLanguage $language language + * + * @return self */ - public function getBody() + public function setLanguage($language) { - return $this->container['body']; + if (is_null($language)) { + throw new \InvalidArgumentException('non-nullable language cannot be null'); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets components + * + * @return \Messente\Api\Model\WhatsAppComponent[]|null + */ + public function getComponents() + { + return $this->container['components']; } /** - * Sets body + * Sets components * - * @param string $body Plaintext content for WhatsApp, can contain URLs, emojis and formatting + * @param \Messente\Api\Model\WhatsAppComponent[]|null $components List of template components * * @return self */ - public function setBody($body) + public function setComponents($components) { - $this->container['body'] = $body; + if (is_null($components)) { + throw new \InvalidArgumentException('non-nullable components cannot be null'); + } + $this->container['components'] = $components; return $this; } @@ -270,7 +398,7 @@ public function setBody($body) * * @return boolean */ - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -282,6 +410,7 @@ public function offsetExists($offset) * * @return mixed|null */ + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -295,7 +424,7 @@ public function offsetGet($offset) * * @return void */ - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -311,7 +440,7 @@ public function offsetSet($offset, $value) * * @return void */ - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -323,6 +452,7 @@ public function offsetUnset($offset) * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php index 2a1510f..6f7fd57 100644 --- a/lib/ObjectSerializer.php +++ b/lib/ObjectSerializer.php @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version 7.3 + * PHP version 7.4 * * @category Class * @package Messente\Api @@ -18,7 +18,7 @@ * The version of the OpenAPI document: 2.0.0 * Contact: messente@messente.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.6.0 */ /** @@ -29,6 +29,7 @@ namespace Messente\Api; +use GuzzleHttp\Psr7\Utils; use Messente\Api\Model\ModelInterface; /** @@ -87,7 +88,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n foreach ($data::openAPITypes() as $property => $openAPIType) { $getter = $data::getters()[$property]; $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { /** array $callable */ @@ -98,7 +99,7 @@ public static function sanitizeForSerialization($data, $type = null, $format = n } } } - if ($value !== null) { + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } @@ -130,6 +131,20 @@ public static function sanitizeFilename($filename) } } + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + /** * Take value and turn it into a string suitable for inclusion in * the path, by url-encoding. @@ -144,22 +159,141 @@ public static function toPathValue($value) } /** - * Take value and turn it into a string suitable for inclusion in - * the query, by imploding comma-separated if it's an object. - * If it's a string, pass through unchanged. It will be url-encoded - * later. + * Checks if a value is empty, based on its OpenAPI type. * - * @param string[]|string|\DateTime $object an object to be serialized to a string + * @param mixed $value + * @param string $openApiType * - * @return string the serialized object + * @return bool true if $value is empty */ - public static function toQueryValue($object) + private static function isEmptyValue($value, string $openApiType): bool { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; } + + return (int) $value; } /** @@ -205,7 +339,7 @@ public static function toFormValue($value) * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param string|bool|\DateTime $value the value of the parameter + * @param float|int|bool|\DateTime $value the value of the parameter * * @return string the header string */ @@ -216,7 +350,7 @@ public static function toString($value) } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { - return $value; + return (string) $value; } } @@ -263,7 +397,6 @@ public static function serializeCollection(array $collection, $style, $allowColl * @param mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers - * @param string $discriminator discriminator if polymorphism is used * * @return object|array|null a single or an array of $class instances */ @@ -306,13 +439,13 @@ public static function deserialize($data, $class, $httpHeaders = null) if ($class === 'object') { settype($data, 'array'); return $data; - } else if ($class === 'mixed') { + } elseif ($class === 'mixed') { settype($data, gettype($data)); return $data; } if ($class === '\DateTime') { - // Some API's return an invalid, empty string as a + // Some APIs return an invalid, empty string as a // date-time property. DateTime::__construct() will return // the current time for empty input which is probably not // what is meant. The invalid empty string is probably to @@ -322,29 +455,27 @@ public static function deserialize($data, $class, $httpHeaders = null) try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond - // precision for php's DateTime to handle. This conversion - // (string -> unix timestamp -> DateTime) is a workaround - // for the problem. - return (new \DateTime())->setTimestamp(strtotime($data)); + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); } } else { return null; } } - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name - if (array_key_exists('Content-Disposition', $httpHeaders) && - preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); } else { $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); @@ -357,7 +488,16 @@ public static function deserialize($data, $class, $httpHeaders = null) fclose($file); return new \SplFileObject($filename, 'r'); - } elseif (method_exists($class, 'getAllowableEnumValues')) { + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); @@ -365,6 +505,11 @@ public static function deserialize($data, $class, $httpHeaders = null) return $data; } else { $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { @@ -379,7 +524,15 @@ public static function deserialize($data, $class, $httpHeaders = null) foreach ($instance::openAPITypes() as $property => $type) { $propertySetter = $instance::setters()[$property]; - if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + continue; } @@ -391,4 +544,66 @@ public static function deserialize($data, $class, $httpHeaders = null) return $instance; } } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } } diff --git a/test/Api/BlacklistApiTest.php b/test/Api/BlacklistApiTest.php deleted file mode 100644 index 4a9cd00..0000000 --- a/test/Api/BlacklistApiTest.php +++ /dev/null @@ -1,122 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteFromBlacklist - * - * Deletes a phone number from the blacklist. - * - */ - public function testDeleteFromBlacklist() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchBlacklist - * - * Returns all blacklisted phone numbers. - * - */ - public function testFetchBlacklist() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for isBlacklisted - * - * Checks if a phone number is blacklisted. - * - */ - public function testIsBlacklisted() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/ContactsApiTest.php b/test/Api/ContactsApiTest.php deleted file mode 100644 index 7cbcd7e..0000000 --- a/test/Api/ContactsApiTest.php +++ /dev/null @@ -1,170 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for createContact - * - * Creates a new contact. - * - */ - public function testCreateContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteContact - * - * Deletes a contact. - * - */ - public function testDeleteContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContact - * - * Lists a contact. - * - */ - public function testFetchContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContactGroups - * - * Lists groups of a contact. - * - */ - public function testFetchContactGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchContacts - * - * Returns all contacts. - * - */ - public function testFetchContacts() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for removeContactFromGroup - * - * Removes a contact from a group. - * - */ - public function testRemoveContactFromGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for updateContact - * - * Updates a contact. - * - */ - public function testUpdateContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/DeliveryReportApiTest.php b/test/Api/DeliveryReportApiTest.php deleted file mode 100644 index cce94dd..0000000 --- a/test/Api/DeliveryReportApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/GroupsApiTest.php b/test/Api/GroupsApiTest.php deleted file mode 100644 index 3faadc3..0000000 --- a/test/Api/GroupsApiTest.php +++ /dev/null @@ -1,134 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for deleteGroup - * - * Deletes a group. - * - */ - public function testDeleteGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchGroup - * - * Lists a group. - * - */ - public function testFetchGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for fetchGroups - * - * Returns all groups. - * - */ - public function testFetchGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test case for updateGroup - * - * Updates a group with the provided name. - * - */ - public function testUpdateGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/NumberLookupApiTest.php b/test/Api/NumberLookupApiTest.php deleted file mode 100644 index f64ee88..0000000 --- a/test/Api/NumberLookupApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/OmnimessageApiTest.php b/test/Api/OmnimessageApiTest.php deleted file mode 100644 index 6b61e27..0000000 --- a/test/Api/OmnimessageApiTest.php +++ /dev/null @@ -1,98 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test case for sendOmnimessage - * - * Sends an Omnimessage. - * - */ - public function testSendOmnimessage() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Api/StatisticsApiTest.php b/test/Api/StatisticsApiTest.php deleted file mode 100644 index 10f2646..0000000 --- a/test/Api/StatisticsApiTest.php +++ /dev/null @@ -1,86 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ChannelTest.php b/test/Model/ChannelTest.php deleted file mode 100644 index 5d478ad..0000000 --- a/test/Model/ChannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactEnvelopeTest.php b/test/Model/ContactEnvelopeTest.php deleted file mode 100644 index ad42b6a..0000000 --- a/test/Model/ContactEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contact" - */ - public function testPropertyContact() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactFieldsTest.php b/test/Model/ContactFieldsTest.php deleted file mode 100644 index 7fa774d..0000000 --- a/test/Model/ContactFieldsTest.php +++ /dev/null @@ -1,172 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactListEnvelopeTest.php b/test/Model/ContactListEnvelopeTest.php deleted file mode 100644 index bde0072..0000000 --- a/test/Model/ContactListEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contacts" - */ - public function testPropertyContacts() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactResponseFieldsTest.php b/test/Model/ContactResponseFieldsTest.php deleted file mode 100644 index 0709a33..0000000 --- a/test/Model/ContactResponseFieldsTest.php +++ /dev/null @@ -1,181 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "scheduledDeletionDate" - */ - public function testPropertyScheduledDeletionDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ContactUpdateFieldsTest.php b/test/Model/ContactUpdateFieldsTest.php deleted file mode 100644 index c179501..0000000 --- a/test/Model/ContactUpdateFieldsTest.php +++ /dev/null @@ -1,163 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "email" - */ - public function testPropertyEmail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "firstName" - */ - public function testPropertyFirstName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "lastName" - */ - public function testPropertyLastName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "company" - */ - public function testPropertyCompany() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom" - */ - public function testPropertyCustom() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom2" - */ - public function testPropertyCustom2() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom3" - */ - public function testPropertyCustom3() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "custom4" - */ - public function testPropertyCustom4() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/DeliveryReportResponseTest.php b/test/Model/DeliveryReportResponseTest.php deleted file mode 100644 index 8bb70a1..0000000 --- a/test/Model/DeliveryReportResponseTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "statuses" - */ - public function testPropertyStatuses() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "omnimessageId" - */ - public function testPropertyOmnimessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/DeliveryResultTest.php b/test/Model/DeliveryResultTest.php deleted file mode 100644 index a1e207b..0000000 --- a/test/Model/DeliveryResultTest.php +++ /dev/null @@ -1,136 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "status" - */ - public function testPropertyStatus() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageId" - */ - public function testPropertyMessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "err" - */ - public function testPropertyErr() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "timestamp" - */ - public function testPropertyTimestamp() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeOmnichannelMachineTest.php b/test/Model/ErrorCodeOmnichannelMachineTest.php deleted file mode 100644 index 1cdf214..0000000 --- a/test/Model/ErrorCodeOmnichannelMachineTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeOmnichannelTest.php b/test/Model/ErrorCodeOmnichannelTest.php deleted file mode 100644 index 78fddb5..0000000 --- a/test/Model/ErrorCodeOmnichannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodePhonebookTest.php b/test/Model/ErrorCodePhonebookTest.php deleted file mode 100644 index 71bc429..0000000 --- a/test/Model/ErrorCodePhonebookTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorCodeStatisticsTest.php b/test/Model/ErrorCodeStatisticsTest.php deleted file mode 100644 index f03468e..0000000 --- a/test/Model/ErrorCodeStatisticsTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemNumberLookupErrorTest.php b/test/Model/ErrorItemNumberLookupErrorTest.php deleted file mode 100644 index 8885f53..0000000 --- a/test/Model/ErrorItemNumberLookupErrorTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "description" - */ - public function testPropertyDescription() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemNumberLookupTest.php b/test/Model/ErrorItemNumberLookupTest.php deleted file mode 100644 index 9246aa1..0000000 --- a/test/Model/ErrorItemNumberLookupTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemOmnichannelTest.php b/test/Model/ErrorItemOmnichannelTest.php deleted file mode 100644 index ae5544a..0000000 --- a/test/Model/ErrorItemOmnichannelTest.php +++ /dev/null @@ -1,118 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "detail" - */ - public function testPropertyDetail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "source" - */ - public function testPropertySource() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemPhonebookTest.php b/test/Model/ErrorItemPhonebookTest.php deleted file mode 100644 index 4d28e07..0000000 --- a/test/Model/ErrorItemPhonebookTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "detail" - */ - public function testPropertyDetail() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorItemStatisticsTest.php b/test/Model/ErrorItemStatisticsTest.php deleted file mode 100644 index 24e42b7..0000000 --- a/test/Model/ErrorItemStatisticsTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "title" - */ - public function testPropertyTitle() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "details" - */ - public function testPropertyDetails() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "code" - */ - public function testPropertyCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorNumberLookupTest.php b/test/Model/ErrorNumberLookupTest.php deleted file mode 100644 index 27b57c4..0000000 --- a/test/Model/ErrorNumberLookupTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorOmnichannelTest.php b/test/Model/ErrorOmnichannelTest.php deleted file mode 100644 index 5f1e138..0000000 --- a/test/Model/ErrorOmnichannelTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorPhonebookTest.php b/test/Model/ErrorPhonebookTest.php deleted file mode 100644 index 4e836bf..0000000 --- a/test/Model/ErrorPhonebookTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorStatisticsTest.php b/test/Model/ErrorStatisticsTest.php deleted file mode 100644 index 4272499..0000000 --- a/test/Model/ErrorStatisticsTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "errors" - */ - public function testPropertyErrors() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorTitleOmnichannelTest.php b/test/Model/ErrorTitleOmnichannelTest.php deleted file mode 100644 index c29096a..0000000 --- a/test/Model/ErrorTitleOmnichannelTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ErrorTitlePhonebookTest.php b/test/Model/ErrorTitlePhonebookTest.php deleted file mode 100644 index 2816116..0000000 --- a/test/Model/ErrorTitlePhonebookTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/FetchBlacklistSuccessTest.php b/test/Model/FetchBlacklistSuccessTest.php deleted file mode 100644 index a93ea6f..0000000 --- a/test/Model/FetchBlacklistSuccessTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumbers" - */ - public function testPropertyPhoneNumbers() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupEnvelopeTest.php b/test/Model/GroupEnvelopeTest.php deleted file mode 100644 index ac7b3b1..0000000 --- a/test/Model/GroupEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "group" - */ - public function testPropertyGroup() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupListEnvelopeTest.php b/test/Model/GroupListEnvelopeTest.php deleted file mode 100644 index 47b2f4b..0000000 --- a/test/Model/GroupListEnvelopeTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "groups" - */ - public function testPropertyGroups() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupNameTest.php b/test/Model/GroupNameTest.php deleted file mode 100644 index 82a5d94..0000000 --- a/test/Model/GroupNameTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "name" - */ - public function testPropertyName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/GroupResponseFieldsTest.php b/test/Model/GroupResponseFieldsTest.php deleted file mode 100644 index cd5136a..0000000 --- a/test/Model/GroupResponseFieldsTest.php +++ /dev/null @@ -1,118 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "id" - */ - public function testPropertyId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "name" - */ - public function testPropertyName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "createdOn" - */ - public function testPropertyCreatedOn() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "contactsCount" - */ - public function testPropertyContactsCount() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/MessageResultTest.php b/test/Model/MessageResultTest.php deleted file mode 100644 index 778d4dc..0000000 --- a/test/Model/MessageResultTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageId" - */ - public function testPropertyMessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/MobileNetworkTest.php b/test/Model/MobileNetworkTest.php deleted file mode 100644 index 6b19db3..0000000 --- a/test/Model/MobileNetworkTest.php +++ /dev/null @@ -1,127 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "mccmnc" - */ - public function testPropertyMccmnc() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "networkName" - */ - public function testPropertyNetworkName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryName" - */ - public function testPropertyCountryName() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryPrefix" - */ - public function testPropertyCountryPrefix() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "countryCode" - */ - public function testPropertyCountryCode() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/NumberToBlacklistTest.php b/test/Model/NumberToBlacklistTest.php deleted file mode 100644 index 2b005cd..0000000 --- a/test/Model/NumberToBlacklistTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "phoneNumber" - */ - public function testPropertyPhoneNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/NumbersToInvestigateTest.php b/test/Model/NumbersToInvestigateTest.php deleted file mode 100644 index 54c17fb..0000000 --- a/test/Model/NumbersToInvestigateTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "numbers" - */ - public function testPropertyNumbers() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/OmniMessageCreateSuccessResponseTest.php b/test/Model/OmniMessageCreateSuccessResponseTest.php deleted file mode 100644 index 1544f73..0000000 --- a/test/Model/OmniMessageCreateSuccessResponseTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messages" - */ - public function testPropertyMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "omnimessageId" - */ - public function testPropertyOmnimessageId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/OmnimessageTest.php b/test/Model/OmnimessageTest.php deleted file mode 100644 index c498a37..0000000 --- a/test/Model/OmnimessageTest.php +++ /dev/null @@ -1,136 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "to" - */ - public function testPropertyTo() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messages" - */ - public function testPropertyMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "dlrUrl" - */ - public function testPropertyDlrUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "textStore" - */ - public function testPropertyTextStore() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "timeToSend" - */ - public function testPropertyTimeToSend() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "priority" - */ - public function testPropertyPriority() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/PriorityTest.php b/test/Model/PriorityTest.php deleted file mode 100644 index 124fe12..0000000 --- a/test/Model/PriorityTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SMSTest.php b/test/Model/SMSTest.php deleted file mode 100644 index 3ab9316..0000000 --- a/test/Model/SMSTest.php +++ /dev/null @@ -1,145 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "autoconvert" - */ - public function testPropertyAutoconvert() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "udh" - */ - public function testPropertyUdh() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportSettingsTest.php b/test/Model/StatisticsReportSettingsTest.php deleted file mode 100644 index d73d235..0000000 --- a/test/Model/StatisticsReportSettingsTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "startDate" - */ - public function testPropertyStartDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "endDate" - */ - public function testPropertyEndDate() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "messageTypes" - */ - public function testPropertyMessageTypes() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportSuccessTest.php b/test/Model/StatisticsReportSuccessTest.php deleted file mode 100644 index f200c05..0000000 --- a/test/Model/StatisticsReportSuccessTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "reports" - */ - public function testPropertyReports() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatisticsReportTest.php b/test/Model/StatisticsReportTest.php deleted file mode 100644 index 8a4021a..0000000 --- a/test/Model/StatisticsReportTest.php +++ /dev/null @@ -1,109 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "totalMessages" - */ - public function testPropertyTotalMessages() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "totalPrice" - */ - public function testPropertyTotalPrice() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "country" - */ - public function testPropertyCountry() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/StatusTest.php b/test/Model/StatusTest.php deleted file mode 100644 index 10530f9..0000000 --- a/test/Model/StatusTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SyncNumberLookupResultTest.php b/test/Model/SyncNumberLookupResultTest.php deleted file mode 100644 index 8eb6dae..0000000 --- a/test/Model/SyncNumberLookupResultTest.php +++ /dev/null @@ -1,163 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "number" - */ - public function testPropertyNumber() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "roaming" - */ - public function testPropertyRoaming() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ported" - */ - public function testPropertyPorted() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "roamingNetwork" - */ - public function testPropertyRoamingNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "currentNetwork" - */ - public function testPropertyCurrentNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "originalNetwork" - */ - public function testPropertyOriginalNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "portedNetwork" - */ - public function testPropertyPortedNetwork() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "status" - */ - public function testPropertyStatus() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "error" - */ - public function testPropertyError() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/SyncNumberLookupSuccessTest.php b/test/Model/SyncNumberLookupSuccessTest.php deleted file mode 100644 index 1274234..0000000 --- a/test/Model/SyncNumberLookupSuccessTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "requestId" - */ - public function testPropertyRequestId() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "result" - */ - public function testPropertyResult() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/TelegramTest.php b/test/Model/TelegramTest.php deleted file mode 100644 index 6a88027..0000000 --- a/test/Model/TelegramTest.php +++ /dev/null @@ -1,145 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "imageUrl" - */ - public function testPropertyImageUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "documentUrl" - */ - public function testPropertyDocumentUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "audioUrl" - */ - public function testPropertyAudioUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/TextStoreTest.php b/test/Model/TextStoreTest.php deleted file mode 100644 index 70ff6ca..0000000 --- a/test/Model/TextStoreTest.php +++ /dev/null @@ -1,82 +0,0 @@ -markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/ViberTest.php b/test/Model/ViberTest.php deleted file mode 100644 index f15e95e..0000000 --- a/test/Model/ViberTest.php +++ /dev/null @@ -1,154 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "imageUrl" - */ - public function testPropertyImageUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "buttonUrl" - */ - public function testPropertyButtonUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "buttonText" - */ - public function testPropertyButtonText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppAudioTest.php b/test/Model/WhatsAppAudioTest.php deleted file mode 100644 index 9d4fec7..0000000 --- a/test/Model/WhatsAppAudioTest.php +++ /dev/null @@ -1,91 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "content" - */ - public function testPropertyContent() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppDocumentTest.php b/test/Model/WhatsAppDocumentTest.php deleted file mode 100644 index 022c0fa..0000000 --- a/test/Model/WhatsAppDocumentTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "caption" - */ - public function testPropertyCaption() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "content" - */ - public function testPropertyContent() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppImageTest.php b/test/Model/WhatsAppImageTest.php deleted file mode 100644 index e9d384f..0000000 --- a/test/Model/WhatsAppImageTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "caption" - */ - public function testPropertyCaption() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "content" - */ - public function testPropertyContent() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppTest.php b/test/Model/WhatsAppTest.php deleted file mode 100644 index 115ec5c..0000000 --- a/test/Model/WhatsAppTest.php +++ /dev/null @@ -1,154 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "sender" - */ - public function testPropertySender() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "validity" - */ - public function testPropertyValidity() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "ttl" - */ - public function testPropertyTtl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "text" - */ - public function testPropertyText() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "image" - */ - public function testPropertyImage() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "document" - */ - public function testPropertyDocument() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "audio" - */ - public function testPropertyAudio() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "channel" - */ - public function testPropertyChannel() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} diff --git a/test/Model/WhatsAppTextTest.php b/test/Model/WhatsAppTextTest.php deleted file mode 100644 index a3b7035..0000000 --- a/test/Model/WhatsAppTextTest.php +++ /dev/null @@ -1,100 +0,0 @@ -markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "previewUrl" - */ - public function testPropertyPreviewUrl() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } - - /** - * Test attribute "body" - */ - public function testPropertyBody() - { - // TODO: implement - $this->markTestIncomplete('Not implemented'); - } -} From 6e81f2bcb0688e15c04a07cfbe1e4c50811577fe Mon Sep 17 00:00:00 2001 From: api-librarian Date: Wed, 3 Jul 2024 15:48:22 +0000 Subject: [PATCH 7/9] Travis update: Jul 2024 (Build 759) [skip ci] --- .openapi-generator/FILES | 4 + README.md | 1 + docs/Api/OmnimessageApi.md | 61 +++ .../BulkOmniMessageCreateSuccessResponse.md | 9 + docs/Model/BulkOmnimessage.md | 9 + lib/Api/OmnimessageApi.php | 383 ++++++++++++++++ .../BulkOmniMessageCreateSuccessResponse.php | 414 ++++++++++++++++++ lib/Model/BulkOmnimessage.php | 414 ++++++++++++++++++ 8 files changed, 1295 insertions(+) create mode 100644 docs/Model/BulkOmniMessageCreateSuccessResponse.md create mode 100644 docs/Model/BulkOmnimessage.md create mode 100644 lib/Model/BulkOmniMessageCreateSuccessResponse.php create mode 100644 lib/Model/BulkOmnimessage.php diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0f2a994..8a64232 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -11,6 +11,8 @@ docs/Api/GroupsApi.md docs/Api/NumberLookupApi.md docs/Api/OmnimessageApi.md docs/Api/StatisticsApi.md +docs/Model/BulkOmniMessageCreateSuccessResponse.md +docs/Model/BulkOmnimessage.md docs/Model/Channel.md docs/Model/ContactEnvelope.md docs/Model/ContactFields.md @@ -76,6 +78,8 @@ lib/Api/StatisticsApi.php lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php +lib/Model/BulkOmniMessageCreateSuccessResponse.php +lib/Model/BulkOmnimessage.php lib/Model/Channel.php lib/Model/ContactEnvelope.php lib/Model/ContactFields.php diff --git a/README.md b/README.md index 3ad019b..d7ebe6a 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Messente API Library provides the operations described below to access the featu ### OmnimessageApi 1. Cancels a scheduled Omnimessage [`cancelScheduledMessage`](docs/Api/OmnimessageApi.md#cancelscheduledmessage) +1. Sends a bulk Omnimessage [`sendBulkOmnimessage`](docs/Api/OmnimessageApi.md#sendbulkomnimessage) 1. Sends an Omnimessage [`sendOmnimessage`](docs/Api/OmnimessageApi.md#sendomnimessage) ### StatisticsApi diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md index b4317da..940d1cc 100644 --- a/docs/Api/OmnimessageApi.md +++ b/docs/Api/OmnimessageApi.md @@ -5,6 +5,7 @@ All URIs are relative to https://api.messente.com/v1, except if the operation de | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | +| [**sendBulkOmnimessage()**](OmnimessageApi.md#sendBulkOmnimessage) | **POST** /omnimessages | Sends a bulk Omnimessage | | [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | @@ -68,6 +69,66 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) +## `sendBulkOmnimessage()` + +```php +sendBulkOmnimessage($bulkOmnimessage): \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse +``` + +Sends a bulk Omnimessage + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\OmnimessageApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$bulkOmnimessage = new \Messente\Api\Model\BulkOmnimessage(); // \Messente\Api\Model\BulkOmnimessage | Bulk Omnimessage to be sent + +try { + $result = $apiInstance->sendBulkOmnimessage($bulkOmnimessage); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling OmnimessageApi->sendBulkOmnimessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **bulkOmnimessage** | [**\Messente\Api\Model\BulkOmnimessage**](../Model/BulkOmnimessage.md)| Bulk Omnimessage to be sent | | + +### Return type + +[**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse**](../Model/BulkOmniMessageCreateSuccessResponse.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + ## `sendOmnimessage()` ```php diff --git a/docs/Model/BulkOmniMessageCreateSuccessResponse.md b/docs/Model/BulkOmniMessageCreateSuccessResponse.md new file mode 100644 index 0000000..bea7d18 --- /dev/null +++ b/docs/Model/BulkOmniMessageCreateSuccessResponse.md @@ -0,0 +1,9 @@ +# # BulkOmniMessageCreateSuccessResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**\Messente\Api\Model\OmniMessageCreateSuccessResponse[]**](OmniMessageCreateSuccessResponse.md) | List of responses for each Omnimessage. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BulkOmnimessage.md b/docs/Model/BulkOmnimessage.md new file mode 100644 index 0000000..0f9ce58 --- /dev/null +++ b/docs/Model/BulkOmnimessage.md @@ -0,0 +1,9 @@ +# # BulkOmnimessage + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**\Messente\Api\Model\Omnimessage[]**](Omnimessage.md) | A list of omnimessages. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php index 1cc0442..5db33f6 100644 --- a/lib/Api/OmnimessageApi.php +++ b/lib/Api/OmnimessageApi.php @@ -75,6 +75,9 @@ class OmnimessageApi 'cancelScheduledMessage' => [ 'application/json', ], + 'sendBulkOmnimessage' => [ + 'application/json', + ], 'sendOmnimessage' => [ 'application/json', ], @@ -507,6 +510,386 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp ); } + /** + * Operation sendBulkOmnimessage + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel + */ + public function sendBulkOmnimessage($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + list($response) = $this->sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, $contentType); + return $response; + } + + /** + * Operation sendBulkOmnimessageWithHttpInfo + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) + */ + public function sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendBulkOmnimessageAsync + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendBulkOmnimessageAsync($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + return $this->sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendBulkOmnimessageAsyncWithHttpInfo + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; + $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendBulkOmnimessage' + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendBulkOmnimessageRequest($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + + // verify the required parameter 'bulkOmnimessage' is set + if ($bulkOmnimessage === null || (is_array($bulkOmnimessage) && count($bulkOmnimessage) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bulkOmnimessage when calling sendBulkOmnimessage' + ); + } + + + $resourcePath = '/omnimessages'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($bulkOmnimessage)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bulkOmnimessage)); + } else { + $httpBody = $bulkOmnimessage; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + /** * Operation sendOmnimessage * diff --git a/lib/Model/BulkOmniMessageCreateSuccessResponse.php b/lib/Model/BulkOmniMessageCreateSuccessResponse.php new file mode 100644 index 0000000..1e62192 --- /dev/null +++ b/lib/Model/BulkOmniMessageCreateSuccessResponse.php @@ -0,0 +1,414 @@ + + */ +class BulkOmniMessageCreateSuccessResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkOmniMessageCreateSuccessResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'messages' => '\Messente\Api\Model\OmniMessageCreateSuccessResponse[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'messages' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'messages' => 'messages' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'messages' => 'setMessages' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'messages' => 'getMessages' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messages', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['messages'] === null) { + $invalidProperties[] = "'messages' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets messages + * + * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse[] + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Messente\Api\Model\OmniMessageCreateSuccessResponse[] $messages List of responses for each Omnimessage. + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/BulkOmnimessage.php b/lib/Model/BulkOmnimessage.php new file mode 100644 index 0000000..f065b3e --- /dev/null +++ b/lib/Model/BulkOmnimessage.php @@ -0,0 +1,414 @@ + + */ +class BulkOmnimessage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkOmnimessage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'messages' => '\Messente\Api\Model\Omnimessage[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'messages' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'messages' => 'messages' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'messages' => 'setMessages' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'messages' => 'getMessages' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messages', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['messages'] === null) { + $invalidProperties[] = "'messages' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets messages + * + * @return \Messente\Api\Model\Omnimessage[] + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Messente\Api\Model\Omnimessage[] $messages A list of omnimessages. + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + From fb478885c350105e1f7d9d92b5c1ae520c416ce9 Mon Sep 17 00:00:00 2001 From: api-librarian Date: Thu, 4 Jul 2024 09:06:15 +0000 Subject: [PATCH 8/9] Travis update: Jul 2024 (Build 760) [skip ci] --- .openapi-generator/FILES | 2 + .../BulkOmniMessageCreateSuccessResponse.md | 2 +- ...ssageCreateSuccessResponseMessagesInner.md | 12 + .../BulkOmniMessageCreateSuccessResponse.php | 6 +- ...sageCreateSuccessResponseMessagesInner.php | 524 ++++++++++++++++++ 5 files changed, 542 insertions(+), 4 deletions(-) create mode 100644 docs/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.md create mode 100644 lib/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.php diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 8a64232..2943deb 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -12,6 +12,7 @@ docs/Api/NumberLookupApi.md docs/Api/OmnimessageApi.md docs/Api/StatisticsApi.md docs/Model/BulkOmniMessageCreateSuccessResponse.md +docs/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.md docs/Model/BulkOmnimessage.md docs/Model/Channel.md docs/Model/ContactEnvelope.md @@ -79,6 +80,7 @@ lib/ApiException.php lib/Configuration.php lib/HeaderSelector.php lib/Model/BulkOmniMessageCreateSuccessResponse.php +lib/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.php lib/Model/BulkOmnimessage.php lib/Model/Channel.php lib/Model/ContactEnvelope.php diff --git a/docs/Model/BulkOmniMessageCreateSuccessResponse.md b/docs/Model/BulkOmniMessageCreateSuccessResponse.md index bea7d18..f992854 100644 --- a/docs/Model/BulkOmniMessageCreateSuccessResponse.md +++ b/docs/Model/BulkOmniMessageCreateSuccessResponse.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**\Messente\Api\Model\OmniMessageCreateSuccessResponse[]**](OmniMessageCreateSuccessResponse.md) | List of responses for each Omnimessage. | +**messages** | [**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[]**](BulkOmniMessageCreateSuccessResponseMessagesInner.md) | List of responses for each Omnimessage. | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.md b/docs/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.md new file mode 100644 index 0000000..89460e4 --- /dev/null +++ b/docs/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.md @@ -0,0 +1,12 @@ +# # BulkOmniMessageCreateSuccessResponseMessagesInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**messages** | [**\Messente\Api\Model\MessageResult[]**](MessageResult.md) | List of messages that compose the omnimessage | +**to** | **string** | Phone number in e.164 format | +**omnimessageId** | **string** | Unique identifier for the omnimessage | +**errors** | [**\Messente\Api\Model\ErrorItemOmnichannel[]**](ErrorItemOmnichannel.md) | An array of errors | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Model/BulkOmniMessageCreateSuccessResponse.php b/lib/Model/BulkOmniMessageCreateSuccessResponse.php index 1e62192..b03d57b 100644 --- a/lib/Model/BulkOmniMessageCreateSuccessResponse.php +++ b/lib/Model/BulkOmniMessageCreateSuccessResponse.php @@ -59,7 +59,7 @@ class BulkOmniMessageCreateSuccessResponse implements ModelInterface, ArrayAcces * @var string[] */ protected static $openAPITypes = [ - 'messages' => '\Messente\Api\Model\OmniMessageCreateSuccessResponse[]' + 'messages' => '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[]' ]; /** @@ -297,7 +297,7 @@ public function valid() /** * Gets messages * - * @return \Messente\Api\Model\OmniMessageCreateSuccessResponse[] + * @return \Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[] */ public function getMessages() { @@ -307,7 +307,7 @@ public function getMessages() /** * Sets messages * - * @param \Messente\Api\Model\OmniMessageCreateSuccessResponse[] $messages List of responses for each Omnimessage. + * @param \Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[] $messages List of responses for each Omnimessage. * * @return self */ diff --git a/lib/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.php b/lib/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.php new file mode 100644 index 0000000..0dacee7 --- /dev/null +++ b/lib/Model/BulkOmniMessageCreateSuccessResponseMessagesInner.php @@ -0,0 +1,524 @@ + + */ +class BulkOmniMessageCreateSuccessResponseMessagesInner implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'BulkOmniMessageCreateSuccessResponse_messages_inner'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'messages' => '\Messente\Api\Model\MessageResult[]', + 'to' => 'string', + 'omnimessageId' => 'string', + 'errors' => '\Messente\Api\Model\ErrorItemOmnichannel[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'messages' => null, + 'to' => null, + 'omnimessageId' => 'UUID', + 'errors' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'messages' => false, + 'to' => false, + 'omnimessageId' => false, + 'errors' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'messages' => 'messages', + 'to' => 'to', + 'omnimessageId' => 'omnimessage_id', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'messages' => 'setMessages', + 'to' => 'setTo', + 'omnimessageId' => 'setOmnimessageId', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'messages' => 'getMessages', + 'to' => 'getTo', + 'omnimessageId' => 'getOmnimessageId', + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('messages', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('omnimessageId', $data ?? [], null); + $this->setIfExists('errors', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['messages'] === null) { + $invalidProperties[] = "'messages' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['omnimessageId'] === null) { + $invalidProperties[] = "'omnimessageId' can't be null"; + } + if ($this->container['errors'] === null) { + $invalidProperties[] = "'errors' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets messages + * + * @return \Messente\Api\Model\MessageResult[] + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Messente\Api\Model\MessageResult[] $messages List of messages that compose the omnimessage + * + * @return self + */ + public function setMessages($messages) + { + if (is_null($messages)) { + throw new \InvalidArgumentException('non-nullable messages cannot be null'); + } + $this->container['messages'] = $messages; + + return $this; + } + + /** + * Gets to + * + * @return string + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param string $to Phone number in e.164 format + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets omnimessageId + * + * @return string + */ + public function getOmnimessageId() + { + return $this->container['omnimessageId']; + } + + /** + * Sets omnimessageId + * + * @param string $omnimessageId Unique identifier for the omnimessage + * + * @return self + */ + public function setOmnimessageId($omnimessageId) + { + if (is_null($omnimessageId)) { + throw new \InvalidArgumentException('non-nullable omnimessageId cannot be null'); + } + $this->container['omnimessageId'] = $omnimessageId; + + return $this; + } + + /** + * Gets errors + * + * @return \Messente\Api\Model\ErrorItemOmnichannel[] + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Messente\Api\Model\ErrorItemOmnichannel[] $errors An array of errors + * + * @return self + */ + public function setErrors($errors) + { + if (is_null($errors)) { + throw new \InvalidArgumentException('non-nullable errors cannot be null'); + } + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + From 7803fd67e86f4411915e0451130a438b7c30f98b Mon Sep 17 00:00:00 2001 From: api-librarian Date: Thu, 4 Jul 2024 13:49:26 +0000 Subject: [PATCH 9/9] Travis update: Jul 2024 (Build 763) [skip ci] --- .openapi-generator/FILES | 2 + README.md | 5 +- docs/Api/BulkMessagingApi.md | 68 +++ docs/Api/OmnimessageApi.md | 61 -- .../BulkOmniMessageCreateSuccessResponse.md | 2 +- lib/Api/BulkMessagingApi.php | 524 ++++++++++++++++++ lib/Api/OmnimessageApi.php | 383 ------------- .../BulkOmniMessageCreateSuccessResponse.php | 2 +- 8 files changed, 600 insertions(+), 447 deletions(-) create mode 100644 docs/Api/BulkMessagingApi.md create mode 100644 lib/Api/BulkMessagingApi.php diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 2943deb..4d9950b 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -5,6 +5,7 @@ README.md composer.json docs/Api/BlacklistApi.md +docs/Api/BulkMessagingApi.md docs/Api/ContactsApi.md docs/Api/DeliveryReportApi.md docs/Api/GroupsApi.md @@ -70,6 +71,7 @@ docs/Model/WhatsAppParameter.md docs/Model/WhatsAppTemplate.md git_push.sh lib/Api/BlacklistApi.php +lib/Api/BulkMessagingApi.php lib/Api/ContactsApi.php lib/Api/DeliveryReportApi.php lib/Api/GroupsApi.php diff --git a/README.md b/README.md index d7ebe6a..7b96eaa 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Messente API Library provides the operations described below to access the featu 1. Returns all blacklisted phone numbers [`fetchBlacklist`](docs/Api/BlacklistApi.md#fetchblacklist) 1. Checks if a phone number is blacklisted [`isBlacklisted`](docs/Api/BlacklistApi.md#isblacklisted) +### BulkMessagingApi + +1. Sends a bulk Omnimessage [`sendBulkOmnimessage`](docs/Api/BulkMessagingApi.md#sendbulkomnimessage) + ### ContactsApi 1. Adds a contact to a group [`addContactToGroup`](docs/Api/ContactsApi.md#addcontacttogroup) @@ -55,7 +59,6 @@ Messente API Library provides the operations described below to access the featu ### OmnimessageApi 1. Cancels a scheduled Omnimessage [`cancelScheduledMessage`](docs/Api/OmnimessageApi.md#cancelscheduledmessage) -1. Sends a bulk Omnimessage [`sendBulkOmnimessage`](docs/Api/OmnimessageApi.md#sendbulkomnimessage) 1. Sends an Omnimessage [`sendOmnimessage`](docs/Api/OmnimessageApi.md#sendomnimessage) ### StatisticsApi diff --git a/docs/Api/BulkMessagingApi.md b/docs/Api/BulkMessagingApi.md new file mode 100644 index 0000000..ede8b6a --- /dev/null +++ b/docs/Api/BulkMessagingApi.md @@ -0,0 +1,68 @@ +# Messente\Api\BulkMessagingApi + +All URIs are relative to https://api.messente.com/v1, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**sendBulkOmnimessage()**](BulkMessagingApi.md#sendBulkOmnimessage) | **POST** /omnimessages | Sends a bulk Omnimessage | + + +## `sendBulkOmnimessage()` + +```php +sendBulkOmnimessage($bulkOmnimessage): \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse +``` + +Sends a bulk Omnimessage + +### Example + +```php +setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); + + +$apiInstance = new Messente\Api\Api\BulkMessagingApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$bulkOmnimessage = new \Messente\Api\Model\BulkOmnimessage(); // \Messente\Api\Model\BulkOmnimessage | Bulk Omnimessage to be sent + +try { + $result = $apiInstance->sendBulkOmnimessage($bulkOmnimessage); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling BulkMessagingApi->sendBulkOmnimessage: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **bulkOmnimessage** | [**\Messente\Api\Model\BulkOmnimessage**](../Model/BulkOmnimessage.md)| Bulk Omnimessage to be sent | | + +### Return type + +[**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse**](../Model/BulkOmniMessageCreateSuccessResponse.md) + +### Authorization + +[basicAuth](../../README.md#basicAuth) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/docs/Api/OmnimessageApi.md b/docs/Api/OmnimessageApi.md index 940d1cc..b4317da 100644 --- a/docs/Api/OmnimessageApi.md +++ b/docs/Api/OmnimessageApi.md @@ -5,7 +5,6 @@ All URIs are relative to https://api.messente.com/v1, except if the operation de | Method | HTTP request | Description | | ------------- | ------------- | ------------- | | [**cancelScheduledMessage()**](OmnimessageApi.md#cancelScheduledMessage) | **DELETE** /omnimessage/{omnimessageId} | Cancels a scheduled Omnimessage | -| [**sendBulkOmnimessage()**](OmnimessageApi.md#sendBulkOmnimessage) | **POST** /omnimessages | Sends a bulk Omnimessage | | [**sendOmnimessage()**](OmnimessageApi.md#sendOmnimessage) | **POST** /omnimessage | Sends an Omnimessage | @@ -69,66 +68,6 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `sendBulkOmnimessage()` - -```php -sendBulkOmnimessage($bulkOmnimessage): \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse -``` - -Sends a bulk Omnimessage - -### Example - -```php -setUsername('YOUR_USERNAME') - ->setPassword('YOUR_PASSWORD'); - - -$apiInstance = new Messente\Api\Api\OmnimessageApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$bulkOmnimessage = new \Messente\Api\Model\BulkOmnimessage(); // \Messente\Api\Model\BulkOmnimessage | Bulk Omnimessage to be sent - -try { - $result = $apiInstance->sendBulkOmnimessage($bulkOmnimessage); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling OmnimessageApi->sendBulkOmnimessage: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **bulkOmnimessage** | [**\Messente\Api\Model\BulkOmnimessage**](../Model/BulkOmnimessage.md)| Bulk Omnimessage to be sent | | - -### Return type - -[**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse**](../Model/BulkOmniMessageCreateSuccessResponse.md) - -### Authorization - -[basicAuth](../../README.md#basicAuth) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - ## `sendOmnimessage()` ```php diff --git a/docs/Model/BulkOmniMessageCreateSuccessResponse.md b/docs/Model/BulkOmniMessageCreateSuccessResponse.md index f992854..0334b07 100644 --- a/docs/Model/BulkOmniMessageCreateSuccessResponse.md +++ b/docs/Model/BulkOmniMessageCreateSuccessResponse.md @@ -4,6 +4,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**messages** | [**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[]**](BulkOmniMessageCreateSuccessResponseMessagesInner.md) | List of responses for each Omnimessage. | +**messages** | [**\Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[]**](BulkOmniMessageCreateSuccessResponseMessagesInner.md) | List of responses for each Omnimessage in the bulk. These can be errors or successful responses | [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/BulkMessagingApi.php b/lib/Api/BulkMessagingApi.php new file mode 100644 index 0000000..beedabc --- /dev/null +++ b/lib/Api/BulkMessagingApi.php @@ -0,0 +1,524 @@ + [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation sendBulkOmnimessage + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel + */ + public function sendBulkOmnimessage($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + list($response) = $this->sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, $contentType); + return $response; + } + + /** + * Operation sendBulkOmnimessageWithHttpInfo + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) + */ + public function sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 401: + if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 401: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Messente\Api\Model\ErrorOmnichannel', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation sendBulkOmnimessageAsync + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendBulkOmnimessageAsync($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + return $this->sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation sendBulkOmnimessageAsyncWithHttpInfo + * + * Sends a bulk Omnimessage + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; + $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'sendBulkOmnimessage' + * + * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function sendBulkOmnimessageRequest($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) + { + + // verify the required parameter 'bulkOmnimessage' is set + if ($bulkOmnimessage === null || (is_array($bulkOmnimessage) && count($bulkOmnimessage) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $bulkOmnimessage when calling sendBulkOmnimessage' + ); + } + + + $resourcePath = '/omnimessages'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($bulkOmnimessage)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bulkOmnimessage)); + } else { + $httpBody = $bulkOmnimessage; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/OmnimessageApi.php b/lib/Api/OmnimessageApi.php index 5db33f6..1cc0442 100644 --- a/lib/Api/OmnimessageApi.php +++ b/lib/Api/OmnimessageApi.php @@ -75,9 +75,6 @@ class OmnimessageApi 'cancelScheduledMessage' => [ 'application/json', ], - 'sendBulkOmnimessage' => [ - 'application/json', - ], 'sendOmnimessage' => [ 'application/json', ], @@ -510,386 +507,6 @@ public function cancelScheduledMessageRequest($omnimessageId, string $contentTyp ); } - /** - * Operation sendBulkOmnimessage - * - * Sends a bulk Omnimessage - * - * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel - */ - public function sendBulkOmnimessage($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) - { - list($response) = $this->sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, $contentType); - return $response; - } - - /** - * Operation sendBulkOmnimessageWithHttpInfo - * - * Sends a bulk Omnimessage - * - * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation - * - * @throws \Messente\Api\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Messente\Api\Model\BulkOmniMessageCreateSuccessResponse|\Messente\Api\Model\ErrorOmnichannel|\Messente\Api\Model\ErrorOmnichannel, HTTP status code, HTTP response headers (array of strings) - */ - public function sendBulkOmnimessageWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) - { - $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 201: - if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 401: - if ('\Messente\Api\Model\ErrorOmnichannel' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Messente\Api\Model\ErrorOmnichannel' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Messente\Api\Model\ErrorOmnichannel', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 401: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Messente\Api\Model\ErrorOmnichannel', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation sendBulkOmnimessageAsync - * - * Sends a bulk Omnimessage - * - * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function sendBulkOmnimessageAsync($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) - { - return $this->sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation sendBulkOmnimessageAsyncWithHttpInfo - * - * Sends a bulk Omnimessage - * - * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function sendBulkOmnimessageAsyncWithHttpInfo($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) - { - $returnType = '\Messente\Api\Model\BulkOmniMessageCreateSuccessResponse'; - $request = $this->sendBulkOmnimessageRequest($bulkOmnimessage, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'sendBulkOmnimessage' - * - * @param \Messente\Api\Model\BulkOmnimessage $bulkOmnimessage Bulk Omnimessage to be sent (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['sendBulkOmnimessage'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function sendBulkOmnimessageRequest($bulkOmnimessage, string $contentType = self::contentTypes['sendBulkOmnimessage'][0]) - { - - // verify the required parameter 'bulkOmnimessage' is set - if ($bulkOmnimessage === null || (is_array($bulkOmnimessage) && count($bulkOmnimessage) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $bulkOmnimessage when calling sendBulkOmnimessage' - ); - } - - - $resourcePath = '/omnimessages'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($bulkOmnimessage)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($bulkOmnimessage)); - } else { - $httpBody = $bulkOmnimessage; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires HTTP basic authentication - if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { - $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation sendOmnimessage * diff --git a/lib/Model/BulkOmniMessageCreateSuccessResponse.php b/lib/Model/BulkOmniMessageCreateSuccessResponse.php index b03d57b..66c4079 100644 --- a/lib/Model/BulkOmniMessageCreateSuccessResponse.php +++ b/lib/Model/BulkOmniMessageCreateSuccessResponse.php @@ -307,7 +307,7 @@ public function getMessages() /** * Sets messages * - * @param \Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[] $messages List of responses for each Omnimessage. + * @param \Messente\Api\Model\BulkOmniMessageCreateSuccessResponseMessagesInner[] $messages List of responses for each Omnimessage in the bulk. These can be errors or successful responses * * @return self */