From 3e7bb3c761c2bbca685e6b8baea945f8febb829b Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 13:58:50 -0500 Subject: [PATCH 01/19] Updating openapi-generator for PHP to 7.7.0 --- sdks/php/.php-cs-fixer.dist.php | 102 + sdks/php/.php-cs-fixer.php | 22 - sdks/php/composer.json | 16 +- sdks/php/openapi-config.yaml | 6 + sdks/php/run-build | 6 +- sdks/php/src/Api/AccountApi.php | 1008 ++--- sdks/php/src/Api/ApiAppApi.php | 1160 +++--- sdks/php/src/Api/BulkSendJobApi.php | 640 +-- sdks/php/src/Api/EmbeddedApi.php | 547 +-- sdks/php/src/Api/OAuthApi.php | 566 ++- sdks/php/src/Api/ReportApi.php | 321 +- sdks/php/src/Api/SignatureRequestApi.php | 3544 +++++++++-------- sdks/php/src/Api/TeamApi.php | 2367 ++++++----- sdks/php/src/Api/TemplateApi.php | 2591 ++++++------ sdks/php/src/Api/UnclaimedDraftApi.php | 982 +++-- sdks/php/src/ApiException.php | 16 +- sdks/php/src/Configuration.php | 227 +- sdks/php/src/EventCallbackHelper.php | 4 +- sdks/php/src/HeaderSelector.php | 191 +- sdks/php/src/Model/AccountCreateRequest.php | 151 +- sdks/php/src/Model/AccountCreateResponse.php | 149 +- sdks/php/src/Model/AccountGetResponse.php | 143 +- sdks/php/src/Model/AccountResponse.php | 225 +- sdks/php/src/Model/AccountResponseQuotas.php | 208 +- sdks/php/src/Model/AccountResponseUsage.php | 143 +- sdks/php/src/Model/AccountUpdateRequest.php | 155 +- sdks/php/src/Model/AccountVerifyRequest.php | 133 +- sdks/php/src/Model/AccountVerifyResponse.php | 143 +- .../Model/AccountVerifyResponseAccount.php | 137 +- sdks/php/src/Model/ApiAppCreateRequest.php | 177 +- sdks/php/src/Model/ApiAppGetResponse.php | 143 +- sdks/php/src/Model/ApiAppListResponse.php | 149 +- sdks/php/src/Model/ApiAppResponse.php | 219 +- sdks/php/src/Model/ApiAppResponseOAuth.php | 155 +- sdks/php/src/Model/ApiAppResponseOptions.php | 137 +- .../src/Model/ApiAppResponseOwnerAccount.php | 143 +- .../ApiAppResponseWhiteLabelingOptions.php | 219 +- sdks/php/src/Model/ApiAppUpdateRequest.php | 170 +- sdks/php/src/Model/BulkSendJobGetResponse.php | 155 +- ...ulkSendJobGetResponseSignatureRequests.php | 355 +- .../php/src/Model/BulkSendJobListResponse.php | 149 +- sdks/php/src/Model/BulkSendJobResponse.php | 162 +- .../php/src/Model/BulkSendJobSendResponse.php | 143 +- sdks/php/src/Model/EmbeddedEditUrlRequest.php | 190 +- .../php/src/Model/EmbeddedEditUrlResponse.php | 143 +- .../Model/EmbeddedEditUrlResponseEmbedded.php | 143 +- .../php/src/Model/EmbeddedSignUrlResponse.php | 143 +- .../Model/EmbeddedSignUrlResponseEmbedded.php | 143 +- sdks/php/src/Model/ErrorResponse.php | 133 +- sdks/php/src/Model/ErrorResponseError.php | 145 +- sdks/php/src/Model/EventCallbackRequest.php | 151 +- .../src/Model/EventCallbackRequestEvent.php | 150 +- .../EventCallbackRequestEventMetadata.php | 181 +- sdks/php/src/Model/FileResponse.php | 143 +- sdks/php/src/Model/FileResponseDataUri.php | 137 +- sdks/php/src/Model/ListInfoResponse.php | 162 +- sdks/php/src/Model/ModelInterface.php | 15 +- .../src/Model/OAuthTokenGenerateRequest.php | 157 +- .../src/Model/OAuthTokenRefreshRequest.php | 139 +- sdks/php/src/Model/OAuthTokenResponse.php | 168 +- sdks/php/src/Model/ReportCreateRequest.php | 152 +- sdks/php/src/Model/ReportCreateResponse.php | 143 +- sdks/php/src/Model/ReportResponse.php | 156 +- ...tBulkCreateEmbeddedWithTemplateRequest.php | 214 +- ...tureRequestBulkSendWithTemplateRequest.php | 214 +- .../SignatureRequestCreateEmbeddedRequest.php | 287 +- ...questCreateEmbeddedWithTemplateRequest.php | 226 +- .../src/Model/SignatureRequestGetResponse.php | 143 +- .../Model/SignatureRequestListResponse.php | 149 +- .../Model/SignatureRequestRemindRequest.php | 139 +- .../src/Model/SignatureRequestResponse.php | 362 +- .../SignatureRequestResponseAttachment.php | 178 +- ...ignatureRequestResponseCustomFieldBase.php | 150 +- ...tureRequestResponseCustomFieldCheckbox.php | 137 +- ...ignatureRequestResponseCustomFieldText.php | 137 +- ...tureRequestResponseCustomFieldTypeEnum.php | 4 +- .../SignatureRequestResponseDataBase.php | 153 +- .../SignatureRequestResponseDataTypeEnum.php | 4 +- ...natureRequestResponseDataValueCheckbox.php | 140 +- ...eRequestResponseDataValueCheckboxMerge.php | 140 +- ...tureRequestResponseDataValueDateSigned.php | 140 +- ...natureRequestResponseDataValueDropdown.php | 140 +- ...natureRequestResponseDataValueInitials.php | 140 +- ...SignatureRequestResponseDataValueRadio.php | 140 +- ...atureRequestResponseDataValueSignature.php | 140 +- .../SignatureRequestResponseDataValueText.php | 140 +- ...atureRequestResponseDataValueTextMerge.php | 140 +- .../SignatureRequestResponseSignatures.php | 354 +- .../src/Model/SignatureRequestSendRequest.php | 299 +- ...ignatureRequestSendWithTemplateRequest.php | 239 +- .../Model/SignatureRequestUpdateRequest.php | 158 +- sdks/php/src/Model/SubAttachment.php | 151 +- sdks/php/src/Model/SubBulkSignerList.php | 142 +- .../Model/SubBulkSignerListCustomField.php | 139 +- sdks/php/src/Model/SubCC.php | 139 +- sdks/php/src/Model/SubCustomField.php | 151 +- sdks/php/src/Model/SubEditorOptions.php | 142 +- sdks/php/src/Model/SubFieldOptions.php | 131 +- sdks/php/src/Model/SubFormFieldGroup.php | 145 +- sdks/php/src/Model/SubFormFieldRule.php | 163 +- sdks/php/src/Model/SubFormFieldRuleAction.php | 149 +- .../php/src/Model/SubFormFieldRuleTrigger.php | 149 +- .../Model/SubFormFieldsPerDocumentBase.php | 199 +- .../SubFormFieldsPerDocumentCheckbox.php | 143 +- .../SubFormFieldsPerDocumentCheckboxMerge.php | 131 +- .../SubFormFieldsPerDocumentDateSigned.php | 143 +- .../SubFormFieldsPerDocumentDropdown.php | 160 +- .../SubFormFieldsPerDocumentFontEnum.php | 4 +- .../SubFormFieldsPerDocumentHyperlink.php | 155 +- .../SubFormFieldsPerDocumentInitials.php | 131 +- .../Model/SubFormFieldsPerDocumentRadio.php | 143 +- .../SubFormFieldsPerDocumentSignature.php | 131 +- .../Model/SubFormFieldsPerDocumentText.php | 193 +- .../SubFormFieldsPerDocumentTextMerge.php | 143 +- .../SubFormFieldsPerDocumentTypeEnum.php | 4 +- sdks/php/src/Model/SubMergeField.php | 137 +- sdks/php/src/Model/SubOAuth.php | 143 +- sdks/php/src/Model/SubOptions.php | 136 +- .../SubSignatureRequestGroupedSigners.php | 152 +- .../src/Model/SubSignatureRequestSigner.php | 174 +- .../SubSignatureRequestTemplateSigner.php | 167 +- sdks/php/src/Model/SubSigningOptions.php | 155 +- sdks/php/src/Model/SubTeamResponse.php | 143 +- sdks/php/src/Model/SubTemplateRole.php | 149 +- .../php/src/Model/SubUnclaimedDraftSigner.php | 152 +- .../Model/SubUnclaimedDraftTemplateSigner.php | 145 +- .../php/src/Model/SubWhiteLabelingOptions.php | 221 +- sdks/php/src/Model/TeamAddMemberRequest.php | 145 +- sdks/php/src/Model/TeamCreateRequest.php | 136 +- sdks/php/src/Model/TeamGetInfoResponse.php | 143 +- sdks/php/src/Model/TeamGetResponse.php | 143 +- sdks/php/src/Model/TeamInfoResponse.php | 168 +- sdks/php/src/Model/TeamInviteResponse.php | 167 +- sdks/php/src/Model/TeamInvitesResponse.php | 143 +- sdks/php/src/Model/TeamMemberResponse.php | 149 +- sdks/php/src/Model/TeamMembersResponse.php | 149 +- sdks/php/src/Model/TeamParentResponse.php | 143 +- .../php/src/Model/TeamRemoveMemberRequest.php | 157 +- sdks/php/src/Model/TeamResponse.php | 155 +- sdks/php/src/Model/TeamSubTeamsResponse.php | 149 +- sdks/php/src/Model/TeamUpdateRequest.php | 136 +- sdks/php/src/Model/TemplateAddUserRequest.php | 148 +- .../TemplateCreateEmbeddedDraftRequest.php | 284 +- .../TemplateCreateEmbeddedDraftResponse.php | 143 +- ...ateCreateEmbeddedDraftResponseTemplate.php | 155 +- sdks/php/src/Model/TemplateCreateRequest.php | 242 +- sdks/php/src/Model/TemplateCreateResponse.php | 143 +- .../Model/TemplateCreateResponseTemplate.php | 137 +- sdks/php/src/Model/TemplateEditResponse.php | 136 +- sdks/php/src/Model/TemplateGetResponse.php | 143 +- sdks/php/src/Model/TemplateListResponse.php | 149 +- .../src/Model/TemplateRemoveUserRequest.php | 142 +- sdks/php/src/Model/TemplateResponse.php | 274 +- .../php/src/Model/TemplateResponseAccount.php | 167 +- .../Model/TemplateResponseAccountQuota.php | 155 +- sdks/php/src/Model/TemplateResponseCCRole.php | 137 +- .../src/Model/TemplateResponseDocument.php | 174 +- ...emplateResponseDocumentCustomFieldBase.php | 194 +- ...ateResponseDocumentCustomFieldCheckbox.php | 131 +- ...emplateResponseDocumentCustomFieldText.php | 155 +- .../TemplateResponseDocumentFieldGroup.php | 143 +- ...TemplateResponseDocumentFieldGroupRule.php | 143 +- .../TemplateResponseDocumentFormFieldBase.php | 187 +- ...plateResponseDocumentFormFieldCheckbox.php | 131 +- ...ateResponseDocumentFormFieldDateSigned.php | 131 +- ...plateResponseDocumentFormFieldDropdown.php | 131 +- ...lateResponseDocumentFormFieldHyperlink.php | 155 +- ...plateResponseDocumentFormFieldInitials.php | 131 +- ...TemplateResponseDocumentFormFieldRadio.php | 131 +- ...lateResponseDocumentFormFieldSignature.php | 131 +- .../TemplateResponseDocumentFormFieldText.php | 166 +- ...emplateResponseDocumentStaticFieldBase.php | 187 +- ...ateResponseDocumentStaticFieldCheckbox.php | 131 +- ...eResponseDocumentStaticFieldDateSigned.php | 131 +- ...ateResponseDocumentStaticFieldDropdown.php | 131 +- ...teResponseDocumentStaticFieldHyperlink.php | 131 +- ...ateResponseDocumentStaticFieldInitials.php | 131 +- ...mplateResponseDocumentStaticFieldRadio.php | 131 +- ...teResponseDocumentStaticFieldSignature.php | 131 +- ...emplateResponseDocumentStaticFieldText.php | 131 +- .../TemplateResponseFieldAvgTextLength.php | 143 +- .../src/Model/TemplateResponseSignerRole.php | 143 +- .../src/Model/TemplateUpdateFilesRequest.php | 165 +- .../src/Model/TemplateUpdateFilesResponse.php | 137 +- .../TemplateUpdateFilesResponseTemplate.php | 143 +- .../UnclaimedDraftCreateEmbeddedRequest.php | 360 +- ...DraftCreateEmbeddedWithTemplateRequest.php | 316 +- .../src/Model/UnclaimedDraftCreateRequest.php | 286 +- .../Model/UnclaimedDraftCreateResponse.php | 143 +- .../UnclaimedDraftEditAndResendRequest.php | 175 +- sdks/php/src/Model/UnclaimedDraftResponse.php | 195 +- sdks/php/src/Model/WarningResponse.php | 139 +- sdks/php/src/ObjectSerializer.php | 414 +- sdks/php/templates/.php-cs-fixer.dist.php | 102 + sdks/php/templates/ApiException.mustache | 3 +- sdks/php/templates/Configuration.mustache | 224 +- sdks/php/templates/HeaderSelector.mustache | 205 +- sdks/php/templates/ModelInterface.mustache | 18 +- sdks/php/templates/ObjectSerializer.mustache | 288 +- sdks/php/templates/api.mustache | 581 ++- sdks/php/templates/api_test.mustache | 4 +- sdks/php/templates/composer.mustache | 30 +- .../libraries/psr-18/ApiException.mustache | 113 + .../libraries/psr-18/DebugPlugin.mustache | 92 + .../libraries/psr-18/README.mustache | 160 + .../templates/libraries/psr-18/api.mustache | 773 ++++ .../libraries/psr-18/api_doc.mustache | 78 + .../libraries/psr-18/composer.mustache | 54 + sdks/php/templates/model.mustache | 8 +- sdks/php/templates/model_enum.mustache | 2 +- sdks/php/templates/model_generic.mustache | 165 +- sdks/php/templates/model_test.mustache | 8 +- sdks/php/templates/partial_header.mustache | 2 +- sdks/php/templates/phpunit.xml.mustache | 4 +- 214 files changed, 31926 insertions(+), 13089 deletions(-) create mode 100644 sdks/php/.php-cs-fixer.dist.php delete mode 100644 sdks/php/.php-cs-fixer.php create mode 100644 sdks/php/templates/.php-cs-fixer.dist.php create mode 100644 sdks/php/templates/libraries/psr-18/ApiException.mustache create mode 100644 sdks/php/templates/libraries/psr-18/DebugPlugin.mustache create mode 100644 sdks/php/templates/libraries/psr-18/README.mustache create mode 100644 sdks/php/templates/libraries/psr-18/api.mustache create mode 100644 sdks/php/templates/libraries/psr-18/api_doc.mustache create mode 100644 sdks/php/templates/libraries/psr-18/composer.mustache diff --git a/sdks/php/.php-cs-fixer.dist.php b/sdks/php/.php-cs-fixer.dist.php new file mode 100644 index 000000000..d93659d70 --- /dev/null +++ b/sdks/php/.php-cs-fixer.dist.php @@ -0,0 +1,102 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') + ->exclude('bin') + ->exclude('docs') + ->exclude('examples') + ->exclude('templates') + ->exclude('test_fixtures') +; + +$config = new PhpCsFixer\Config(); +$config->setParallelConfig( + PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect() +); +return $config->setRules([ + '@PhpCsFixer' => true, + '@Symfony' => true, + '@DoctrineAnnotation' => true, + 'binary_operator_spaces' => [ + 'operators' => [ + '=>' => null, + ], + ], + 'blank_line_before_statement' => [ + 'statements' => [], + ], + 'blank_line_after_opening_tag' => false, + 'cast_spaces' => [ + 'space' => 'none', + ], + 'class_definition' => [ + 'inline_constructor_arguments' => false, + 'space_before_parenthesis' => true, + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + 'nullable_type_declaration_for_default_null_value' => false, + 'declare_parentheses' => true, + 'echo_tag_syntax' => [ + 'format' => 'short', + 'shorten_simple_statements_only' => true, + ], + 'fully_qualified_strict_types' => true, + 'global_namespace_import' => true, + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author', 'package', 'subpackage', 'version', + ], + ], + 'increment_style' => false, + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', 'function', 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + 'allow_unused_params' => true, + 'remove_inheritdoc' => true, + ], + 'phpdoc_align' => [ + 'tags' => [ + 'method', 'param', 'property', 'return', 'type', 'var', + ], + ], + 'phpdoc_line_span' => [ + 'property' => 'single', + ], + 'phpdoc_separation' => false, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, + 'phpdoc_to_param_type' => [ + 'scalar_types' => true, + 'union_types' => false, + ], + 'php_unit_internal_class' => false, + 'php_unit_test_class_requires_covers' => false, + 'single_line_throw' => false, + 'statement_indentation' => [ + 'stick_comment_to_next_continuous_control_statement' => false, + ], + 'visibility_required' => [ + 'elements' => ['method', 'property'], + ], + 'yoda_style' => false, +]) + ->setFinder($finder) + ->setRiskyAllowed(true) +; diff --git a/sdks/php/.php-cs-fixer.php b/sdks/php/.php-cs-fixer.php deleted file mode 100644 index 4f602dac6..000000000 --- a/sdks/php/.php-cs-fixer.php +++ /dev/null @@ -1,22 +0,0 @@ -in(__DIR__) - ->exclude(['bin', 'docs', 'examples', 'templates', 'legacy']); - -$config = new PhpCsFixer\Config(); -return $config->setRules([ - '@Symfony' => true, - 'concat_space' => ['spacing' => 'one'], - 'global_namespace_import' => true, - 'fully_qualified_strict_types' => true, - 'increment_style' => false, - 'phpdoc_align' => ['align' => 'left'], - 'phpdoc_separation' => false, - 'phpdoc_summary' => false, - 'phpdoc_to_param_type' => true, - 'single_line_throw' => false, - 'yoda_style' => false, -]) - ->setFinder($finder) - ->setRiskyAllowed(true); diff --git a/sdks/php/composer.json b/sdks/php/composer.json index 8d7844d8f..347c72797 100644 --- a/sdks/php/composer.json +++ b/sdks/php/composer.json @@ -1,6 +1,6 @@ { "name": "dropbox/sign", - "description": "Official Dropbox Sign APIv3 PHP SDK", + "description": "Dropbox Sign v3 API", "keywords": [ "openapitools", "openapi-generator", @@ -13,18 +13,12 @@ "dropboxsign" ], "homepage": "https://hellosign.com", - "license": [ - "MIT" - ], + "license": "MIT", "authors": [ { "name": "Dropbox Sign", "homepage": "https://hellosign.com", "email": "apisupport@hellosign.com" - }, - { - "name": "OpenAPI-Generator contributors", - "homepage": "https://openapi-generator.tech" } ], "require": { @@ -37,13 +31,11 @@ }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", - "friendsofphp/php-cs-fixer": "3.4.*", + "friendsofphp/php-cs-fixer": "^3.5", "symfony/yaml": "^5.4" }, "autoload": { - "psr-4": { - "Dropbox\\Sign\\": "src/" - } + "psr-4": { "Dropbox\\Sign\\" : "src/" } }, "autoload-dev": { "psr-4": { "Dropbox\\Sign\\Test\\" : "test/" } diff --git a/sdks/php/openapi-config.yaml b/sdks/php/openapi-config.yaml index d93266974..0ec7a9f82 100644 --- a/sdks/php/openapi-config.yaml +++ b/sdks/php/openapi-config.yaml @@ -9,6 +9,12 @@ additionalProperties: sortModelPropertiesByRequiredFlag: true srcBasePath: src phpVersion: 7.4 + composerPackageName: "dropbox/sign" + artifactUrl: "https://hellosign.com" + licenseName: "MIT" + developerOrganization: "Dropbox Sign" + developerOrganizationUrl: "https://hellosign.com" + developerOrganizationEmail: "apisupport@hellosign.com" files: EventCallbackHelper.mustache: templateType: SupportingFiles diff --git a/sdks/php/run-build b/sdks/php/run-build index 2818bb63b..78c15b701 100755 --- a/sdks/php/run-build +++ b/sdks/php/run-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# see https://github.com/OpenAPITools/openapi-generator/tree/ef882a4e6c6066007952de3bd7013f9940dc0de7/modules/openapi-generator/src/main/resources/php +# see https://github.com/OpenAPITools/openapi-generator/tree/v7.7.0/modules/openapi-generator/src/main/resources/php set -e @@ -10,12 +10,14 @@ WORKING_DIR="/app/php" docker run --rm \ -v "${DIR}/:/local" \ -v "${DIR}/openapi-sdk.yaml:/local/openapi-sdk.yaml" \ - openapitools/openapi-generator-cli:v5.3.0 generate \ + openapitools/openapi-generator-cli:v7.7.0 generate \ -i "/local/openapi-sdk.yaml" \ -c "/local/openapi-config.yaml" \ -t "/local/templates" \ -o "/local/" +rm -rf "${DIR}/.openapi-generator" + printf "\nInstalling composer dependencies ...\n" mkdir -p "${DIR}/vendor" bash "${DIR}/bin/php" composer install diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 9b2517429..541bf3bac 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,50 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * AccountApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class AccountApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'accountCreate' => [ + 'application/json', + ], + 'accountGet' => [ + 'application/json', + ], + 'accountUpdate' => [ + 'application/json', + ], + 'accountVerify' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,29 +123,21 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation accountCreate * * Create Account * * @param Model\AccountCreateRequest $account_create_request account_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\AccountCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\AccountCreateResponse */ - public function accountCreate(Model\AccountCreateRequest $account_create_request) + public function accountCreate(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { - list($response) = $this->accountCreateWithHttpInfo($account_create_request); - + list($response) = $this->accountCreateWithHttpInfo($account_create_request, $contentType); return $response; } @@ -153,31 +147,31 @@ public function accountCreate(Model\AccountCreateRequest $account_create_request * Create Account * * @param Model\AccountCreateRequest $account_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\AccountCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_create_request) + public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { - $request = $this->accountCreateRequest($account_create_request); + $request = $this->accountCreateRequest($account_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -190,51 +184,73 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\AccountCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\AccountCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\AccountCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\AccountCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -243,28 +259,19 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\AccountCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\AccountCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -275,13 +282,14 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr * Create Account * * @param Model\AccountCreateRequest $account_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountCreateAsync(Model\AccountCreateRequest $account_create_request) + public function accountCreateAsync(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { - return $this->accountCreateAsyncWithHttpInfo($account_create_request) + return $this->accountCreateAsyncWithHttpInfo($account_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -295,23 +303,27 @@ function ($response) { * Create Account * * @param Model\AccountCreateRequest $account_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountCreateAsyncWithHttpInfo(Model\AccountCreateRequest $account_create_request) + public function accountCreateAsyncWithHttpInfo(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { $returnType = '\Dropbox\Sign\Model\AccountCreateResponse'; - $request = $this->accountCreateRequest($account_create_request); + $request = $this->accountCreateRequest($account_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -331,7 +343,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -341,11 +353,12 @@ function ($exception) { * Create request for operation 'accountCreate' * * @param Model\AccountCreateRequest $account_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function accountCreateRequest(Model\AccountCreateRequest $account_create_request) + public function accountCreateRequest(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { // verify the required parameter 'account_create_request' is set if ($account_create_request === null || (is_array($account_create_request) && count($account_create_request) === 0)) { @@ -355,9 +368,11 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ } $resourcePath = '/account/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $account_create_request @@ -365,21 +380,17 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_create_request)); } else { $httpBody = $account_create_request; } @@ -398,9 +409,9 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -408,12 +419,13 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ $payloadHook('multipart', $multipartContents, $account_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -437,11 +449,11 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -452,17 +464,17 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ * * Get Account * - * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) + * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\AccountGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\AccountGetResponse */ - public function accountGet(string $account_id = null, string $email_address = null) + public function accountGet(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { - list($response) = $this->accountGetWithHttpInfo($account_id, $email_address); - + list($response) = $this->accountGetWithHttpInfo($account_id, $email_address, $contentType); return $response; } @@ -471,33 +483,33 @@ public function accountGet(string $account_id = null, string $email_address = nu * * Get Account * - * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) + * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function accountGetWithHttpInfo(string $account_id = null, string $email_address = null) + public function accountGetWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { - $request = $this->accountGetRequest($account_id, $email_address); + $request = $this->accountGetRequest($account_id, $email_address, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -510,51 +522,73 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\AccountGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\AccountGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\AccountGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\AccountGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -563,28 +597,19 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\AccountGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\AccountGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -594,15 +619,16 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_ * * Get Account * - * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) + * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountGetAsync(string $account_id = null, string $email_address = null) + public function accountGetAsync(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { - return $this->accountGetAsyncWithHttpInfo($account_id, $email_address) + return $this->accountGetAsyncWithHttpInfo($account_id, $email_address, $contentType) ->then( function ($response) { return $response[0]; @@ -615,25 +641,29 @@ function ($response) { * * Get Account * - * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) + * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountGetAsyncWithHttpInfo(string $account_id = null, string $email_address = null) + public function accountGetAsyncWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { $returnType = '\Dropbox\Sign\Model\AccountGetResponse'; - $request = $this->accountGetRequest($account_id, $email_address); + $request = $this->accountGetRequest($account_id, $email_address, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -653,7 +683,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -662,53 +692,46 @@ function ($exception) { /** * Create request for operation 'accountGet' * - * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) + * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function accountGetRequest(string $account_id = null, string $email_address = null) + public function accountGetRequest(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { $resourcePath = '/account'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($account_id !== null) { - if ('form' === 'form' && is_array($account_id)) { - foreach ($account_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['account_id'] = $account_id; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_id, + 'account_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($email_address !== null) { - if ('form' === 'form' && is_array($email_address)) { - foreach ($email_address as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['email_address'] = $email_address; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'email_address', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -726,18 +749,19 @@ public function accountGetRequest(string $account_id = null, string $email_addre // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -761,11 +785,11 @@ public function accountGetRequest(string $account_id = null, string $email_addre $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -777,15 +801,15 @@ public function accountGetRequest(string $account_id = null, string $email_addre * Update Account * * @param Model\AccountUpdateRequest $account_update_request account_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\AccountGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\AccountGetResponse */ - public function accountUpdate(Model\AccountUpdateRequest $account_update_request) + public function accountUpdate(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { - list($response) = $this->accountUpdateWithHttpInfo($account_update_request); - + list($response) = $this->accountUpdateWithHttpInfo($account_update_request, $contentType); return $response; } @@ -795,31 +819,31 @@ public function accountUpdate(Model\AccountUpdateRequest $account_update_request * Update Account * * @param Model\AccountUpdateRequest $account_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_update_request) + public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { - $request = $this->accountUpdateRequest($account_update_request); + $request = $this->accountUpdateRequest($account_update_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -832,51 +856,73 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\AccountGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\AccountGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\AccountGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\AccountGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -885,28 +931,19 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\AccountGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\AccountGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -917,13 +954,14 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up * Update Account * * @param Model\AccountUpdateRequest $account_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountUpdateAsync(Model\AccountUpdateRequest $account_update_request) + public function accountUpdateAsync(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { - return $this->accountUpdateAsyncWithHttpInfo($account_update_request) + return $this->accountUpdateAsyncWithHttpInfo($account_update_request, $contentType) ->then( function ($response) { return $response[0]; @@ -937,23 +975,27 @@ function ($response) { * Update Account * * @param Model\AccountUpdateRequest $account_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountUpdateAsyncWithHttpInfo(Model\AccountUpdateRequest $account_update_request) + public function accountUpdateAsyncWithHttpInfo(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { $returnType = '\Dropbox\Sign\Model\AccountGetResponse'; - $request = $this->accountUpdateRequest($account_update_request); + $request = $this->accountUpdateRequest($account_update_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -973,7 +1015,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -983,11 +1025,12 @@ function ($exception) { * Create request for operation 'accountUpdate' * * @param Model\AccountUpdateRequest $account_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_request) + public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { // verify the required parameter 'account_update_request' is set if ($account_update_request === null || (is_array($account_update_request) && count($account_update_request) === 0)) { @@ -997,9 +1040,11 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ } $resourcePath = '/account'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $account_update_request @@ -1007,21 +1052,17 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_update_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_update_request)); } else { $httpBody = $account_update_request; } @@ -1040,9 +1081,9 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1050,12 +1091,13 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ $payloadHook('multipart', $multipartContents, $account_update_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1079,11 +1121,11 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1095,15 +1137,15 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ * Verify Account * * @param Model\AccountVerifyRequest $account_verify_request account_verify_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\AccountVerifyResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\AccountVerifyResponse */ - public function accountVerify(Model\AccountVerifyRequest $account_verify_request) + public function accountVerify(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { - list($response) = $this->accountVerifyWithHttpInfo($account_verify_request); - + list($response) = $this->accountVerifyWithHttpInfo($account_verify_request, $contentType); return $response; } @@ -1113,31 +1155,31 @@ public function accountVerify(Model\AccountVerifyRequest $account_verify_request * Verify Account * * @param Model\AccountVerifyRequest $account_verify_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\AccountVerifyResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_verify_request) + public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { - $request = $this->accountVerifyRequest($account_verify_request); + $request = $this->accountVerifyRequest($account_verify_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1150,51 +1192,73 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\AccountVerifyResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountVerifyResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\AccountVerifyResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\AccountVerifyResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\AccountVerifyResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\AccountVerifyResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1203,28 +1267,19 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\AccountVerifyResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\AccountVerifyResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1235,13 +1290,14 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve * Verify Account * * @param Model\AccountVerifyRequest $account_verify_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountVerifyAsync(Model\AccountVerifyRequest $account_verify_request) + public function accountVerifyAsync(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { - return $this->accountVerifyAsyncWithHttpInfo($account_verify_request) + return $this->accountVerifyAsyncWithHttpInfo($account_verify_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1255,23 +1311,27 @@ function ($response) { * Verify Account * * @param Model\AccountVerifyRequest $account_verify_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function accountVerifyAsyncWithHttpInfo(Model\AccountVerifyRequest $account_verify_request) + public function accountVerifyAsyncWithHttpInfo(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { $returnType = '\Dropbox\Sign\Model\AccountVerifyResponse'; - $request = $this->accountVerifyRequest($account_verify_request); + $request = $this->accountVerifyRequest($account_verify_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1291,7 +1351,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1301,11 +1361,12 @@ function ($exception) { * Create request for operation 'accountVerify' * * @param Model\AccountVerifyRequest $account_verify_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_request) + public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { // verify the required parameter 'account_verify_request' is set if ($account_verify_request === null || (is_array($account_verify_request) && count($account_verify_request) === 0)) { @@ -1315,9 +1376,11 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ } $resourcePath = '/account/verify'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $account_verify_request @@ -1325,21 +1388,17 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_verify_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($account_verify_request)); } else { $httpBody = $account_verify_request; } @@ -1358,9 +1417,9 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1368,12 +1427,13 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ $payloadHook('multipart', $multipartContents, $account_verify_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1397,11 +1457,11 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1410,12 +1470,12 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -1425,4 +1485,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index 2f158ac84..f387a8f38 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,55 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * ApiAppApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class ApiAppApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'apiAppCreate' => [ + 'application/json', + 'multipart/form-data', + ], + 'apiAppDelete' => [ + 'application/json', + ], + 'apiAppGet' => [ + 'application/json', + ], + 'apiAppList' => [ + 'application/json', + ], + 'apiAppUpdate' => [ + 'application/json', + 'multipart/form-data', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,29 +128,21 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation apiAppCreate * * Create API App * * @param Model\ApiAppCreateRequest $api_app_create_request api_app_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\ApiAppGetResponse */ - public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request) + public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { - list($response) = $this->apiAppCreateWithHttpInfo($api_app_create_request); - + list($response) = $this->apiAppCreateWithHttpInfo($api_app_create_request, $contentType); return $response; } @@ -153,31 +152,31 @@ public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request) * Create API App * * @param Model\ApiAppCreateRequest $api_app_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request) + public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { - $request = $this->apiAppCreateRequest($api_app_create_request); + $request = $this->apiAppCreateRequest($api_app_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -190,51 +189,73 @@ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_crea sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 201) { - if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 201: + if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\ApiAppGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -243,28 +264,19 @@ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_crea $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 201) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ApiAppGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\ApiAppGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -275,13 +287,14 @@ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_crea * Create API App * * @param Model\ApiAppCreateRequest $api_app_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppCreateAsync(Model\ApiAppCreateRequest $api_app_create_request) + public function apiAppCreateAsync(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { - return $this->apiAppCreateAsyncWithHttpInfo($api_app_create_request) + return $this->apiAppCreateAsyncWithHttpInfo($api_app_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -295,23 +308,27 @@ function ($response) { * Create API App * * @param Model\ApiAppCreateRequest $api_app_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppCreateAsyncWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request) + public function apiAppCreateAsyncWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; - $request = $this->apiAppCreateRequest($api_app_create_request); + $request = $this->apiAppCreateRequest($api_app_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -331,7 +348,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -341,11 +358,12 @@ function ($exception) { * Create request for operation 'apiAppCreate' * * @param Model\ApiAppCreateRequest $api_app_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_request) + public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { // verify the required parameter 'api_app_create_request' is set if ($api_app_create_request === null || (is_array($api_app_create_request) && count($api_app_create_request) === 0)) { @@ -355,9 +373,11 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re } $resourcePath = '/api_app'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $api_app_create_request @@ -365,21 +385,17 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_create_request)); } else { $httpBody = $api_app_create_request; } @@ -398,9 +414,9 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -408,12 +424,13 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re $payloadHook('multipart', $multipartContents, $api_app_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -437,11 +454,11 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -452,15 +469,15 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re * * Delete API App * - * @param string $client_id The client id of the API App to delete. (required) + * @param string $client_id The client id of the API App to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ - public function apiAppDelete(string $client_id) + public function apiAppDelete(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { - $this->apiAppDeleteWithHttpInfo($client_id); + $this->apiAppDeleteWithHttpInfo($client_id, $contentType); } /** @@ -468,32 +485,32 @@ public function apiAppDelete(string $client_id) * * Delete API App * - * @param string $client_id The client id of the API App to delete. (required) + * @param string $client_id The client id of the API App to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function apiAppDeleteWithHttpInfo(string $client_id) + public function apiAppDeleteWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { - $request = $this->apiAppDeleteRequest($client_id); + $request = $this->apiAppDeleteRequest($client_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -506,29 +523,21 @@ public function apiAppDeleteWithHttpInfo(string $client_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -538,14 +547,15 @@ public function apiAppDeleteWithHttpInfo(string $client_id) * * Delete API App * - * @param string $client_id The client id of the API App to delete. (required) + * @param string $client_id The client id of the API App to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppDeleteAsync(string $client_id) + public function apiAppDeleteAsync(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { - return $this->apiAppDeleteAsyncWithHttpInfo($client_id) + return $this->apiAppDeleteAsyncWithHttpInfo($client_id, $contentType) ->then( function ($response) { return $response[0]; @@ -558,15 +568,16 @@ function ($response) { * * Delete API App * - * @param string $client_id The client id of the API App to delete. (required) + * @param string $client_id The client id of the API App to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppDeleteAsyncWithHttpInfo(string $client_id) + public function apiAppDeleteAsyncWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { $returnType = ''; - $request = $this->apiAppDeleteRequest($client_id); + $request = $this->apiAppDeleteRequest($client_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -585,7 +596,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -594,12 +605,13 @@ function ($exception) { /** * Create request for operation 'apiAppDelete' * - * @param string $client_id The client id of the API App to delete. (required) + * @param string $client_id The client id of the API App to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function apiAppDeleteRequest(string $client_id) + public function apiAppDeleteRequest(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { // verify the required parameter 'client_id' is set if ($client_id === null || (is_array($client_id) && count($client_id) === 0)) { @@ -609,32 +621,26 @@ public function apiAppDeleteRequest(string $client_id) } $resourcePath = '/api_app/{client_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($client_id !== null) { $resourcePath = str_replace( - '{' . 'client_id' . '}', + '{client_id}', ObjectSerializer::toPathValue($client_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -652,18 +658,19 @@ public function apiAppDeleteRequest(string $client_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -687,11 +694,11 @@ public function apiAppDeleteRequest(string $client_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -702,16 +709,16 @@ public function apiAppDeleteRequest(string $client_id) * * Get API App * - * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\ApiAppGetResponse */ - public function apiAppGet(string $client_id) + public function apiAppGet(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { - list($response) = $this->apiAppGetWithHttpInfo($client_id); - + list($response) = $this->apiAppGetWithHttpInfo($client_id, $contentType); return $response; } @@ -720,32 +727,32 @@ public function apiAppGet(string $client_id) * * Get API App * - * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function apiAppGetWithHttpInfo(string $client_id) + public function apiAppGetWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { - $request = $this->apiAppGetRequest($client_id); + $request = $this->apiAppGetRequest($client_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -758,51 +765,73 @@ public function apiAppGetWithHttpInfo(string $client_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\ApiAppGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -811,28 +840,19 @@ public function apiAppGetWithHttpInfo(string $client_id) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ApiAppGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\ApiAppGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -842,14 +862,15 @@ public function apiAppGetWithHttpInfo(string $client_id) * * Get API App * - * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppGetAsync(string $client_id) + public function apiAppGetAsync(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { - return $this->apiAppGetAsyncWithHttpInfo($client_id) + return $this->apiAppGetAsyncWithHttpInfo($client_id, $contentType) ->then( function ($response) { return $response[0]; @@ -862,24 +883,28 @@ function ($response) { * * Get API App * - * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppGetAsyncWithHttpInfo(string $client_id) + public function apiAppGetAsyncWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; - $request = $this->apiAppGetRequest($client_id); + $request = $this->apiAppGetRequest($client_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -899,7 +924,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -908,12 +933,13 @@ function ($exception) { /** * Create request for operation 'apiAppGet' * - * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $client_id The client id of the API App to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function apiAppGetRequest(string $client_id) + public function apiAppGetRequest(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { // verify the required parameter 'client_id' is set if ($client_id === null || (is_array($client_id) && count($client_id) === 0)) { @@ -923,32 +949,26 @@ public function apiAppGetRequest(string $client_id) } $resourcePath = '/api_app/{client_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($client_id !== null) { $resourcePath = str_replace( - '{' . 'client_id' . '}', + '{client_id}', ObjectSerializer::toPathValue($client_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -966,18 +986,19 @@ public function apiAppGetRequest(string $client_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1001,11 +1022,11 @@ public function apiAppGetRequest(string $client_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1016,17 +1037,17 @@ public function apiAppGetRequest(string $client_id) * * List API Apps * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\ApiAppListResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\ApiAppListResponse */ - public function apiAppList(int $page = 1, int $page_size = 20) + public function apiAppList(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { - list($response) = $this->apiAppListWithHttpInfo($page, $page_size); - + list($response) = $this->apiAppListWithHttpInfo($page, $page_size, $contentType); return $response; } @@ -1035,33 +1056,33 @@ public function apiAppList(int $page = 1, int $page_size = 20) * * List API Apps * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\ApiAppListResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20) + public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { - $request = $this->apiAppListRequest($page, $page_size); + $request = $this->apiAppListRequest($page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1074,51 +1095,73 @@ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\ApiAppListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppListResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\ApiAppListResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\ApiAppListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppListResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\ApiAppListResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1127,28 +1170,19 @@ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ApiAppListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\ApiAppListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1158,15 +1192,16 @@ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20) * * List API Apps * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppListAsync(int $page = 1, int $page_size = 20) + public function apiAppListAsync(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { - return $this->apiAppListAsyncWithHttpInfo($page, $page_size) + return $this->apiAppListAsyncWithHttpInfo($page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -1179,25 +1214,29 @@ function ($response) { * * List API Apps * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppListAsyncWithHttpInfo(int $page = 1, int $page_size = 20) + public function apiAppListAsyncWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { $returnType = '\Dropbox\Sign\Model\ApiAppListResponse'; - $request = $this->apiAppListRequest($page, $page_size); + $request = $this->apiAppListRequest($page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1217,7 +1256,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1226,53 +1265,46 @@ function ($exception) { /** * Create request for operation 'apiAppList' * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function apiAppListRequest(int $page = 1, int $page_size = 20) + public function apiAppListRequest(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { $resourcePath = '/api_app/list'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1290,18 +1322,19 @@ public function apiAppListRequest(int $page = 1, int $page_size = 20) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1325,11 +1358,11 @@ public function apiAppListRequest(int $page = 1, int $page_size = 20) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1340,17 +1373,17 @@ public function apiAppListRequest(int $page = 1, int $page_size = 20) * * Update API App * - * @param string $client_id The client id of the API App to update. (required) + * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request api_app_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\ApiAppGetResponse */ - public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) + public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { - list($response) = $this->apiAppUpdateWithHttpInfo($client_id, $api_app_update_request); - + list($response) = $this->apiAppUpdateWithHttpInfo($client_id, $api_app_update_request, $contentType); return $response; } @@ -1359,33 +1392,33 @@ public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_a * * Update API App * - * @param string $client_id The client id of the API App to update. (required) + * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) + public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { - $request = $this->apiAppUpdateRequest($client_id, $api_app_update_request); + $request = $this->apiAppUpdateRequest($client_id, $api_app_update_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1398,51 +1431,73 @@ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\ApiAppGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\ApiAppGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ApiAppGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1451,28 +1506,19 @@ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRe $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ApiAppGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\ApiAppGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1482,15 +1528,16 @@ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRe * * Update API App * - * @param string $client_id The client id of the API App to update. (required) + * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppUpdateAsync(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) + public function apiAppUpdateAsync(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { - return $this->apiAppUpdateAsyncWithHttpInfo($client_id, $api_app_update_request) + return $this->apiAppUpdateAsyncWithHttpInfo($client_id, $api_app_update_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1503,25 +1550,29 @@ function ($response) { * * Update API App * - * @param string $client_id The client id of the API App to update. (required) + * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function apiAppUpdateAsyncWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) + public function apiAppUpdateAsyncWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { $returnType = '\Dropbox\Sign\Model\ApiAppGetResponse'; - $request = $this->apiAppUpdateRequest($client_id, $api_app_update_request); + $request = $this->apiAppUpdateRequest($client_id, $api_app_update_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1541,7 +1592,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1550,13 +1601,14 @@ function ($exception) { /** * Create request for operation 'apiAppUpdate' * - * @param string $client_id The client id of the API App to update. (required) + * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) + public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { // verify the required parameter 'client_id' is set if ($client_id === null || (is_array($client_id) && count($client_id) === 0)) { @@ -1564,6 +1616,7 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest 'Missing the required parameter $client_id when calling apiAppUpdate' ); } + // verify the required parameter 'api_app_update_request' is set if ($api_app_update_request === null || (is_array($api_app_update_request) && count($api_app_update_request) === 0)) { throw new InvalidArgumentException( @@ -1572,9 +1625,11 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest } $resourcePath = '/api_app/{client_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $api_app_update_request @@ -1585,27 +1640,23 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest // path params if ($client_id !== null) { $resourcePath = str_replace( - '{' . 'client_id' . '}', + '{client_id}', ObjectSerializer::toPathValue($client_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_update_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($api_app_update_request)); } else { $httpBody = $api_app_update_request; } @@ -1624,9 +1675,9 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1634,12 +1685,13 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $payloadHook('multipart', $multipartContents, $api_app_update_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1663,11 +1715,11 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1676,12 +1728,12 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -1691,4 +1743,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 3656b9587..8b9a49056 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,44 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * BulkSendJobApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class BulkSendJobApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'bulkSendJobGet' => [ + 'application/json', + ], + 'bulkSendJobList' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,31 +117,23 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation bulkSendJobGet * * Get Bulk Send Job * * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) - * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\BulkSendJobGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\BulkSendJobGetResponse */ - public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $page_size = 20) + public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { - list($response) = $this->bulkSendJobGetWithHttpInfo($bulk_send_job_id, $page, $page_size); - + list($response) = $this->bulkSendJobGetWithHttpInfo($bulk_send_job_id, $page, $page_size, $contentType); return $response; } @@ -155,33 +143,33 @@ public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $pag * Get Bulk Send Job * * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) - * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\BulkSendJobGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20) + public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { - $request = $this->bulkSendJobGetRequest($bulk_send_job_id, $page, $page_size); + $request = $this->bulkSendJobGetRequest($bulk_send_job_id, $page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -194,51 +182,73 @@ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\BulkSendJobGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\BulkSendJobGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\BulkSendJobGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\BulkSendJobGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -247,28 +257,19 @@ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\BulkSendJobGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\BulkSendJobGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -279,15 +280,16 @@ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = * Get Bulk Send Job * * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) - * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function bulkSendJobGetAsync(string $bulk_send_job_id, int $page = 1, int $page_size = 20) + public function bulkSendJobGetAsync(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { - return $this->bulkSendJobGetAsyncWithHttpInfo($bulk_send_job_id, $page, $page_size) + return $this->bulkSendJobGetAsyncWithHttpInfo($bulk_send_job_id, $page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -301,25 +303,29 @@ function ($response) { * Get Bulk Send Job * * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) - * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function bulkSendJobGetAsyncWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20) + public function bulkSendJobGetAsyncWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { $returnType = '\Dropbox\Sign\Model\BulkSendJobGetResponse'; - $request = $this->bulkSendJobGetRequest($bulk_send_job_id, $page, $page_size); + $request = $this->bulkSendJobGetRequest($bulk_send_job_id, $page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -339,7 +345,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -349,13 +355,14 @@ function ($exception) { * Create request for operation 'bulkSendJobGet' * * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) - * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, int $page_size = 20) + public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { // verify the required parameter 'bulk_send_job_id' is set if ($bulk_send_job_id === null || (is_array($bulk_send_job_id) && count($bulk_send_job_id) === 0)) { @@ -365,53 +372,45 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i } $resourcePath = '/bulk_send_job/{bulk_send_job_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($bulk_send_job_id !== null) { $resourcePath = str_replace( - '{' . 'bulk_send_job_id' . '}', + '{bulk_send_job_id}', ObjectSerializer::toPathValue($bulk_send_job_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -429,18 +428,19 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -464,11 +464,11 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -479,17 +479,17 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i * * List Bulk Send Jobs * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\BulkSendJobListResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\BulkSendJobListResponse */ - public function bulkSendJobList(int $page = 1, int $page_size = 20) + public function bulkSendJobList(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { - list($response) = $this->bulkSendJobListWithHttpInfo($page, $page_size); - + list($response) = $this->bulkSendJobListWithHttpInfo($page, $page_size, $contentType); return $response; } @@ -498,33 +498,33 @@ public function bulkSendJobList(int $page = 1, int $page_size = 20) * * List Bulk Send Jobs * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\BulkSendJobListResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20) + public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { - $request = $this->bulkSendJobListRequest($page, $page_size); + $request = $this->bulkSendJobListRequest($page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -537,51 +537,73 @@ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\BulkSendJobListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobListResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\BulkSendJobListResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\BulkSendJobListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobListResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\BulkSendJobListResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -590,28 +612,19 @@ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\BulkSendJobListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\BulkSendJobListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -621,15 +634,16 @@ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20) * * List Bulk Send Jobs * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function bulkSendJobListAsync(int $page = 1, int $page_size = 20) + public function bulkSendJobListAsync(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { - return $this->bulkSendJobListAsyncWithHttpInfo($page, $page_size) + return $this->bulkSendJobListAsyncWithHttpInfo($page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -642,25 +656,29 @@ function ($response) { * * List Bulk Send Jobs * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function bulkSendJobListAsyncWithHttpInfo(int $page = 1, int $page_size = 20) + public function bulkSendJobListAsyncWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { $returnType = '\Dropbox\Sign\Model\BulkSendJobListResponse'; - $request = $this->bulkSendJobListRequest($page, $page_size); + $request = $this->bulkSendJobListRequest($page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -680,7 +698,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -689,53 +707,46 @@ function ($exception) { /** * Create request for operation 'bulkSendJobList' * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function bulkSendJobListRequest(int $page = 1, int $page_size = 20) + public function bulkSendJobListRequest(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { $resourcePath = '/bulk_send_job/list'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -753,18 +764,19 @@ public function bulkSendJobListRequest(int $page = 1, int $page_size = 20) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -788,11 +800,11 @@ public function bulkSendJobListRequest(int $page = 1, int $page_size = 20) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -801,12 +813,12 @@ public function bulkSendJobListRequest(int $page = 1, int $page_size = 20) /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -816,4 +828,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 727145692..87a001311 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,44 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * EmbeddedApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class EmbeddedApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'embeddedEditUrl' => [ + 'application/json', + ], + 'embeddedSignUrl' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,30 +117,22 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation embeddedEditUrl * * Get Embedded Template Edit URL * - * @param string $template_id The id of the template to edit. (required) + * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request embedded_edit_url_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\EmbeddedEditUrlResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\EmbeddedEditUrlResponse */ - public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) + public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { - list($response) = $this->embeddedEditUrlWithHttpInfo($template_id, $embedded_edit_url_request); - + list($response) = $this->embeddedEditUrlWithHttpInfo($template_id, $embedded_edit_url_request, $contentType); return $response; } @@ -153,33 +141,33 @@ public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlReques * * Get Embedded Template Edit URL * - * @param string $template_id The id of the template to edit. (required) + * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\EmbeddedEditUrlResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) + public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { - $request = $this->embeddedEditUrlRequest($template_id, $embedded_edit_url_request); + $request = $this->embeddedEditUrlRequest($template_id, $embedded_edit_url_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -192,51 +180,73 @@ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedE sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\EmbeddedEditUrlResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\EmbeddedEditUrlResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\EmbeddedEditUrlResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\EmbeddedEditUrlResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\EmbeddedEditUrlResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\EmbeddedEditUrlResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -245,28 +255,19 @@ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedE $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\EmbeddedEditUrlResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\EmbeddedEditUrlResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -276,15 +277,16 @@ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedE * * Get Embedded Template Edit URL * - * @param string $template_id The id of the template to edit. (required) + * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function embeddedEditUrlAsync(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) + public function embeddedEditUrlAsync(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { - return $this->embeddedEditUrlAsyncWithHttpInfo($template_id, $embedded_edit_url_request) + return $this->embeddedEditUrlAsyncWithHttpInfo($template_id, $embedded_edit_url_request, $contentType) ->then( function ($response) { return $response[0]; @@ -297,25 +299,29 @@ function ($response) { * * Get Embedded Template Edit URL * - * @param string $template_id The id of the template to edit. (required) + * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function embeddedEditUrlAsyncWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) + public function embeddedEditUrlAsyncWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { $returnType = '\Dropbox\Sign\Model\EmbeddedEditUrlResponse'; - $request = $this->embeddedEditUrlRequest($template_id, $embedded_edit_url_request); + $request = $this->embeddedEditUrlRequest($template_id, $embedded_edit_url_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -335,7 +341,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -344,13 +350,14 @@ function ($exception) { /** * Create request for operation 'embeddedEditUrl' * - * @param string $template_id The id of the template to edit. (required) + * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) + public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -358,6 +365,7 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr 'Missing the required parameter $template_id when calling embeddedEditUrl' ); } + // verify the required parameter 'embedded_edit_url_request' is set if ($embedded_edit_url_request === null || (is_array($embedded_edit_url_request) && count($embedded_edit_url_request) === 0)) { throw new InvalidArgumentException( @@ -366,9 +374,11 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr } $resourcePath = '/embedded/edit_url/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $embedded_edit_url_request @@ -379,27 +389,23 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($embedded_edit_url_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($embedded_edit_url_request)); } else { $httpBody = $embedded_edit_url_request; } @@ -418,9 +424,9 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -428,12 +434,13 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr $payloadHook('multipart', $multipartContents, $embedded_edit_url_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -457,11 +464,11 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -473,15 +480,15 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr * Get Embedded Sign URL * * @param string $signature_id The id of the signature to get a signature url for. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\EmbeddedSignUrlResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\EmbeddedSignUrlResponse */ - public function embeddedSignUrl(string $signature_id) + public function embeddedSignUrl(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { - list($response) = $this->embeddedSignUrlWithHttpInfo($signature_id); - + list($response) = $this->embeddedSignUrlWithHttpInfo($signature_id, $contentType); return $response; } @@ -491,31 +498,31 @@ public function embeddedSignUrl(string $signature_id) * Get Embedded Sign URL * * @param string $signature_id The id of the signature to get a signature url for. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\EmbeddedSignUrlResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function embeddedSignUrlWithHttpInfo(string $signature_id) + public function embeddedSignUrlWithHttpInfo(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { - $request = $this->embeddedSignUrlRequest($signature_id); + $request = $this->embeddedSignUrlRequest($signature_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -528,51 +535,73 @@ public function embeddedSignUrlWithHttpInfo(string $signature_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\EmbeddedSignUrlResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\EmbeddedSignUrlResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\EmbeddedSignUrlResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\EmbeddedSignUrlResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\EmbeddedSignUrlResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\EmbeddedSignUrlResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -581,28 +610,19 @@ public function embeddedSignUrlWithHttpInfo(string $signature_id) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\EmbeddedSignUrlResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\EmbeddedSignUrlResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -613,13 +633,14 @@ public function embeddedSignUrlWithHttpInfo(string $signature_id) * Get Embedded Sign URL * * @param string $signature_id The id of the signature to get a signature url for. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function embeddedSignUrlAsync(string $signature_id) + public function embeddedSignUrlAsync(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { - return $this->embeddedSignUrlAsyncWithHttpInfo($signature_id) + return $this->embeddedSignUrlAsyncWithHttpInfo($signature_id, $contentType) ->then( function ($response) { return $response[0]; @@ -633,23 +654,27 @@ function ($response) { * Get Embedded Sign URL * * @param string $signature_id The id of the signature to get a signature url for. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function embeddedSignUrlAsyncWithHttpInfo(string $signature_id) + public function embeddedSignUrlAsyncWithHttpInfo(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { $returnType = '\Dropbox\Sign\Model\EmbeddedSignUrlResponse'; - $request = $this->embeddedSignUrlRequest($signature_id); + $request = $this->embeddedSignUrlRequest($signature_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -669,7 +694,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -679,11 +704,12 @@ function ($exception) { * Create request for operation 'embeddedSignUrl' * * @param string $signature_id The id of the signature to get a signature url for. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function embeddedSignUrlRequest(string $signature_id) + public function embeddedSignUrlRequest(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { // verify the required parameter 'signature_id' is set if ($signature_id === null || (is_array($signature_id) && count($signature_id) === 0)) { @@ -693,32 +719,26 @@ public function embeddedSignUrlRequest(string $signature_id) } $resourcePath = '/embedded/sign_url/{signature_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_id !== null) { $resourcePath = str_replace( - '{' . 'signature_id' . '}', + '{signature_id}', ObjectSerializer::toPathValue($signature_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -736,18 +756,19 @@ public function embeddedSignUrlRequest(string $signature_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -771,11 +792,11 @@ public function embeddedSignUrlRequest(string $signature_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -784,12 +805,12 @@ public function embeddedSignUrlRequest(string $signature_id) /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -799,4 +820,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 8f52cb8a9..5a34bd087 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,44 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * OAuthApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class OAuthApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'oauthTokenGenerate' => [ + 'application/json', + ], + 'oauthTokenRefresh' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,32 +117,27 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation oauthTokenGenerate * * OAuth Token Generate * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request o_auth_token_generate_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\OAuthTokenResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) + public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { - list($response) = $this->oauthTokenGenerateWithHttpInfo($o_auth_token_generate_request); - + list($response) = $this->oauthTokenGenerateWithHttpInfo($o_auth_token_generate_request, $hostIndex, $variables, $contentType); return $response; } @@ -155,35 +146,38 @@ public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token * * OAuth Token Generate * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\OAuthTokenResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) + public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { - $request = $this->oauthTokenGenerateRequest($o_auth_token_generate_request); + $request = $this->oauthTokenGenerateRequest($o_auth_token_generate_request, $hostIndex, $variables, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -196,35 +190,64 @@ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\OAuthTokenResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\OAuthTokenResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\OAuthTokenResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\OAuthTokenResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\OAuthTokenResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\OAuthTokenResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -233,17 +256,16 @@ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\OAuthTokenResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\OAuthTokenResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -253,17 +275,21 @@ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $ * * OAuth Token Generate * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function oauthTokenGenerateAsync(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) + public function oauthTokenGenerateAsync(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { - return $this->oauthTokenGenerateAsyncWithHttpInfo($o_auth_token_generate_request) + return $this->oauthTokenGenerateAsyncWithHttpInfo($o_auth_token_generate_request, $hostIndex, $variables, $contentType) ->then( function ($response) { return $response[0]; @@ -276,27 +302,34 @@ function ($response) { * * OAuth Token Generate * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function oauthTokenGenerateAsyncWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) + public function oauthTokenGenerateAsyncWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { $returnType = '\Dropbox\Sign\Model\OAuthTokenResponse'; - $request = $this->oauthTokenGenerateRequest($o_auth_token_generate_request); + $request = $this->oauthTokenGenerateRequest($o_auth_token_generate_request, $hostIndex, $variables, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -316,7 +349,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -325,15 +358,19 @@ function ($exception) { /** * Create request for operation 'oauthTokenGenerate' * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) + public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { // verify the required parameter 'o_auth_token_generate_request' is set if ($o_auth_token_generate_request === null || (is_array($o_auth_token_generate_request) && count($o_auth_token_generate_request) === 0)) { @@ -343,9 +380,11 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut } $resourcePath = '/oauth/token'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $o_auth_token_generate_request @@ -353,21 +392,17 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_generate_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_generate_request)); } else { $httpBody = $o_auth_token_generate_request; } @@ -386,9 +421,9 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -396,12 +431,13 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut $payloadHook('multipart', $multipartContents, $o_auth_token_generate_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -416,15 +452,19 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut $headers ); - $operationHosts = ['https://app.hellosign.com']; - if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { - throw new InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than " . sizeof($operationHosts)); + // Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; } - $operationHost = $operationHosts[$this->hostIndex]; - $query = Psr7\Query::build($queryParams); + $hostSettings = $this->getHostSettingsForoauthTokenGenerate(); - return new Psr7\Request( + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than " . count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, @@ -432,24 +472,42 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut ); } + /** + * Returns an array of host settings for Operation oauthTokenGenerate + * + * @return array an array of host settings + */ + protected function getHostSettingsForoauthTokenGenerate(): array + { + return [ + [ + 'url' => 'https://app.hellosign.com', + 'description' => 'No description provided', + ], + ]; + } + /** * Operation oauthTokenRefresh * * OAuth Token Refresh * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request o_auth_token_refresh_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\OAuthTokenResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) + public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { - list($response) = $this->oauthTokenRefreshWithHttpInfo($o_auth_token_refresh_request); - + list($response) = $this->oauthTokenRefreshWithHttpInfo($o_auth_token_refresh_request, $hostIndex, $variables, $contentType); return $response; } @@ -458,35 +516,38 @@ public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_r * * OAuth Token Refresh * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\OAuthTokenResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) + public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { - $request = $this->oauthTokenRefreshRequest($o_auth_token_refresh_request); + $request = $this->oauthTokenRefreshRequest($o_auth_token_refresh_request, $hostIndex, $variables, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -499,35 +560,64 @@ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\OAuthTokenResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\OAuthTokenResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\OAuthTokenResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\OAuthTokenResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\OAuthTokenResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\OAuthTokenResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -536,17 +626,16 @@ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\OAuthTokenResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\OAuthTokenResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -556,17 +645,21 @@ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_ * * OAuth Token Refresh * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function oauthTokenRefreshAsync(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) + public function oauthTokenRefreshAsync(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { - return $this->oauthTokenRefreshAsyncWithHttpInfo($o_auth_token_refresh_request) + return $this->oauthTokenRefreshAsyncWithHttpInfo($o_auth_token_refresh_request, $hostIndex, $variables, $contentType) ->then( function ($response) { return $response[0]; @@ -579,27 +672,34 @@ function ($response) { * * OAuth Token Refresh * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function oauthTokenRefreshAsyncWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) + public function oauthTokenRefreshAsyncWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { $returnType = '\Dropbox\Sign\Model\OAuthTokenResponse'; - $request = $this->oauthTokenRefreshRequest($o_auth_token_refresh_request); + $request = $this->oauthTokenRefreshRequest($o_auth_token_refresh_request, $hostIndex, $variables, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -619,7 +719,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -628,15 +728,19 @@ function ($exception) { /** * Create request for operation 'oauthTokenRefresh' * - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request (required) + * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) + public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { // verify the required parameter 'o_auth_token_refresh_request' is set if ($o_auth_token_refresh_request === null || (is_array($o_auth_token_refresh_request) && count($o_auth_token_refresh_request) === 0)) { @@ -646,9 +750,11 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ } $resourcePath = '/oauth/token?refresh'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $o_auth_token_refresh_request @@ -656,21 +762,17 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_refresh_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($o_auth_token_refresh_request)); } else { $httpBody = $o_auth_token_refresh_request; } @@ -689,9 +791,9 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -699,12 +801,13 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ $payloadHook('multipart', $multipartContents, $o_auth_token_refresh_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -719,15 +822,19 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ $headers ); - $operationHosts = ['https://app.hellosign.com']; - if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { - throw new InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than " . sizeof($operationHosts)); + // Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; } - $operationHost = $operationHosts[$this->hostIndex]; - $query = Psr7\Query::build($queryParams); + $hostSettings = $this->getHostSettingsForoauthTokenRefresh(); - return new Psr7\Request( + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than " . count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, @@ -735,15 +842,30 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ ); } + /** + * Returns an array of host settings for Operation oauthTokenRefresh + * + * @return array an array of host settings + */ + protected function getHostSettingsForoauthTokenRefresh(): array + { + return [ + [ + 'url' => 'https://app.hellosign.com', + 'description' => 'No description provided', + ], + ]; + } + /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -753,4 +875,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 4c4cedadc..904c6dd92 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,41 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * ReportApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class ReportApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'reportCreate' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,29 +114,21 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation reportCreate * * Create Report * * @param Model\ReportCreateRequest $report_create_request report_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\ReportCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\ReportCreateResponse */ - public function reportCreate(Model\ReportCreateRequest $report_create_request) + public function reportCreate(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { - list($response) = $this->reportCreateWithHttpInfo($report_create_request); - + list($response) = $this->reportCreateWithHttpInfo($report_create_request, $contentType); return $response; } @@ -153,31 +138,31 @@ public function reportCreate(Model\ReportCreateRequest $report_create_request) * Create Report * * @param Model\ReportCreateRequest $report_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\ReportCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_create_request) + public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { - $request = $this->reportCreateRequest($report_create_request); + $request = $this->reportCreateRequest($report_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -190,51 +175,73 @@ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_creat sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\ReportCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ReportCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\ReportCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\ReportCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\ReportCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\ReportCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -243,28 +250,19 @@ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_creat $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ReportCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\ReportCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -275,13 +273,14 @@ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_creat * Create Report * * @param Model\ReportCreateRequest $report_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function reportCreateAsync(Model\ReportCreateRequest $report_create_request) + public function reportCreateAsync(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { - return $this->reportCreateAsyncWithHttpInfo($report_create_request) + return $this->reportCreateAsyncWithHttpInfo($report_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -295,23 +294,27 @@ function ($response) { * Create Report * * @param Model\ReportCreateRequest $report_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function reportCreateAsyncWithHttpInfo(Model\ReportCreateRequest $report_create_request) + public function reportCreateAsyncWithHttpInfo(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { $returnType = '\Dropbox\Sign\Model\ReportCreateResponse'; - $request = $this->reportCreateRequest($report_create_request); + $request = $this->reportCreateRequest($report_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -331,7 +334,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -341,11 +344,12 @@ function ($exception) { * Create request for operation 'reportCreate' * * @param Model\ReportCreateRequest $report_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function reportCreateRequest(Model\ReportCreateRequest $report_create_request) + public function reportCreateRequest(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { // verify the required parameter 'report_create_request' is set if ($report_create_request === null || (is_array($report_create_request) && count($report_create_request) === 0)) { @@ -355,9 +359,11 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req } $resourcePath = '/report/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $report_create_request @@ -365,21 +371,17 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($report_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($report_create_request)); } else { $httpBody = $report_create_request; } @@ -398,9 +400,9 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -408,12 +410,13 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req $payloadHook('multipart', $multipartContents, $report_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -433,11 +436,11 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -446,12 +449,12 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -461,4 +464,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index 3de87a5da..3b1357caa 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,12 +35,11 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; use SplFileObject; @@ -49,35 +47,81 @@ * SignatureRequestApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class SignatureRequestApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'signatureRequestBulkCreateEmbeddedWithTemplate' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestBulkSendWithTemplate' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestCancel' => [ + 'application/json', + ], + 'signatureRequestCreateEmbedded' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestCreateEmbeddedWithTemplate' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestFiles' => [ + 'application/json', + ], + 'signatureRequestFilesAsDataUri' => [ + 'application/json', + ], + 'signatureRequestFilesAsFileUrl' => [ + 'application/json', + ], + 'signatureRequestGet' => [ + 'application/json', + ], + 'signatureRequestList' => [ + 'application/json', + ], + 'signatureRequestReleaseHold' => [ + 'application/json', + ], + 'signatureRequestRemind' => [ + 'application/json', + ], + 'signatureRequestRemove' => [ + 'application/json', + ], + 'signatureRequestSend' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestSendWithTemplate' => [ + 'application/json', + 'multipart/form-data', + ], + 'signatureRequestUpdate' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -122,29 +166,21 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation signatureRequestBulkCreateEmbeddedWithTemplate * * Embedded Bulk Send with Template * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request signature_request_bulk_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\BulkSendJobSendResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\BulkSendJobSendResponse */ - public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) + public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { - list($response) = $this->signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo($signature_request_bulk_create_embedded_with_template_request); - + list($response) = $this->signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo($signature_request_bulk_create_embedded_with_template_request, $contentType); return $response; } @@ -154,31 +190,31 @@ public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRe * Embedded Bulk Send with Template * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\BulkSendJobSendResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) + public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { - $request = $this->signatureRequestBulkCreateEmbeddedWithTemplateRequest($signature_request_bulk_create_embedded_with_template_request); + $request = $this->signatureRequestBulkCreateEmbeddedWithTemplateRequest($signature_request_bulk_create_embedded_with_template_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -191,51 +227,73 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobSendResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobSendResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\BulkSendJobSendResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -244,28 +302,19 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\BulkSendJobSendResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\BulkSendJobSendResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -276,13 +325,14 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model * Embedded Bulk Send with Template * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestBulkCreateEmbeddedWithTemplateAsync(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) + public function signatureRequestBulkCreateEmbeddedWithTemplateAsync(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { - return $this->signatureRequestBulkCreateEmbeddedWithTemplateAsyncWithHttpInfo($signature_request_bulk_create_embedded_with_template_request) + return $this->signatureRequestBulkCreateEmbeddedWithTemplateAsyncWithHttpInfo($signature_request_bulk_create_embedded_with_template_request, $contentType) ->then( function ($response) { return $response[0]; @@ -296,23 +346,27 @@ function ($response) { * Embedded Bulk Send with Template * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestBulkCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) + public function signatureRequestBulkCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { $returnType = '\Dropbox\Sign\Model\BulkSendJobSendResponse'; - $request = $this->signatureRequestBulkCreateEmbeddedWithTemplateRequest($signature_request_bulk_create_embedded_with_template_request); + $request = $this->signatureRequestBulkCreateEmbeddedWithTemplateRequest($signature_request_bulk_create_embedded_with_template_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -332,7 +386,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -342,11 +396,12 @@ function ($exception) { * Create request for operation 'signatureRequestBulkCreateEmbeddedWithTemplate' * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) + public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { // verify the required parameter 'signature_request_bulk_create_embedded_with_template_request' is set if ($signature_request_bulk_create_embedded_with_template_request === null || (is_array($signature_request_bulk_create_embedded_with_template_request) && count($signature_request_bulk_create_embedded_with_template_request) === 0)) { @@ -356,9 +411,11 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign } $resourcePath = '/signature_request/bulk_create_embedded_with_template'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_bulk_create_embedded_with_template_request @@ -366,21 +423,17 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_create_embedded_with_template_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_create_embedded_with_template_request)); } else { $httpBody = $signature_request_bulk_create_embedded_with_template_request; } @@ -399,9 +452,9 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -409,12 +462,13 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign $payloadHook('multipart', $multipartContents, $signature_request_bulk_create_embedded_with_template_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -434,11 +488,11 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -450,15 +504,15 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign * Bulk Send with Template * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request signature_request_bulk_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\BulkSendJobSendResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\BulkSendJobSendResponse */ - public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) + public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { - list($response) = $this->signatureRequestBulkSendWithTemplateWithHttpInfo($signature_request_bulk_send_with_template_request); - + list($response) = $this->signatureRequestBulkSendWithTemplateWithHttpInfo($signature_request_bulk_send_with_template_request, $contentType); return $response; } @@ -468,31 +522,31 @@ public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkS * Bulk Send with Template * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\BulkSendJobSendResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) + public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { - $request = $this->signatureRequestBulkSendWithTemplateRequest($signature_request_bulk_send_with_template_request); + $request = $this->signatureRequestBulkSendWithTemplateRequest($signature_request_bulk_send_with_template_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -505,51 +559,73 @@ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\Signature sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobSendResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\BulkSendJobSendResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\BulkSendJobSendResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\BulkSendJobSendResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -558,28 +634,19 @@ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\Signature $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\BulkSendJobSendResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\BulkSendJobSendResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -590,13 +657,14 @@ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\Signature * Bulk Send with Template * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestBulkSendWithTemplateAsync(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) + public function signatureRequestBulkSendWithTemplateAsync(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { - return $this->signatureRequestBulkSendWithTemplateAsyncWithHttpInfo($signature_request_bulk_send_with_template_request) + return $this->signatureRequestBulkSendWithTemplateAsyncWithHttpInfo($signature_request_bulk_send_with_template_request, $contentType) ->then( function ($response) { return $response[0]; @@ -610,23 +678,27 @@ function ($response) { * Bulk Send with Template * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestBulkSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) + public function signatureRequestBulkSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { $returnType = '\Dropbox\Sign\Model\BulkSendJobSendResponse'; - $request = $this->signatureRequestBulkSendWithTemplateRequest($signature_request_bulk_send_with_template_request); + $request = $this->signatureRequestBulkSendWithTemplateRequest($signature_request_bulk_send_with_template_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -646,7 +718,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -656,11 +728,12 @@ function ($exception) { * Create request for operation 'signatureRequestBulkSendWithTemplate' * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) + public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { // verify the required parameter 'signature_request_bulk_send_with_template_request' is set if ($signature_request_bulk_send_with_template_request === null || (is_array($signature_request_bulk_send_with_template_request) && count($signature_request_bulk_send_with_template_request) === 0)) { @@ -670,9 +743,11 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque } $resourcePath = '/signature_request/bulk_send_with_template'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_bulk_send_with_template_request @@ -680,21 +755,17 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_send_with_template_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_bulk_send_with_template_request)); } else { $httpBody = $signature_request_bulk_send_with_template_request; } @@ -713,9 +784,9 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -723,12 +794,13 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque $payloadHook('multipart', $multipartContents, $signature_request_bulk_send_with_template_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -752,11 +824,11 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -768,14 +840,14 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque * Cancel Incomplete Signature Request * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ - public function signatureRequestCancel(string $signature_request_id) + public function signatureRequestCancel(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { - $this->signatureRequestCancelWithHttpInfo($signature_request_id); + $this->signatureRequestCancelWithHttpInfo($signature_request_id, $contentType); } /** @@ -784,31 +856,31 @@ public function signatureRequestCancel(string $signature_request_id) * Cancel Incomplete Signature Request * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestCancelWithHttpInfo(string $signature_request_id) + public function signatureRequestCancelWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { - $request = $this->signatureRequestCancelRequest($signature_request_id); + $request = $this->signatureRequestCancelRequest($signature_request_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -821,29 +893,21 @@ public function signatureRequestCancelWithHttpInfo(string $signature_request_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -854,13 +918,14 @@ public function signatureRequestCancelWithHttpInfo(string $signature_request_id) * Cancel Incomplete Signature Request * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCancelAsync(string $signature_request_id) + public function signatureRequestCancelAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { - return $this->signatureRequestCancelAsyncWithHttpInfo($signature_request_id) + return $this->signatureRequestCancelAsyncWithHttpInfo($signature_request_id, $contentType) ->then( function ($response) { return $response[0]; @@ -874,14 +939,15 @@ function ($response) { * Cancel Incomplete Signature Request * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCancelAsyncWithHttpInfo(string $signature_request_id) + public function signatureRequestCancelAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { $returnType = ''; - $request = $this->signatureRequestCancelRequest($signature_request_id); + $request = $this->signatureRequestCancelRequest($signature_request_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -900,7 +966,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -910,11 +976,12 @@ function ($exception) { * Create request for operation 'signatureRequestCancel' * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestCancelRequest(string $signature_request_id) + public function signatureRequestCancelRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -924,32 +991,26 @@ public function signatureRequestCancelRequest(string $signature_request_id) } $resourcePath = '/signature_request/cancel/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -967,18 +1028,19 @@ public function signatureRequestCancelRequest(string $signature_request_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1002,11 +1064,11 @@ public function signatureRequestCancelRequest(string $signature_request_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1018,15 +1080,15 @@ public function signatureRequestCancelRequest(string $signature_request_id) * Create Embedded Signature Request * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request signature_request_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) + public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { - list($response) = $this->signatureRequestCreateEmbeddedWithHttpInfo($signature_request_create_embedded_request); - + list($response) = $this->signatureRequestCreateEmbeddedWithHttpInfo($signature_request_create_embedded_request, $contentType); return $response; } @@ -1036,31 +1098,31 @@ public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbed * Create Embedded Signature Request * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) + public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { - $request = $this->signatureRequestCreateEmbeddedRequest($signature_request_create_embedded_request); + $request = $this->signatureRequestCreateEmbeddedRequest($signature_request_create_embedded_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1073,51 +1135,73 @@ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureReques sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1126,28 +1210,19 @@ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureReques $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1158,13 +1233,14 @@ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureReques * Create Embedded Signature Request * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCreateEmbeddedAsync(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) + public function signatureRequestCreateEmbeddedAsync(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { - return $this->signatureRequestCreateEmbeddedAsyncWithHttpInfo($signature_request_create_embedded_request) + return $this->signatureRequestCreateEmbeddedAsyncWithHttpInfo($signature_request_create_embedded_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1178,23 +1254,27 @@ function ($response) { * Create Embedded Signature Request * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCreateEmbeddedAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) + public function signatureRequestCreateEmbeddedAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestCreateEmbeddedRequest($signature_request_create_embedded_request); + $request = $this->signatureRequestCreateEmbeddedRequest($signature_request_create_embedded_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1214,7 +1294,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1224,11 +1304,12 @@ function ($exception) { * Create request for operation 'signatureRequestCreateEmbedded' * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) + public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { // verify the required parameter 'signature_request_create_embedded_request' is set if ($signature_request_create_embedded_request === null || (is_array($signature_request_create_embedded_request) && count($signature_request_create_embedded_request) === 0)) { @@ -1238,9 +1319,11 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea } $resourcePath = '/signature_request/create_embedded'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_create_embedded_request @@ -1248,21 +1331,17 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_request)); } else { $httpBody = $signature_request_create_embedded_request; } @@ -1281,9 +1360,9 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1291,12 +1370,13 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1320,11 +1400,11 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1336,15 +1416,15 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea * Create Embedded Signature Request with Template * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request signature_request_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) + public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { - list($response) = $this->signatureRequestCreateEmbeddedWithTemplateWithHttpInfo($signature_request_create_embedded_with_template_request); - + list($response) = $this->signatureRequestCreateEmbeddedWithTemplateWithHttpInfo($signature_request_create_embedded_with_template_request, $contentType); return $response; } @@ -1354,31 +1434,31 @@ public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureReques * Create Embedded Signature Request with Template * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) + public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { - $request = $this->signatureRequestCreateEmbeddedWithTemplateRequest($signature_request_create_embedded_with_template_request); + $request = $this->signatureRequestCreateEmbeddedWithTemplateRequest($signature_request_create_embedded_with_template_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1391,51 +1471,73 @@ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\Sig sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1444,28 +1546,19 @@ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\Sig $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1476,13 +1569,14 @@ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\Sig * Create Embedded Signature Request with Template * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCreateEmbeddedWithTemplateAsync(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) + public function signatureRequestCreateEmbeddedWithTemplateAsync(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { - return $this->signatureRequestCreateEmbeddedWithTemplateAsyncWithHttpInfo($signature_request_create_embedded_with_template_request) + return $this->signatureRequestCreateEmbeddedWithTemplateAsyncWithHttpInfo($signature_request_create_embedded_with_template_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1496,23 +1590,27 @@ function ($response) { * Create Embedded Signature Request with Template * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) + public function signatureRequestCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestCreateEmbeddedWithTemplateRequest($signature_request_create_embedded_with_template_request); + $request = $this->signatureRequestCreateEmbeddedWithTemplateRequest($signature_request_create_embedded_with_template_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1532,7 +1630,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1542,11 +1640,12 @@ function ($exception) { * Create request for operation 'signatureRequestCreateEmbeddedWithTemplate' * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) + public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { // verify the required parameter 'signature_request_create_embedded_with_template_request' is set if ($signature_request_create_embedded_with_template_request === null || (is_array($signature_request_create_embedded_with_template_request) && count($signature_request_create_embedded_with_template_request) === 0)) { @@ -1556,9 +1655,11 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur } $resourcePath = '/signature_request/create_embedded_with_template'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_create_embedded_with_template_request @@ -1566,21 +1667,17 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_with_template_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_create_embedded_with_template_request)); } else { $httpBody = $signature_request_create_embedded_with_template_request; } @@ -1599,9 +1696,9 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1609,12 +1706,13 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_with_template_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1638,11 +1736,11 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1654,16 +1752,16 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur * Download Files * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return SplFileObject|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return SplFileObject */ - public function signatureRequestFiles(string $signature_request_id, string $file_type = 'pdf') + public function signatureRequestFiles(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { - list($response) = $this->signatureRequestFilesWithHttpInfo($signature_request_id, $file_type); - + list($response) = $this->signatureRequestFilesWithHttpInfo($signature_request_id, $file_type, $contentType); return $response; } @@ -1673,32 +1771,32 @@ public function signatureRequestFiles(string $signature_request_id, string $file * Download Files * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of \SplFileObject|\Dropbox\Sign\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestFilesWithHttpInfo(string $signature_request_id, string $file_type = 'pdf') + public function signatureRequestFilesWithHttpInfo(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { - $request = $this->signatureRequestFilesRequest($signature_request_id, $file_type); + $request = $this->signatureRequestFilesRequest($signature_request_id, $file_type, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1711,51 +1809,73 @@ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\SplFileObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\SplFileObject', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\SplFileObject' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\SplFileObject' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\SplFileObject'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1764,28 +1884,19 @@ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\SplFileObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1796,14 +1907,15 @@ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, * Download Files * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsync(string $signature_request_id, string $file_type = 'pdf') + public function signatureRequestFilesAsync(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { - return $this->signatureRequestFilesAsyncWithHttpInfo($signature_request_id, $file_type) + return $this->signatureRequestFilesAsyncWithHttpInfo($signature_request_id, $file_type, $contentType) ->then( function ($response) { return $response[0]; @@ -1817,24 +1929,28 @@ function ($response) { * Download Files * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsyncWithHttpInfo(string $signature_request_id, string $file_type = 'pdf') + public function signatureRequestFilesAsyncWithHttpInfo(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { $returnType = '\SplFileObject'; - $request = $this->signatureRequestFilesRequest($signature_request_id, $file_type); + $request = $this->signatureRequestFilesRequest($signature_request_id, $file_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1854,7 +1970,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1864,12 +1980,13 @@ function ($exception) { * Create request for operation 'signatureRequestFiles' * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestFilesRequest(string $signature_request_id, string $file_type = 'pdf') + public function signatureRequestFilesRequest(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -1879,43 +1996,36 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin } $resourcePath = '/signature_request/files/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($file_type !== null) { - if ('form' === 'form' && is_array($file_type)) { - foreach ($file_type as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['file_type'] = $file_type; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_type, + 'file_type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/pdf', 'application/zip', 'application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/pdf', 'application/zip', 'application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1933,18 +2043,19 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1968,11 +2079,11 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1984,15 +2095,15 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin * Download Files as Data Uri * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\FileResponseDataUri|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\FileResponseDataUri */ - public function signatureRequestFilesAsDataUri(string $signature_request_id) + public function signatureRequestFilesAsDataUri(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { - list($response) = $this->signatureRequestFilesAsDataUriWithHttpInfo($signature_request_id); - + list($response) = $this->signatureRequestFilesAsDataUriWithHttpInfo($signature_request_id, $contentType); return $response; } @@ -2002,31 +2113,31 @@ public function signatureRequestFilesAsDataUri(string $signature_request_id) * Download Files as Data Uri * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FileResponseDataUri, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_request_id) + public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { - $request = $this->signatureRequestFilesAsDataUriRequest($signature_request_id); + $request = $this->signatureRequestFilesAsDataUriRequest($signature_request_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2039,51 +2150,73 @@ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_req sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FileResponseDataUri' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponseDataUri', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FileResponseDataUri' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FileResponseDataUri' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponseDataUri', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FileResponseDataUri'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2092,28 +2225,19 @@ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_req $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FileResponseDataUri', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FileResponseDataUri', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2124,13 +2248,14 @@ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_req * Download Files as Data Uri * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsDataUriAsync(string $signature_request_id) + public function signatureRequestFilesAsDataUriAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { - return $this->signatureRequestFilesAsDataUriAsyncWithHttpInfo($signature_request_id) + return $this->signatureRequestFilesAsDataUriAsyncWithHttpInfo($signature_request_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2144,23 +2269,27 @@ function ($response) { * Download Files as Data Uri * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsDataUriAsyncWithHttpInfo(string $signature_request_id) + public function signatureRequestFilesAsDataUriAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { $returnType = '\Dropbox\Sign\Model\FileResponseDataUri'; - $request = $this->signatureRequestFilesAsDataUriRequest($signature_request_id); + $request = $this->signatureRequestFilesAsDataUriRequest($signature_request_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2180,7 +2309,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2190,11 +2319,12 @@ function ($exception) { * Create request for operation 'signatureRequestFilesAsDataUri' * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestFilesAsDataUriRequest(string $signature_request_id) + public function signatureRequestFilesAsDataUriRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -2204,32 +2334,26 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ } $resourcePath = '/signature_request/files_as_data_uri/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2247,18 +2371,19 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2282,11 +2407,11 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2298,16 +2423,16 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ * Download Files as File Url * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\FileResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\FileResponse */ - public function signatureRequestFilesAsFileUrl(string $signature_request_id, int $force_download = 1) + public function signatureRequestFilesAsFileUrl(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { - list($response) = $this->signatureRequestFilesAsFileUrlWithHttpInfo($signature_request_id, $force_download); - + list($response) = $this->signatureRequestFilesAsFileUrlWithHttpInfo($signature_request_id, $force_download, $contentType); return $response; } @@ -2317,32 +2442,32 @@ public function signatureRequestFilesAsFileUrl(string $signature_request_id, int * Download Files as File Url * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FileResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_request_id, int $force_download = 1) + public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { - $request = $this->signatureRequestFilesAsFileUrlRequest($signature_request_id, $force_download); + $request = $this->signatureRequestFilesAsFileUrlRequest($signature_request_id, $force_download, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2355,51 +2480,73 @@ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_req sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FileResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FileResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FileResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FileResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2408,28 +2555,19 @@ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_req $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FileResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FileResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2440,14 +2578,15 @@ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_req * Download Files as File Url * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsFileUrlAsync(string $signature_request_id, int $force_download = 1) + public function signatureRequestFilesAsFileUrlAsync(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { - return $this->signatureRequestFilesAsFileUrlAsyncWithHttpInfo($signature_request_id, $force_download) + return $this->signatureRequestFilesAsFileUrlAsyncWithHttpInfo($signature_request_id, $force_download, $contentType) ->then( function ($response) { return $response[0]; @@ -2461,24 +2600,28 @@ function ($response) { * Download Files as File Url * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestFilesAsFileUrlAsyncWithHttpInfo(string $signature_request_id, int $force_download = 1) + public function signatureRequestFilesAsFileUrlAsyncWithHttpInfo(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { $returnType = '\Dropbox\Sign\Model\FileResponse'; - $request = $this->signatureRequestFilesAsFileUrlRequest($signature_request_id, $force_download); + $request = $this->signatureRequestFilesAsFileUrlRequest($signature_request_id, $force_download, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2498,7 +2641,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2508,12 +2651,13 @@ function ($exception) { * Create request for operation 'signatureRequestFilesAsFileUrl' * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestFilesAsFileUrlRequest(string $signature_request_id, int $force_download = 1) + public function signatureRequestFilesAsFileUrlRequest(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -2523,43 +2667,36 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ } $resourcePath = '/signature_request/files_as_file_url/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($force_download !== null) { - if ('form' === 'form' && is_array($force_download)) { - foreach ($force_download as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['force_download'] = $force_download; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force_download, + 'force_download', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2577,18 +2714,19 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2612,11 +2750,11 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2628,15 +2766,15 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ * Get Signature Request * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestGet(string $signature_request_id) + public function signatureRequestGet(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { - list($response) = $this->signatureRequestGetWithHttpInfo($signature_request_id); - + list($response) = $this->signatureRequestGetWithHttpInfo($signature_request_id, $contentType); return $response; } @@ -2646,31 +2784,31 @@ public function signatureRequestGet(string $signature_request_id) * Get Signature Request * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestGetWithHttpInfo(string $signature_request_id) + public function signatureRequestGetWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { - $request = $this->signatureRequestGetRequest($signature_request_id); + $request = $this->signatureRequestGetRequest($signature_request_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2683,51 +2821,73 @@ public function signatureRequestGetWithHttpInfo(string $signature_request_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2736,28 +2896,19 @@ public function signatureRequestGetWithHttpInfo(string $signature_request_id) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2768,13 +2919,14 @@ public function signatureRequestGetWithHttpInfo(string $signature_request_id) * Get Signature Request * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestGetAsync(string $signature_request_id) + public function signatureRequestGetAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { - return $this->signatureRequestGetAsyncWithHttpInfo($signature_request_id) + return $this->signatureRequestGetAsyncWithHttpInfo($signature_request_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2788,23 +2940,27 @@ function ($response) { * Get Signature Request * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestGetAsyncWithHttpInfo(string $signature_request_id) + public function signatureRequestGetAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestGetRequest($signature_request_id); + $request = $this->signatureRequestGetRequest($signature_request_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2824,7 +2980,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2834,11 +2990,12 @@ function ($exception) { * Create request for operation 'signatureRequestGet' * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestGetRequest(string $signature_request_id) + public function signatureRequestGetRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -2848,32 +3005,26 @@ public function signatureRequestGetRequest(string $signature_request_id) } $resourcePath = '/signature_request/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2891,18 +3042,19 @@ public function signatureRequestGetRequest(string $signature_request_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2926,11 +3078,11 @@ public function signatureRequestGetRequest(string $signature_request_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2941,19 +3093,19 @@ public function signatureRequestGetRequest(string $signature_request_id) * * List Signature Requests * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestListResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestListResponse */ - public function signatureRequestList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function signatureRequestList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { - list($response) = $this->signatureRequestListWithHttpInfo($account_id, $page, $page_size, $query); - + list($response) = $this->signatureRequestListWithHttpInfo($account_id, $page, $page_size, $query, $contentType); return $response; } @@ -2962,35 +3114,35 @@ public function signatureRequestList(string $account_id = null, int $page = 1, i * * List Signature Requests * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestListResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function signatureRequestListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { - $request = $this->signatureRequestListRequest($account_id, $page, $page_size, $query); + $request = $this->signatureRequestListRequest($account_id, $page, $page_size, $query, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -3003,51 +3155,73 @@ public function signatureRequestListWithHttpInfo(string $account_id = null, int sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestListResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestListResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestListResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestListResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3056,28 +3230,19 @@ public function signatureRequestListWithHttpInfo(string $account_id = null, int $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3087,17 +3252,18 @@ public function signatureRequestListWithHttpInfo(string $account_id = null, int * * List Signature Requests * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function signatureRequestListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { - return $this->signatureRequestListAsyncWithHttpInfo($account_id, $page, $page_size, $query) + return $this->signatureRequestListAsyncWithHttpInfo($account_id, $page, $page_size, $query, $contentType) ->then( function ($response) { return $response[0]; @@ -3110,27 +3276,31 @@ function ($response) { * * List Signature Requests * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function signatureRequestListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestListResponse'; - $request = $this->signatureRequestListRequest($account_id, $page, $page_size, $query); + $request = $this->signatureRequestListRequest($account_id, $page, $page_size, $query, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3150,7 +3320,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3159,75 +3329,66 @@ function ($exception) { /** * Create request for operation 'signatureRequestList' * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function signatureRequestListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { $resourcePath = '/signature_request/list'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($account_id !== null) { - if ('form' === 'form' && is_array($account_id)) { - foreach ($account_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['account_id'] = $account_id; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_id, + 'account_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($query !== null) { - if ('form' === 'form' && is_array($query)) { - foreach ($query as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['query'] = $query; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -3245,18 +3406,19 @@ public function signatureRequestListRequest(string $account_id = null, int $page // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3280,11 +3442,11 @@ public function signatureRequestListRequest(string $account_id = null, int $page $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3296,15 +3458,15 @@ public function signatureRequestListRequest(string $account_id = null, int $page * Release On-Hold Signature Request * * @param string $signature_request_id The id of the SignatureRequest to release. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestReleaseHold(string $signature_request_id) + public function signatureRequestReleaseHold(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { - list($response) = $this->signatureRequestReleaseHoldWithHttpInfo($signature_request_id); - + list($response) = $this->signatureRequestReleaseHoldWithHttpInfo($signature_request_id, $contentType); return $response; } @@ -3314,31 +3476,31 @@ public function signatureRequestReleaseHold(string $signature_request_id) * Release On-Hold Signature Request * * @param string $signature_request_id The id of the SignatureRequest to release. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestReleaseHoldWithHttpInfo(string $signature_request_id) + public function signatureRequestReleaseHoldWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { - $request = $this->signatureRequestReleaseHoldRequest($signature_request_id); + $request = $this->signatureRequestReleaseHoldRequest($signature_request_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -3351,51 +3513,73 @@ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_reques sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3404,28 +3588,19 @@ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_reques $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3436,13 +3611,14 @@ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_reques * Release On-Hold Signature Request * * @param string $signature_request_id The id of the SignatureRequest to release. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestReleaseHoldAsync(string $signature_request_id) + public function signatureRequestReleaseHoldAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { - return $this->signatureRequestReleaseHoldAsyncWithHttpInfo($signature_request_id) + return $this->signatureRequestReleaseHoldAsyncWithHttpInfo($signature_request_id, $contentType) ->then( function ($response) { return $response[0]; @@ -3456,23 +3632,27 @@ function ($response) { * Release On-Hold Signature Request * * @param string $signature_request_id The id of the SignatureRequest to release. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestReleaseHoldAsyncWithHttpInfo(string $signature_request_id) + public function signatureRequestReleaseHoldAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestReleaseHoldRequest($signature_request_id); + $request = $this->signatureRequestReleaseHoldRequest($signature_request_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3492,7 +3672,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3502,11 +3682,12 @@ function ($exception) { * Create request for operation 'signatureRequestReleaseHold' * * @param string $signature_request_id The id of the SignatureRequest to release. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestReleaseHoldRequest(string $signature_request_id) + public function signatureRequestReleaseHoldRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -3516,32 +3697,26 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id) } $resourcePath = '/signature_request/release_hold/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -3559,18 +3734,19 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3594,11 +3770,11 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3609,17 +3785,17 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id) * * Send Request Reminder * - * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) + * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request signature_request_remind_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestRemind(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) + public function signatureRequestRemind(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { - list($response) = $this->signatureRequestRemindWithHttpInfo($signature_request_id, $signature_request_remind_request); - + list($response) = $this->signatureRequestRemindWithHttpInfo($signature_request_id, $signature_request_remind_request, $contentType); return $response; } @@ -3628,33 +3804,33 @@ public function signatureRequestRemind(string $signature_request_id, Model\Signa * * Send Request Reminder * - * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) + * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestRemindWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) + public function signatureRequestRemindWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { - $request = $this->signatureRequestRemindRequest($signature_request_id, $signature_request_remind_request); + $request = $this->signatureRequestRemindRequest($signature_request_id, $signature_request_remind_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -3667,51 +3843,73 @@ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3720,28 +3918,19 @@ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3751,15 +3940,16 @@ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, * * Send Request Reminder * - * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) + * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestRemindAsync(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) + public function signatureRequestRemindAsync(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { - return $this->signatureRequestRemindAsyncWithHttpInfo($signature_request_id, $signature_request_remind_request) + return $this->signatureRequestRemindAsyncWithHttpInfo($signature_request_id, $signature_request_remind_request, $contentType) ->then( function ($response) { return $response[0]; @@ -3772,25 +3962,29 @@ function ($response) { * * Send Request Reminder * - * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) + * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestRemindAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) + public function signatureRequestRemindAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestRemindRequest($signature_request_id, $signature_request_remind_request); + $request = $this->signatureRequestRemindRequest($signature_request_id, $signature_request_remind_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3810,7 +4004,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3819,13 +4013,14 @@ function ($exception) { /** * Create request for operation 'signatureRequestRemind' * - * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) + * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestRemindRequest(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) + public function signatureRequestRemindRequest(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -3833,6 +4028,7 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode 'Missing the required parameter $signature_request_id when calling signatureRequestRemind' ); } + // verify the required parameter 'signature_request_remind_request' is set if ($signature_request_remind_request === null || (is_array($signature_request_remind_request) && count($signature_request_remind_request) === 0)) { throw new InvalidArgumentException( @@ -3841,9 +4037,11 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode } $resourcePath = '/signature_request/remind/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_remind_request @@ -3854,27 +4052,23 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_remind_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_remind_request)); } else { $httpBody = $signature_request_remind_request; } @@ -3893,9 +4087,9 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -3903,12 +4097,13 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode $payloadHook('multipart', $multipartContents, $signature_request_remind_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3932,11 +4127,11 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3948,14 +4143,14 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode * Remove Signature Request Access * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ - public function signatureRequestRemove(string $signature_request_id) + public function signatureRequestRemove(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { - $this->signatureRequestRemoveWithHttpInfo($signature_request_id); + $this->signatureRequestRemoveWithHttpInfo($signature_request_id, $contentType); } /** @@ -3964,31 +4159,31 @@ public function signatureRequestRemove(string $signature_request_id) * Remove Signature Request Access * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestRemoveWithHttpInfo(string $signature_request_id) + public function signatureRequestRemoveWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { - $request = $this->signatureRequestRemoveRequest($signature_request_id); + $request = $this->signatureRequestRemoveRequest($signature_request_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -4001,29 +4196,21 @@ public function signatureRequestRemoveWithHttpInfo(string $signature_request_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -4034,13 +4221,14 @@ public function signatureRequestRemoveWithHttpInfo(string $signature_request_id) * Remove Signature Request Access * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestRemoveAsync(string $signature_request_id) + public function signatureRequestRemoveAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { - return $this->signatureRequestRemoveAsyncWithHttpInfo($signature_request_id) + return $this->signatureRequestRemoveAsyncWithHttpInfo($signature_request_id, $contentType) ->then( function ($response) { return $response[0]; @@ -4054,14 +4242,15 @@ function ($response) { * Remove Signature Request Access * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestRemoveAsyncWithHttpInfo(string $signature_request_id) + public function signatureRequestRemoveAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { $returnType = ''; - $request = $this->signatureRequestRemoveRequest($signature_request_id); + $request = $this->signatureRequestRemoveRequest($signature_request_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4080,7 +4269,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -4090,11 +4279,12 @@ function ($exception) { * Create request for operation 'signatureRequestRemove' * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestRemoveRequest(string $signature_request_id) + public function signatureRequestRemoveRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -4104,32 +4294,26 @@ public function signatureRequestRemoveRequest(string $signature_request_id) } $resourcePath = '/signature_request/remove/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -4147,18 +4331,19 @@ public function signatureRequestRemoveRequest(string $signature_request_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4178,11 +4363,11 @@ public function signatureRequestRemoveRequest(string $signature_request_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4194,15 +4379,15 @@ public function signatureRequestRemoveRequest(string $signature_request_id) * Send Signature Request * * @param Model\SignatureRequestSendRequest $signature_request_send_request signature_request_send_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestSend(Model\SignatureRequestSendRequest $signature_request_send_request) + public function signatureRequestSend(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { - list($response) = $this->signatureRequestSendWithHttpInfo($signature_request_send_request); - + list($response) = $this->signatureRequestSendWithHttpInfo($signature_request_send_request, $contentType); return $response; } @@ -4212,31 +4397,31 @@ public function signatureRequestSend(Model\SignatureRequestSendRequest $signatur * Send Signature Request * * @param Model\SignatureRequestSendRequest $signature_request_send_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request) + public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { - $request = $this->signatureRequestSendRequest($signature_request_send_request); + $request = $this->signatureRequestSendRequest($signature_request_send_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -4249,51 +4434,73 @@ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendReque sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -4302,28 +4509,19 @@ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendReque $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -4334,13 +4532,14 @@ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendReque * Send Signature Request * * @param Model\SignatureRequestSendRequest $signature_request_send_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestSendAsync(Model\SignatureRequestSendRequest $signature_request_send_request) + public function signatureRequestSendAsync(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { - return $this->signatureRequestSendAsyncWithHttpInfo($signature_request_send_request) + return $this->signatureRequestSendAsyncWithHttpInfo($signature_request_send_request, $contentType) ->then( function ($response) { return $response[0]; @@ -4354,23 +4553,27 @@ function ($response) { * Send Signature Request * * @param Model\SignatureRequestSendRequest $signature_request_send_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestSendAsyncWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request) + public function signatureRequestSendAsyncWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestSendRequest($signature_request_send_request); + $request = $this->signatureRequestSendRequest($signature_request_send_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -4390,7 +4593,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -4400,11 +4603,12 @@ function ($exception) { * Create request for operation 'signatureRequestSend' * * @param Model\SignatureRequestSendRequest $signature_request_send_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $signature_request_send_request) + public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { // verify the required parameter 'signature_request_send_request' is set if ($signature_request_send_request === null || (is_array($signature_request_send_request) && count($signature_request_send_request) === 0)) { @@ -4414,9 +4618,11 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s } $resourcePath = '/signature_request/send'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_send_request @@ -4424,21 +4630,17 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_request)); } else { $httpBody = $signature_request_send_request; } @@ -4457,9 +4659,9 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -4467,12 +4669,13 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s $payloadHook('multipart', $multipartContents, $signature_request_send_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4496,11 +4699,11 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4512,15 +4715,15 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s * Send with Template * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request signature_request_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) + public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { - list($response) = $this->signatureRequestSendWithTemplateWithHttpInfo($signature_request_send_with_template_request); - + list($response) = $this->signatureRequestSendWithTemplateWithHttpInfo($signature_request_send_with_template_request, $contentType); return $response; } @@ -4530,31 +4733,31 @@ public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithT * Send with Template * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) + public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { - $request = $this->signatureRequestSendWithTemplateRequest($signature_request_send_with_template_request); + $request = $this->signatureRequestSendWithTemplateRequest($signature_request_send_with_template_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -4567,51 +4770,73 @@ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -4620,28 +4845,19 @@ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -4652,13 +4868,14 @@ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequ * Send with Template * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestSendWithTemplateAsync(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) + public function signatureRequestSendWithTemplateAsync(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { - return $this->signatureRequestSendWithTemplateAsyncWithHttpInfo($signature_request_send_with_template_request) + return $this->signatureRequestSendWithTemplateAsyncWithHttpInfo($signature_request_send_with_template_request, $contentType) ->then( function ($response) { return $response[0]; @@ -4672,23 +4889,27 @@ function ($response) { * Send with Template * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) + public function signatureRequestSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestSendWithTemplateRequest($signature_request_send_with_template_request); + $request = $this->signatureRequestSendWithTemplateRequest($signature_request_send_with_template_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -4708,7 +4929,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -4718,11 +4939,12 @@ function ($exception) { * Create request for operation 'signatureRequestSendWithTemplate' * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) + public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { // verify the required parameter 'signature_request_send_with_template_request' is set if ($signature_request_send_with_template_request === null || (is_array($signature_request_send_with_template_request) && count($signature_request_send_with_template_request) === 0)) { @@ -4732,9 +4954,11 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe } $resourcePath = '/signature_request/send_with_template'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_send_with_template_request @@ -4742,21 +4966,17 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_with_template_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_send_with_template_request)); } else { $httpBody = $signature_request_send_with_template_request; } @@ -4775,9 +4995,9 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -4785,12 +5005,13 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe $payloadHook('multipart', $multipartContents, $signature_request_send_with_template_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -4814,11 +5035,11 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -4829,17 +5050,17 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe * * Update Signature Request * - * @param string $signature_request_id The id of the SignatureRequest to update. (required) + * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request signature_request_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\SignatureRequestGetResponse */ - public function signatureRequestUpdate(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) + public function signatureRequestUpdate(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { - list($response) = $this->signatureRequestUpdateWithHttpInfo($signature_request_id, $signature_request_update_request); - + list($response) = $this->signatureRequestUpdateWithHttpInfo($signature_request_id, $signature_request_update_request, $contentType); return $response; } @@ -4848,33 +5069,33 @@ public function signatureRequestUpdate(string $signature_request_id, Model\Signa * * Update Signature Request * - * @param string $signature_request_id The id of the SignatureRequest to update. (required) + * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) + public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { - $request = $this->signatureRequestUpdateRequest($signature_request_id, $signature_request_update_request); + $request = $this->signatureRequestUpdateRequest($signature_request_id, $signature_request_update_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -4887,51 +5108,73 @@ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\SignatureRequestGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\SignatureRequestGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -4940,28 +5183,19 @@ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\SignatureRequestGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\SignatureRequestGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -4971,15 +5205,16 @@ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, * * Update Signature Request * - * @param string $signature_request_id The id of the SignatureRequest to update. (required) + * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestUpdateAsync(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) + public function signatureRequestUpdateAsync(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { - return $this->signatureRequestUpdateAsyncWithHttpInfo($signature_request_id, $signature_request_update_request) + return $this->signatureRequestUpdateAsyncWithHttpInfo($signature_request_id, $signature_request_update_request, $contentType) ->then( function ($response) { return $response[0]; @@ -4992,25 +5227,29 @@ function ($response) { * * Update Signature Request * - * @param string $signature_request_id The id of the SignatureRequest to update. (required) + * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function signatureRequestUpdateAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) + public function signatureRequestUpdateAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { $returnType = '\Dropbox\Sign\Model\SignatureRequestGetResponse'; - $request = $this->signatureRequestUpdateRequest($signature_request_id, $signature_request_update_request); + $request = $this->signatureRequestUpdateRequest($signature_request_id, $signature_request_update_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -5030,7 +5269,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -5039,13 +5278,14 @@ function ($exception) { /** * Create request for operation 'signatureRequestUpdate' * - * @param string $signature_request_id The id of the SignatureRequest to update. (required) + * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function signatureRequestUpdateRequest(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) + public function signatureRequestUpdateRequest(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -5053,6 +5293,7 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode 'Missing the required parameter $signature_request_id when calling signatureRequestUpdate' ); } + // verify the required parameter 'signature_request_update_request' is set if ($signature_request_update_request === null || (is_array($signature_request_update_request) && count($signature_request_update_request) === 0)) { throw new InvalidArgumentException( @@ -5061,9 +5302,11 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode } $resourcePath = '/signature_request/update/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $signature_request_update_request @@ -5074,27 +5317,23 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_update_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($signature_request_update_request)); } else { $httpBody = $signature_request_update_request; } @@ -5113,9 +5352,9 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -5123,12 +5362,13 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode $payloadHook('multipart', $multipartContents, $signature_request_update_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -5152,11 +5392,11 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -5165,12 +5405,12 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -5180,4 +5420,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index c0883aa81..8b0df3450 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,68 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * TeamApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class TeamApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'teamAddMember' => [ + 'application/json', + ], + 'teamCreate' => [ + 'application/json', + ], + 'teamDelete' => [ + 'application/json', + ], + 'teamGet' => [ + 'application/json', + ], + 'teamInfo' => [ + 'application/json', + ], + 'teamInvites' => [ + 'application/json', + ], + 'teamMembers' => [ + 'application/json', + ], + 'teamRemoveMember' => [ + 'application/json', + ], + 'teamSubTeams' => [ + 'application/json', + ], + 'teamUpdate' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,30 +141,22 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation teamAddMember * * Add User to Team * * @param Model\TeamAddMemberRequest $team_add_member_request team_add_member_request (required) - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetResponse */ - public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) + public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { - list($response) = $this->teamAddMemberWithHttpInfo($team_add_member_request, $team_id); - + list($response) = $this->teamAddMemberWithHttpInfo($team_add_member_request, $team_id, $contentType); return $response; } @@ -154,32 +166,32 @@ public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_reques * Add User to Team * * @param Model\TeamAddMemberRequest $team_add_member_request (required) - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) + public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { - $request = $this->teamAddMemberRequest($team_add_member_request, $team_id); + $request = $this->teamAddMemberRequest($team_add_member_request, $team_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -192,51 +204,73 @@ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_m sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -245,28 +279,19 @@ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_m $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -277,14 +302,15 @@ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_m * Add User to Team * * @param Model\TeamAddMemberRequest $team_add_member_request (required) - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamAddMemberAsync(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) + public function teamAddMemberAsync(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { - return $this->teamAddMemberAsyncWithHttpInfo($team_add_member_request, $team_id) + return $this->teamAddMemberAsyncWithHttpInfo($team_add_member_request, $team_id, $contentType) ->then( function ($response) { return $response[0]; @@ -298,24 +324,28 @@ function ($response) { * Add User to Team * * @param Model\TeamAddMemberRequest $team_add_member_request (required) - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamAddMemberAsyncWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) + public function teamAddMemberAsyncWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; - $request = $this->teamAddMemberRequest($team_add_member_request, $team_id); + $request = $this->teamAddMemberRequest($team_add_member_request, $team_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -335,7 +365,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -345,12 +375,13 @@ function ($exception) { * Create request for operation 'teamAddMember' * * @param Model\TeamAddMemberRequest $team_add_member_request (required) - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) + public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { // verify the required parameter 'team_add_member_request' is set if ($team_add_member_request === null || (is_array($team_add_member_request) && count($team_add_member_request) === 0)) { @@ -360,9 +391,11 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member } $resourcePath = '/team/add_member'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $team_add_member_request @@ -371,31 +404,26 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member $multipart = !empty($formParams); // query params - if ($team_id !== null) { - if ('form' === 'form' && is_array($team_id)) { - foreach ($team_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['team_id'] = $team_id; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $team_id, + 'team_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_add_member_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_add_member_request)); } else { $httpBody = $team_add_member_request; } @@ -414,9 +442,9 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -424,12 +452,13 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member $payloadHook('multipart', $multipartContents, $team_add_member_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -453,11 +482,11 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -469,15 +498,15 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member * Create Team * * @param Model\TeamCreateRequest $team_create_request team_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetResponse */ - public function teamCreate(Model\TeamCreateRequest $team_create_request) + public function teamCreate(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { - list($response) = $this->teamCreateWithHttpInfo($team_create_request); - + list($response) = $this->teamCreateWithHttpInfo($team_create_request, $contentType); return $response; } @@ -487,31 +516,31 @@ public function teamCreate(Model\TeamCreateRequest $team_create_request) * Create Team * * @param Model\TeamCreateRequest $team_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_request) + public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { - $request = $this->teamCreateRequest($team_create_request); + $request = $this->teamCreateRequest($team_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -524,51 +553,73 @@ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_requ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -577,28 +628,19 @@ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_requ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -609,13 +651,14 @@ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_requ * Create Team * * @param Model\TeamCreateRequest $team_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamCreateAsync(Model\TeamCreateRequest $team_create_request) + public function teamCreateAsync(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { - return $this->teamCreateAsyncWithHttpInfo($team_create_request) + return $this->teamCreateAsyncWithHttpInfo($team_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -629,23 +672,27 @@ function ($response) { * Create Team * * @param Model\TeamCreateRequest $team_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamCreateAsyncWithHttpInfo(Model\TeamCreateRequest $team_create_request) + public function teamCreateAsyncWithHttpInfo(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; - $request = $this->teamCreateRequest($team_create_request); + $request = $this->teamCreateRequest($team_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -665,7 +712,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -675,11 +722,12 @@ function ($exception) { * Create request for operation 'teamCreate' * * @param Model\TeamCreateRequest $team_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) + public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { // verify the required parameter 'team_create_request' is set if ($team_create_request === null || (is_array($team_create_request) && count($team_create_request) === 0)) { @@ -689,9 +737,11 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) } $resourcePath = '/team/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $team_create_request @@ -699,21 +749,17 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_create_request)); } else { $httpBody = $team_create_request; } @@ -732,9 +778,9 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -742,12 +788,13 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) $payloadHook('multipart', $multipartContents, $team_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -771,11 +818,11 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -786,13 +833,14 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request) * * Delete Team * - * @throws ApiException on non-2xx response + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation + * + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ - public function teamDelete() + public function teamDelete(string $contentType = self::contentTypes['teamDelete'][0]) { - $this->teamDeleteWithHttpInfo(); + $this->teamDeleteWithHttpInfo($contentType); } /** @@ -800,30 +848,31 @@ public function teamDelete() * * Delete Team * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation + * * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamDeleteWithHttpInfo() + public function teamDeleteWithHttpInfo(string $contentType = self::contentTypes['teamDelete'][0]) { - $request = $this->teamDeleteRequest(); + $request = $this->teamDeleteRequest($contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -836,29 +885,21 @@ public function teamDeleteWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -868,12 +909,14 @@ public function teamDeleteWithHttpInfo() * * Delete Team * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamDeleteAsync() + public function teamDeleteAsync(string $contentType = self::contentTypes['teamDelete'][0]) { - return $this->teamDeleteAsyncWithHttpInfo() + return $this->teamDeleteAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -886,13 +929,15 @@ function ($response) { * * Delete Team * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamDeleteAsyncWithHttpInfo() + public function teamDeleteAsyncWithHttpInfo(string $contentType = self::contentTypes['teamDelete'][0]) { $returnType = ''; - $request = $this->teamDeleteRequest(); + $request = $this->teamDeleteRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -911,7 +956,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -920,29 +965,25 @@ function ($exception) { /** * Create request for operation 'teamDelete' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation + * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamDeleteRequest() + public function teamDeleteRequest(string $contentType = self::contentTypes['teamDelete'][0]) { $resourcePath = '/team/destroy'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -960,18 +1001,19 @@ public function teamDeleteRequest() // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -995,11 +1037,11 @@ public function teamDeleteRequest() $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1010,14 +1052,15 @@ public function teamDeleteRequest() * * Get Team * - * @throws ApiException on non-2xx response + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation + * + * @return Model\TeamGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetResponse */ - public function teamGet() + public function teamGet(string $contentType = self::contentTypes['teamGet'][0]) { - list($response) = $this->teamGetWithHttpInfo(); - + list($response) = $this->teamGetWithHttpInfo($contentType); return $response; } @@ -1026,30 +1069,31 @@ public function teamGet() * * Get Team * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation + * * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamGetWithHttpInfo() + public function teamGetWithHttpInfo(string $contentType = self::contentTypes['teamGet'][0]) { - $request = $this->teamGetRequest(); + $request = $this->teamGetRequest($contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1062,51 +1106,73 @@ public function teamGetWithHttpInfo() sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1115,28 +1181,19 @@ public function teamGetWithHttpInfo() $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1146,12 +1203,14 @@ public function teamGetWithHttpInfo() * * Get Team * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamGetAsync() + public function teamGetAsync(string $contentType = self::contentTypes['teamGet'][0]) { - return $this->teamGetAsyncWithHttpInfo() + return $this->teamGetAsyncWithHttpInfo($contentType) ->then( function ($response) { return $response[0]; @@ -1164,22 +1223,27 @@ function ($response) { * * Get Team * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation + * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamGetAsyncWithHttpInfo() + public function teamGetAsyncWithHttpInfo(string $contentType = self::contentTypes['teamGet'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; - $request = $this->teamGetRequest(); + $request = $this->teamGetRequest($contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1199,7 +1263,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1208,29 +1272,25 @@ function ($exception) { /** * Create request for operation 'teamGet' * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation + * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamGetRequest() + public function teamGetRequest(string $contentType = self::contentTypes['teamGet'][0]) { $resourcePath = '/team'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1248,18 +1308,19 @@ public function teamGetRequest() // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1283,11 +1344,11 @@ public function teamGetRequest() $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1298,16 +1359,16 @@ public function teamGetRequest() * * Get Team Info * - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamGetInfoResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetInfoResponse */ - public function teamInfo(string $team_id = null) + public function teamInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { - list($response) = $this->teamInfoWithHttpInfo($team_id); - + list($response) = $this->teamInfoWithHttpInfo($team_id, $contentType); return $response; } @@ -1316,32 +1377,32 @@ public function teamInfo(string $team_id = null) * * Get Team Info * - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamGetInfoResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamInfoWithHttpInfo(string $team_id = null) + public function teamInfoWithHttpInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { - $request = $this->teamInfoRequest($team_id); + $request = $this->teamInfoRequest($team_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1354,51 +1415,73 @@ public function teamInfoWithHttpInfo(string $team_id = null) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamGetInfoResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetInfoResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamGetInfoResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetInfoResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetInfoResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetInfoResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1407,28 +1490,19 @@ public function teamInfoWithHttpInfo(string $team_id = null) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetInfoResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetInfoResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1438,14 +1512,15 @@ public function teamInfoWithHttpInfo(string $team_id = null) * * Get Team Info * - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamInfoAsync(string $team_id = null) + public function teamInfoAsync(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { - return $this->teamInfoAsyncWithHttpInfo($team_id) + return $this->teamInfoAsyncWithHttpInfo($team_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1458,24 +1533,28 @@ function ($response) { * * Get Team Info * - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamInfoAsyncWithHttpInfo(string $team_id = null) + public function teamInfoAsyncWithHttpInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetInfoResponse'; - $request = $this->teamInfoRequest($team_id); + $request = $this->teamInfoRequest($team_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1495,7 +1574,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1504,42 +1583,36 @@ function ($exception) { /** * Create request for operation 'teamInfo' * - * @param string $team_id The id of the team. (optional) + * @param string $team_id The id of the team. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamInfoRequest(string $team_id = null) + public function teamInfoRequest(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { $resourcePath = '/team/info'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($team_id !== null) { - if ('form' === 'form' && is_array($team_id)) { - foreach ($team_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['team_id'] = $team_id; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $team_id, + 'team_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1557,18 +1630,19 @@ public function teamInfoRequest(string $team_id = null) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1592,11 +1666,11 @@ public function teamInfoRequest(string $team_id = null) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1608,15 +1682,15 @@ public function teamInfoRequest(string $team_id = null) * List Team Invites * * @param string $email_address The email address for which to display the team invites. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamInvitesResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamInvitesResponse */ - public function teamInvites(string $email_address = null) + public function teamInvites(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { - list($response) = $this->teamInvitesWithHttpInfo($email_address); - + list($response) = $this->teamInvitesWithHttpInfo($email_address, $contentType); return $response; } @@ -1626,31 +1700,31 @@ public function teamInvites(string $email_address = null) * List Team Invites * * @param string $email_address The email address for which to display the team invites. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamInvitesResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamInvitesWithHttpInfo(string $email_address = null) + public function teamInvitesWithHttpInfo(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { - $request = $this->teamInvitesRequest($email_address); + $request = $this->teamInvitesRequest($email_address, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1663,51 +1737,73 @@ public function teamInvitesWithHttpInfo(string $email_address = null) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamInvitesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamInvitesResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamInvitesResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamInvitesResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamInvitesResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamInvitesResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1716,28 +1812,19 @@ public function teamInvitesWithHttpInfo(string $email_address = null) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamInvitesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamInvitesResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1748,13 +1835,14 @@ public function teamInvitesWithHttpInfo(string $email_address = null) * List Team Invites * * @param string $email_address The email address for which to display the team invites. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamInvitesAsync(string $email_address = null) + public function teamInvitesAsync(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { - return $this->teamInvitesAsyncWithHttpInfo($email_address) + return $this->teamInvitesAsyncWithHttpInfo($email_address, $contentType) ->then( function ($response) { return $response[0]; @@ -1768,23 +1856,27 @@ function ($response) { * List Team Invites * * @param string $email_address The email address for which to display the team invites. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamInvitesAsyncWithHttpInfo(string $email_address = null) + public function teamInvitesAsyncWithHttpInfo(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { $returnType = '\Dropbox\Sign\Model\TeamInvitesResponse'; - $request = $this->teamInvitesRequest($email_address); + $request = $this->teamInvitesRequest($email_address, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1804,7 +1896,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1814,41 +1906,35 @@ function ($exception) { * Create request for operation 'teamInvites' * * @param string $email_address The email address for which to display the team invites. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamInvitesRequest(string $email_address = null) + public function teamInvitesRequest(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { $resourcePath = '/team/invites'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($email_address !== null) { - if ('form' === 'form' && is_array($email_address)) { - foreach ($email_address as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['email_address'] = $email_address; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $email_address, + 'email_address', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1866,18 +1952,19 @@ public function teamInvitesRequest(string $email_address = null) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1901,11 +1988,11 @@ public function teamInvitesRequest(string $email_address = null) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1916,18 +2003,18 @@ public function teamInvitesRequest(string $email_address = null) * * List Team Members * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamMembersResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamMembersResponse */ - public function teamMembers(string $team_id, int $page = 1, int $page_size = 20) + public function teamMembers(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { - list($response) = $this->teamMembersWithHttpInfo($team_id, $page, $page_size); - + list($response) = $this->teamMembersWithHttpInfo($team_id, $page, $page_size, $contentType); return $response; } @@ -1936,34 +2023,34 @@ public function teamMembers(string $team_id, int $page = 1, int $page_size = 20) * * List Team Members * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamMembersResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20) + public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { - $request = $this->teamMembersRequest($team_id, $page, $page_size); + $request = $this->teamMembersRequest($team_id, $page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1976,51 +2063,73 @@ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $pag sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamMembersResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamMembersResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamMembersResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamMembersResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamMembersResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamMembersResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2029,28 +2138,19 @@ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $pag $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamMembersResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamMembersResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2060,16 +2160,17 @@ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $pag * * List Team Members * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamMembersAsync(string $team_id, int $page = 1, int $page_size = 20) + public function teamMembersAsync(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { - return $this->teamMembersAsyncWithHttpInfo($team_id, $page, $page_size) + return $this->teamMembersAsyncWithHttpInfo($team_id, $page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -2082,26 +2183,30 @@ function ($response) { * * List Team Members * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamMembersAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20) + public function teamMembersAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { $returnType = '\Dropbox\Sign\Model\TeamMembersResponse'; - $request = $this->teamMembersRequest($team_id, $page, $page_size); + $request = $this->teamMembersRequest($team_id, $page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2121,7 +2226,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2130,14 +2235,15 @@ function ($exception) { /** * Create request for operation 'teamMembers' * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamMembersRequest(string $team_id, int $page = 1, int $page_size = 20) + public function teamMembersRequest(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { // verify the required parameter 'team_id' is set if ($team_id === null || (is_array($team_id) && count($team_id) === 0)) { @@ -2145,6 +2251,7 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz 'Missing the required parameter $team_id when calling teamMembers' ); } + if ($page_size !== null && $page_size > 100) { throw new InvalidArgumentException('invalid value for "$page_size" when calling TeamApi.teamMembers, must be smaller than or equal to 100.'); } @@ -2153,53 +2260,45 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz } $resourcePath = '/team/members/{team_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($team_id !== null) { $resourcePath = str_replace( - '{' . 'team_id' . '}', + '{team_id}', ObjectSerializer::toPathValue($team_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2217,18 +2316,19 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2252,11 +2352,11 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2268,15 +2368,15 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz * Remove User from Team * * @param Model\TeamRemoveMemberRequest $team_remove_member_request team_remove_member_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetResponse */ - public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_member_request) + public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { - list($response) = $this->teamRemoveMemberWithHttpInfo($team_remove_member_request); - + list($response) = $this->teamRemoveMemberWithHttpInfo($team_remove_member_request, $contentType); return $response; } @@ -2286,31 +2386,31 @@ public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_memb * Remove User from Team * * @param Model\TeamRemoveMemberRequest $team_remove_member_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request) + public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { - $request = $this->teamRemoveMemberRequest($team_remove_member_request); + $request = $this->teamRemoveMemberRequest($team_remove_member_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2323,51 +2423,73 @@ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 201) { - if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 201: + if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2376,28 +2498,19 @@ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 201) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2408,13 +2521,14 @@ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team * Remove User from Team * * @param Model\TeamRemoveMemberRequest $team_remove_member_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamRemoveMemberAsync(Model\TeamRemoveMemberRequest $team_remove_member_request) + public function teamRemoveMemberAsync(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { - return $this->teamRemoveMemberAsyncWithHttpInfo($team_remove_member_request) + return $this->teamRemoveMemberAsyncWithHttpInfo($team_remove_member_request, $contentType) ->then( function ($response) { return $response[0]; @@ -2428,23 +2542,27 @@ function ($response) { * Remove User from Team * * @param Model\TeamRemoveMemberRequest $team_remove_member_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamRemoveMemberAsyncWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request) + public function teamRemoveMemberAsyncWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; - $request = $this->teamRemoveMemberRequest($team_remove_member_request); + $request = $this->teamRemoveMemberRequest($team_remove_member_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2464,7 +2582,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2474,11 +2592,12 @@ function ($exception) { * Create request for operation 'teamRemoveMember' * * @param Model\TeamRemoveMemberRequest $team_remove_member_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remove_member_request) + public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { // verify the required parameter 'team_remove_member_request' is set if ($team_remove_member_request === null || (is_array($team_remove_member_request) && count($team_remove_member_request) === 0)) { @@ -2488,9 +2607,11 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo } $resourcePath = '/team/remove_member'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $team_remove_member_request @@ -2498,21 +2619,17 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_remove_member_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_remove_member_request)); } else { $httpBody = $team_remove_member_request; } @@ -2531,9 +2648,9 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -2541,12 +2658,13 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo $payloadHook('multipart', $multipartContents, $team_remove_member_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2570,11 +2688,11 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2585,18 +2703,18 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo * * List Sub Teams * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamSubTeamsResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamSubTeamsResponse */ - public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20) + public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { - list($response) = $this->teamSubTeamsWithHttpInfo($team_id, $page, $page_size); - + list($response) = $this->teamSubTeamsWithHttpInfo($team_id, $page, $page_size, $contentType); return $response; } @@ -2605,34 +2723,34 @@ public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20 * * List Sub Teams * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamSubTeamsResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20) + public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { - $request = $this->teamSubTeamsRequest($team_id, $page, $page_size); + $request = $this->teamSubTeamsRequest($team_id, $page, $page_size, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2645,51 +2763,73 @@ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $pa sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamSubTeamsResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamSubTeamsResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamSubTeamsResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamSubTeamsResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamSubTeamsResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamSubTeamsResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2698,28 +2838,19 @@ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $pa $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamSubTeamsResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamSubTeamsResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2729,16 +2860,17 @@ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $pa * * List Sub Teams * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamSubTeamsAsync(string $team_id, int $page = 1, int $page_size = 20) + public function teamSubTeamsAsync(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { - return $this->teamSubTeamsAsyncWithHttpInfo($team_id, $page, $page_size) + return $this->teamSubTeamsAsyncWithHttpInfo($team_id, $page, $page_size, $contentType) ->then( function ($response) { return $response[0]; @@ -2751,26 +2883,30 @@ function ($response) { * * List Sub Teams * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamSubTeamsAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20) + public function teamSubTeamsAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { $returnType = '\Dropbox\Sign\Model\TeamSubTeamsResponse'; - $request = $this->teamSubTeamsRequest($team_id, $page, $page_size); + $request = $this->teamSubTeamsRequest($team_id, $page, $page_size, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2790,7 +2926,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2799,14 +2935,15 @@ function ($exception) { /** * Create request for operation 'teamSubTeams' * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_size = 20) + public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { // verify the required parameter 'team_id' is set if ($team_id === null || (is_array($team_id) && count($team_id) === 0)) { @@ -2814,6 +2951,7 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si 'Missing the required parameter $team_id when calling teamSubTeams' ); } + if ($page_size !== null && $page_size > 100) { throw new InvalidArgumentException('invalid value for "$page_size" when calling TeamApi.teamSubTeams, must be smaller than or equal to 100.'); } @@ -2822,53 +2960,45 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si } $resourcePath = '/team/sub_teams/{team_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($team_id !== null) { $resourcePath = str_replace( - '{' . 'team_id' . '}', + '{team_id}', ObjectSerializer::toPathValue($team_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2886,18 +3016,19 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2921,11 +3052,11 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2937,15 +3068,15 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si * Update Team * * @param Model\TeamUpdateRequest $team_update_request team_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TeamGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TeamGetResponse */ - public function teamUpdate(Model\TeamUpdateRequest $team_update_request) + public function teamUpdate(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { - list($response) = $this->teamUpdateWithHttpInfo($team_update_request); - + list($response) = $this->teamUpdateWithHttpInfo($team_update_request, $contentType); return $response; } @@ -2955,31 +3086,31 @@ public function teamUpdate(Model\TeamUpdateRequest $team_update_request) * Update Team * * @param Model\TeamUpdateRequest $team_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_request) + public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { - $request = $this->teamUpdateRequest($team_update_request); + $request = $this->teamUpdateRequest($team_update_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2992,51 +3123,73 @@ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_requ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TeamGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TeamGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TeamGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3045,28 +3198,19 @@ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_requ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TeamGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TeamGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3077,13 +3221,14 @@ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_requ * Update Team * * @param Model\TeamUpdateRequest $team_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamUpdateAsync(Model\TeamUpdateRequest $team_update_request) + public function teamUpdateAsync(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { - return $this->teamUpdateAsyncWithHttpInfo($team_update_request) + return $this->teamUpdateAsyncWithHttpInfo($team_update_request, $contentType) ->then( function ($response) { return $response[0]; @@ -3097,23 +3242,27 @@ function ($response) { * Update Team * * @param Model\TeamUpdateRequest $team_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function teamUpdateAsyncWithHttpInfo(Model\TeamUpdateRequest $team_update_request) + public function teamUpdateAsyncWithHttpInfo(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { $returnType = '\Dropbox\Sign\Model\TeamGetResponse'; - $request = $this->teamUpdateRequest($team_update_request); + $request = $this->teamUpdateRequest($team_update_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3133,7 +3282,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3143,11 +3292,12 @@ function ($exception) { * Create request for operation 'teamUpdate' * * @param Model\TeamUpdateRequest $team_update_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) + public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { // verify the required parameter 'team_update_request' is set if ($team_update_request === null || (is_array($team_update_request) && count($team_update_request) === 0)) { @@ -3157,9 +3307,11 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) } $resourcePath = '/team'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $team_update_request @@ -3167,21 +3319,17 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_update_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($team_update_request)); } else { $httpBody = $team_update_request; } @@ -3200,9 +3348,9 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -3210,12 +3358,13 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) $payloadHook('multipart', $multipartContents, $team_update_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3239,11 +3388,11 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3252,12 +3401,12 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request) /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -3267,4 +3416,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 92f2406b5..e3e716a77 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,12 +35,11 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; use SplFileObject; @@ -49,35 +47,63 @@ * TemplateApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class TemplateApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null - */ - protected $response; + * @var string[] * + */ + public const contentTypes = [ + 'templateAddUser' => [ + 'application/json', + ], + 'templateCreate' => [ + 'application/json', + 'multipart/form-data', + ], + 'templateCreateEmbeddedDraft' => [ + 'application/json', + 'multipart/form-data', + ], + 'templateDelete' => [ + 'application/json', + ], + 'templateFiles' => [ + 'application/json', + ], + 'templateFilesAsDataUri' => [ + 'application/json', + ], + 'templateFilesAsFileUrl' => [ + 'application/json', + ], + 'templateGet' => [ + 'application/json', + ], + 'templateList' => [ + 'application/json', + ], + 'templateRemoveUser' => [ + 'application/json', + ], + 'templateUpdateFiles' => [ + 'application/json', + 'multipart/form-data', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -122,30 +148,22 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation templateAddUser * * Add User to Template * - * @param string $template_id The id of the Template to give the Account access to. (required) + * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request template_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateGetResponse */ - public function templateAddUser(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) + public function templateAddUser(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { - list($response) = $this->templateAddUserWithHttpInfo($template_id, $template_add_user_request); - + list($response) = $this->templateAddUserWithHttpInfo($template_id, $template_add_user_request, $contentType); return $response; } @@ -154,33 +172,33 @@ public function templateAddUser(string $template_id, Model\TemplateAddUserReques * * Add User to Template * - * @param string $template_id The id of the Template to give the Account access to. (required) + * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) + public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { - $request = $this->templateAddUserRequest($template_id, $template_add_user_request); + $request = $this->templateAddUserRequest($template_id, $template_add_user_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -193,51 +211,73 @@ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateA sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -246,28 +286,19 @@ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateA $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -277,15 +308,16 @@ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateA * * Add User to Template * - * @param string $template_id The id of the Template to give the Account access to. (required) + * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateAddUserAsync(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) + public function templateAddUserAsync(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { - return $this->templateAddUserAsyncWithHttpInfo($template_id, $template_add_user_request) + return $this->templateAddUserAsyncWithHttpInfo($template_id, $template_add_user_request, $contentType) ->then( function ($response) { return $response[0]; @@ -298,25 +330,29 @@ function ($response) { * * Add User to Template * - * @param string $template_id The id of the Template to give the Account access to. (required) + * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateAddUserAsyncWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) + public function templateAddUserAsyncWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; - $request = $this->templateAddUserRequest($template_id, $template_add_user_request); + $request = $this->templateAddUserRequest($template_id, $template_add_user_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -336,7 +372,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -345,13 +381,14 @@ function ($exception) { /** * Create request for operation 'templateAddUser' * - * @param string $template_id The id of the Template to give the Account access to. (required) + * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateAddUserRequest(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) + public function templateAddUserRequest(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -359,6 +396,7 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse 'Missing the required parameter $template_id when calling templateAddUser' ); } + // verify the required parameter 'template_add_user_request' is set if ($template_add_user_request === null || (is_array($template_add_user_request) && count($template_add_user_request) === 0)) { throw new InvalidArgumentException( @@ -367,9 +405,11 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse } $resourcePath = '/template/add_user/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $template_add_user_request @@ -380,27 +420,23 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_add_user_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_add_user_request)); } else { $httpBody = $template_add_user_request; } @@ -419,9 +455,9 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -429,12 +465,13 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse $payloadHook('multipart', $multipartContents, $template_add_user_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -458,11 +495,11 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -474,15 +511,15 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse * Create Template * * @param Model\TemplateCreateRequest $template_create_request template_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateCreateResponse */ - public function templateCreate(Model\TemplateCreateRequest $template_create_request) + public function templateCreate(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { - list($response) = $this->templateCreateWithHttpInfo($template_create_request); - + list($response) = $this->templateCreateWithHttpInfo($template_create_request, $contentType); return $response; } @@ -492,31 +529,31 @@ public function templateCreate(Model\TemplateCreateRequest $template_create_requ * Create Template * * @param Model\TemplateCreateRequest $template_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template_create_request) + public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { - $request = $this->templateCreateRequest($template_create_request); + $request = $this->templateCreateRequest($template_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -529,51 +566,73 @@ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -582,28 +641,19 @@ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -614,13 +664,14 @@ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template * Create Template * * @param Model\TemplateCreateRequest $template_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateCreateAsync(Model\TemplateCreateRequest $template_create_request) + public function templateCreateAsync(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { - return $this->templateCreateAsyncWithHttpInfo($template_create_request) + return $this->templateCreateAsyncWithHttpInfo($template_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -634,23 +685,27 @@ function ($response) { * Create Template * * @param Model\TemplateCreateRequest $template_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateCreateAsyncWithHttpInfo(Model\TemplateCreateRequest $template_create_request) + public function templateCreateAsyncWithHttpInfo(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateCreateResponse'; - $request = $this->templateCreateRequest($template_create_request); + $request = $this->templateCreateRequest($template_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -670,7 +725,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -680,11 +735,12 @@ function ($exception) { * Create request for operation 'templateCreate' * * @param Model\TemplateCreateRequest $template_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateCreateRequest(Model\TemplateCreateRequest $template_create_request) + public function templateCreateRequest(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { // verify the required parameter 'template_create_request' is set if ($template_create_request === null || (is_array($template_create_request) && count($template_create_request) === 0)) { @@ -694,9 +750,11 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea } $resourcePath = '/template/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $template_create_request @@ -704,21 +762,17 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_request)); } else { $httpBody = $template_create_request; } @@ -737,9 +791,9 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -747,12 +801,13 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea $payloadHook('multipart', $multipartContents, $template_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -776,11 +831,11 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -792,15 +847,15 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea * Create Embedded Template Draft * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request template_create_embedded_draft_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateCreateEmbeddedDraftResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateCreateEmbeddedDraftResponse */ - public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) + public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { - list($response) = $this->templateCreateEmbeddedDraftWithHttpInfo($template_create_embedded_draft_request); - + list($response) = $this->templateCreateEmbeddedDraftWithHttpInfo($template_create_embedded_draft_request, $contentType); return $response; } @@ -810,31 +865,31 @@ public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftReq * Create Embedded Template Draft * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateCreateEmbeddedDraftResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) + public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { - $request = $this->templateCreateEmbeddedDraftRequest($template_create_embedded_draft_request); + $request = $this->templateCreateEmbeddedDraftRequest($template_create_embedded_draft_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -847,51 +902,73 @@ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbe sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -900,28 +977,19 @@ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbe $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -932,13 +1000,14 @@ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbe * Create Embedded Template Draft * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateCreateEmbeddedDraftAsync(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) + public function templateCreateEmbeddedDraftAsync(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { - return $this->templateCreateEmbeddedDraftAsyncWithHttpInfo($template_create_embedded_draft_request) + return $this->templateCreateEmbeddedDraftAsyncWithHttpInfo($template_create_embedded_draft_request, $contentType) ->then( function ($response) { return $response[0]; @@ -952,23 +1021,27 @@ function ($response) { * Create Embedded Template Draft * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateCreateEmbeddedDraftAsyncWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) + public function templateCreateEmbeddedDraftAsyncWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse'; - $request = $this->templateCreateEmbeddedDraftRequest($template_create_embedded_draft_request); + $request = $this->templateCreateEmbeddedDraftRequest($template_create_embedded_draft_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -988,7 +1061,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -998,11 +1071,12 @@ function ($exception) { * Create request for operation 'templateCreateEmbeddedDraft' * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) + public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { // verify the required parameter 'template_create_embedded_draft_request' is set if ($template_create_embedded_draft_request === null || (is_array($template_create_embedded_draft_request) && count($template_create_embedded_draft_request) === 0)) { @@ -1012,9 +1086,11 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD } $resourcePath = '/template/create_embedded_draft'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $template_create_embedded_draft_request @@ -1022,21 +1098,17 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_embedded_draft_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_create_embedded_draft_request)); } else { $httpBody = $template_create_embedded_draft_request; } @@ -1055,9 +1127,9 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1065,12 +1137,13 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD $payloadHook('multipart', $multipartContents, $template_create_embedded_draft_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1094,11 +1167,11 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1110,14 +1183,14 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD * Delete Template * * @param string $template_id The id of the Template to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ - public function templateDelete(string $template_id) + public function templateDelete(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { - $this->templateDeleteWithHttpInfo($template_id); + $this->templateDeleteWithHttpInfo($template_id, $contentType); } /** @@ -1126,31 +1199,31 @@ public function templateDelete(string $template_id) * Delete Template * * @param string $template_id The id of the Template to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateDeleteWithHttpInfo(string $template_id) + public function templateDeleteWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { - $request = $this->templateDeleteRequest($template_id); + $request = $this->templateDeleteRequest($template_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1163,29 +1236,21 @@ public function templateDeleteWithHttpInfo(string $template_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -1196,13 +1261,14 @@ public function templateDeleteWithHttpInfo(string $template_id) * Delete Template * * @param string $template_id The id of the Template to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateDeleteAsync(string $template_id) + public function templateDeleteAsync(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { - return $this->templateDeleteAsyncWithHttpInfo($template_id) + return $this->templateDeleteAsyncWithHttpInfo($template_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1216,14 +1282,15 @@ function ($response) { * Delete Template * * @param string $template_id The id of the Template to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateDeleteAsyncWithHttpInfo(string $template_id) + public function templateDeleteAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { $returnType = ''; - $request = $this->templateDeleteRequest($template_id); + $request = $this->templateDeleteRequest($template_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1242,7 +1309,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1252,11 +1319,12 @@ function ($exception) { * Create request for operation 'templateDelete' * * @param string $template_id The id of the Template to delete. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateDeleteRequest(string $template_id) + public function templateDeleteRequest(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -1266,32 +1334,26 @@ public function templateDeleteRequest(string $template_id) } $resourcePath = '/template/delete/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1309,18 +1371,19 @@ public function templateDeleteRequest(string $template_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1344,11 +1407,11 @@ public function templateDeleteRequest(string $template_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1360,16 +1423,16 @@ public function templateDeleteRequest(string $template_id) * Get Template Files * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return SplFileObject|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return SplFileObject */ - public function templateFiles(string $template_id, string $file_type = null) + public function templateFiles(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { - list($response) = $this->templateFilesWithHttpInfo($template_id, $file_type); - + list($response) = $this->templateFilesWithHttpInfo($template_id, $file_type, $contentType); return $response; } @@ -1379,32 +1442,32 @@ public function templateFiles(string $template_id, string $file_type = null) * Get Template Files * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of \SplFileObject|\Dropbox\Sign\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateFilesWithHttpInfo(string $template_id, string $file_type = null) + public function templateFilesWithHttpInfo(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { - $request = $this->templateFilesRequest($template_id, $file_type); + $request = $this->templateFilesRequest($template_id, $file_type, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1417,51 +1480,73 @@ public function templateFilesWithHttpInfo(string $template_id, string $file_type sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\SplFileObject' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\SplFileObject', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\SplFileObject' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\SplFileObject' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\SplFileObject', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\SplFileObject'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1470,28 +1555,19 @@ public function templateFilesWithHttpInfo(string $template_id, string $file_type $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\SplFileObject', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\SplFileObject', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1502,14 +1578,15 @@ public function templateFilesWithHttpInfo(string $template_id, string $file_type * Get Template Files * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsync(string $template_id, string $file_type = null) + public function templateFilesAsync(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { - return $this->templateFilesAsyncWithHttpInfo($template_id, $file_type) + return $this->templateFilesAsyncWithHttpInfo($template_id, $file_type, $contentType) ->then( function ($response) { return $response[0]; @@ -1523,24 +1600,28 @@ function ($response) { * Get Template Files * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsyncWithHttpInfo(string $template_id, string $file_type = null) + public function templateFilesAsyncWithHttpInfo(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { $returnType = '\SplFileObject'; - $request = $this->templateFilesRequest($template_id, $file_type); + $request = $this->templateFilesRequest($template_id, $file_type, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1560,7 +1641,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1570,12 +1651,13 @@ function ($exception) { * Create request for operation 'templateFiles' * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateFilesRequest(string $template_id, string $file_type = null) + public function templateFilesRequest(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -1585,43 +1667,36 @@ public function templateFilesRequest(string $template_id, string $file_type = nu } $resourcePath = '/template/files/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($file_type !== null) { - if ('form' === 'form' && is_array($file_type)) { - foreach ($file_type as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['file_type'] = $file_type; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $file_type, + 'file_type', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/pdf', 'application/zip', 'application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/pdf', 'application/zip', 'application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1639,18 +1714,19 @@ public function templateFilesRequest(string $template_id, string $file_type = nu // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1674,11 +1750,11 @@ public function templateFilesRequest(string $template_id, string $file_type = nu $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1690,15 +1766,15 @@ public function templateFilesRequest(string $template_id, string $file_type = nu * Get Template Files as Data Uri * * @param string $template_id The id of the template files to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\FileResponseDataUri|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\FileResponseDataUri */ - public function templateFilesAsDataUri(string $template_id) + public function templateFilesAsDataUri(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { - list($response) = $this->templateFilesAsDataUriWithHttpInfo($template_id); - + list($response) = $this->templateFilesAsDataUriWithHttpInfo($template_id, $contentType); return $response; } @@ -1708,31 +1784,31 @@ public function templateFilesAsDataUri(string $template_id) * Get Template Files as Data Uri * * @param string $template_id The id of the template files to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FileResponseDataUri, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateFilesAsDataUriWithHttpInfo(string $template_id) + public function templateFilesAsDataUriWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { - $request = $this->templateFilesAsDataUriRequest($template_id); + $request = $this->templateFilesAsDataUriRequest($template_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1745,51 +1821,73 @@ public function templateFilesAsDataUriWithHttpInfo(string $template_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FileResponseDataUri' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponseDataUri', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FileResponseDataUri' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FileResponseDataUri' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponseDataUri', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FileResponseDataUri'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1798,28 +1896,19 @@ public function templateFilesAsDataUriWithHttpInfo(string $template_id) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FileResponseDataUri', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FileResponseDataUri', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1830,13 +1919,14 @@ public function templateFilesAsDataUriWithHttpInfo(string $template_id) * Get Template Files as Data Uri * * @param string $template_id The id of the template files to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsDataUriAsync(string $template_id) + public function templateFilesAsDataUriAsync(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { - return $this->templateFilesAsDataUriAsyncWithHttpInfo($template_id) + return $this->templateFilesAsDataUriAsyncWithHttpInfo($template_id, $contentType) ->then( function ($response) { return $response[0]; @@ -1850,23 +1940,27 @@ function ($response) { * Get Template Files as Data Uri * * @param string $template_id The id of the template files to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsDataUriAsyncWithHttpInfo(string $template_id) + public function templateFilesAsDataUriAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { $returnType = '\Dropbox\Sign\Model\FileResponseDataUri'; - $request = $this->templateFilesAsDataUriRequest($template_id); + $request = $this->templateFilesAsDataUriRequest($template_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1886,7 +1980,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1896,11 +1990,12 @@ function ($exception) { * Create request for operation 'templateFilesAsDataUri' * * @param string $template_id The id of the template files to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateFilesAsDataUriRequest(string $template_id) + public function templateFilesAsDataUriRequest(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -1910,32 +2005,26 @@ public function templateFilesAsDataUriRequest(string $template_id) } $resourcePath = '/template/files_as_data_uri/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1953,18 +2042,19 @@ public function templateFilesAsDataUriRequest(string $template_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1988,11 +2078,11 @@ public function templateFilesAsDataUriRequest(string $template_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2003,17 +2093,17 @@ public function templateFilesAsDataUriRequest(string $template_id) * * Get Template Files as File Url * - * @param string $template_id The id of the template files to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $template_id The id of the template files to retrieve. (required) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\FileResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\FileResponse */ - public function templateFilesAsFileUrl(string $template_id, int $force_download = 1) + public function templateFilesAsFileUrl(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { - list($response) = $this->templateFilesAsFileUrlWithHttpInfo($template_id, $force_download); - + list($response) = $this->templateFilesAsFileUrlWithHttpInfo($template_id, $force_download, $contentType); return $response; } @@ -2022,33 +2112,33 @@ public function templateFilesAsFileUrl(string $template_id, int $force_download * * Get Template Files as File Url * - * @param string $template_id The id of the template files to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $template_id The id of the template files to retrieve. (required) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FileResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $force_download = 1) + public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { - $request = $this->templateFilesAsFileUrlRequest($template_id, $force_download); + $request = $this->templateFilesAsFileUrlRequest($template_id, $force_download, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2061,51 +2151,73 @@ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $for sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FileResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FileResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FileResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FileResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FileResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2114,28 +2226,19 @@ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $for $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FileResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FileResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2145,15 +2248,16 @@ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $for * * Get Template Files as File Url * - * @param string $template_id The id of the template files to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $template_id The id of the template files to retrieve. (required) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsFileUrlAsync(string $template_id, int $force_download = 1) + public function templateFilesAsFileUrlAsync(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { - return $this->templateFilesAsFileUrlAsyncWithHttpInfo($template_id, $force_download) + return $this->templateFilesAsFileUrlAsyncWithHttpInfo($template_id, $force_download, $contentType) ->then( function ($response) { return $response[0]; @@ -2166,25 +2270,29 @@ function ($response) { * * Get Template Files as File Url * - * @param string $template_id The id of the template files to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $template_id The id of the template files to retrieve. (required) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateFilesAsFileUrlAsyncWithHttpInfo(string $template_id, int $force_download = 1) + public function templateFilesAsFileUrlAsyncWithHttpInfo(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { $returnType = '\Dropbox\Sign\Model\FileResponse'; - $request = $this->templateFilesAsFileUrlRequest($template_id, $force_download); + $request = $this->templateFilesAsFileUrlRequest($template_id, $force_download, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2204,7 +2312,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2213,13 +2321,14 @@ function ($exception) { /** * Create request for operation 'templateFilesAsFileUrl' * - * @param string $template_id The id of the template files to retrieve. (required) - * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $template_id The id of the template files to retrieve. (required) + * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateFilesAsFileUrlRequest(string $template_id, int $force_download = 1) + public function templateFilesAsFileUrlRequest(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -2229,43 +2338,36 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do } $resourcePath = '/template/files_as_file_url/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($force_download !== null) { - if ('form' === 'form' && is_array($force_download)) { - foreach ($force_download as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['force_download'] = $force_download; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $force_download, + 'force_download', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2283,18 +2385,19 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2318,11 +2421,11 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2334,15 +2437,15 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do * Get Template * * @param string $template_id The id of the Template to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateGetResponse */ - public function templateGet(string $template_id) + public function templateGet(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { - list($response) = $this->templateGetWithHttpInfo($template_id); - + list($response) = $this->templateGetWithHttpInfo($template_id, $contentType); return $response; } @@ -2352,31 +2455,31 @@ public function templateGet(string $template_id) * Get Template * * @param string $template_id The id of the Template to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateGetWithHttpInfo(string $template_id) + public function templateGetWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { - $request = $this->templateGetRequest($template_id); + $request = $this->templateGetRequest($template_id, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2389,51 +2492,73 @@ public function templateGetWithHttpInfo(string $template_id) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2442,28 +2567,19 @@ public function templateGetWithHttpInfo(string $template_id) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2474,13 +2590,14 @@ public function templateGetWithHttpInfo(string $template_id) * Get Template * * @param string $template_id The id of the Template to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateGetAsync(string $template_id) + public function templateGetAsync(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { - return $this->templateGetAsyncWithHttpInfo($template_id) + return $this->templateGetAsyncWithHttpInfo($template_id, $contentType) ->then( function ($response) { return $response[0]; @@ -2494,23 +2611,27 @@ function ($response) { * Get Template * * @param string $template_id The id of the Template to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateGetAsyncWithHttpInfo(string $template_id) + public function templateGetAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; - $request = $this->templateGetRequest($template_id); + $request = $this->templateGetRequest($template_id, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2530,7 +2651,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2540,11 +2661,12 @@ function ($exception) { * Create request for operation 'templateGet' * * @param string $template_id The id of the Template to retrieve. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateGetRequest(string $template_id) + public function templateGetRequest(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -2554,32 +2676,26 @@ public function templateGetRequest(string $template_id) } $resourcePath = '/template/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2597,18 +2713,19 @@ public function templateGetRequest(string $template_id) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2632,11 +2749,11 @@ public function templateGetRequest(string $template_id) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2647,19 +2764,19 @@ public function templateGetRequest(string $template_id) * * List Templates * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateListResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateListResponse */ - public function templateList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function templateList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { - list($response) = $this->templateListWithHttpInfo($account_id, $page, $page_size, $query); - + list($response) = $this->templateListWithHttpInfo($account_id, $page, $page_size, $query, $contentType); return $response; } @@ -2668,35 +2785,35 @@ public function templateList(string $account_id = null, int $page = 1, int $page * * List Templates * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateListResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function templateListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { - $request = $this->templateListRequest($account_id, $page, $page_size, $query); + $request = $this->templateListRequest($account_id, $page, $page_size, $query, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2709,51 +2826,73 @@ public function templateListWithHttpInfo(string $account_id = null, int $page = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateListResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateListResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateListResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateListResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2762,28 +2901,19 @@ public function templateListWithHttpInfo(string $account_id = null, int $page = $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2793,17 +2923,18 @@ public function templateListWithHttpInfo(string $account_id = null, int $page = * * List Templates * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function templateListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { - return $this->templateListAsyncWithHttpInfo($account_id, $page, $page_size, $query) + return $this->templateListAsyncWithHttpInfo($account_id, $page, $page_size, $query, $contentType) ->then( function ($response) { return $response[0]; @@ -2816,27 +2947,31 @@ function ($response) { * * List Templates * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function templateListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateListResponse'; - $request = $this->templateListRequest($account_id, $page, $page_size, $query); + $request = $this->templateListRequest($account_id, $page, $page_size, $query, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2856,7 +2991,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2865,15 +3000,16 @@ function ($exception) { /** * Create request for operation 'templateList' * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) + public function templateListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { if ($page_size !== null && $page_size > 100) { throw new InvalidArgumentException('invalid value for "$page_size" when calling TemplateApi.templateList, must be smaller than or equal to 100.'); @@ -2883,64 +3019,54 @@ public function templateListRequest(string $account_id = null, int $page = 1, in } $resourcePath = '/template/list'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($account_id !== null) { - if ('form' === 'form' && is_array($account_id)) { - foreach ($account_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['account_id'] = $account_id; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_id, + 'account_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($query !== null) { - if ('form' === 'form' && is_array($query)) { - foreach ($query as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['query'] = $query; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $query, + 'query', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -2958,18 +3084,19 @@ public function templateListRequest(string $account_id = null, int $page = 1, in // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2993,11 +3120,11 @@ public function templateListRequest(string $account_id = null, int $page = 1, in $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3008,17 +3135,17 @@ public function templateListRequest(string $account_id = null, int $page = 1, in * * Remove User from Template * - * @param string $template_id The id of the Template to remove the Account's access to. (required) + * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request template_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateGetResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateGetResponse */ - public function templateRemoveUser(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) + public function templateRemoveUser(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { - list($response) = $this->templateRemoveUserWithHttpInfo($template_id, $template_remove_user_request); - + list($response) = $this->templateRemoveUserWithHttpInfo($template_id, $template_remove_user_request, $contentType); return $response; } @@ -3027,33 +3154,33 @@ public function templateRemoveUser(string $template_id, Model\TemplateRemoveUser * * Remove User from Template * - * @param string $template_id The id of the Template to remove the Account's access to. (required) + * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateRemoveUserWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) + public function templateRemoveUserWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { - $request = $this->templateRemoveUserRequest($template_id, $template_remove_user_request); + $request = $this->templateRemoveUserRequest($template_id, $template_remove_user_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -3066,51 +3193,73 @@ public function templateRemoveUserWithHttpInfo(string $template_id, Model\Templa sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3119,28 +3268,19 @@ public function templateRemoveUserWithHttpInfo(string $template_id, Model\Templa $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3150,15 +3290,16 @@ public function templateRemoveUserWithHttpInfo(string $template_id, Model\Templa * * Remove User from Template * - * @param string $template_id The id of the Template to remove the Account's access to. (required) + * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateRemoveUserAsync(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) + public function templateRemoveUserAsync(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { - return $this->templateRemoveUserAsyncWithHttpInfo($template_id, $template_remove_user_request) + return $this->templateRemoveUserAsyncWithHttpInfo($template_id, $template_remove_user_request, $contentType) ->then( function ($response) { return $response[0]; @@ -3171,25 +3312,29 @@ function ($response) { * * Remove User from Template * - * @param string $template_id The id of the Template to remove the Account's access to. (required) + * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateRemoveUserAsyncWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) + public function templateRemoveUserAsyncWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateGetResponse'; - $request = $this->templateRemoveUserRequest($template_id, $template_remove_user_request); + $request = $this->templateRemoveUserRequest($template_id, $template_remove_user_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3209,7 +3354,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3218,13 +3363,14 @@ function ($exception) { /** * Create request for operation 'templateRemoveUser' * - * @param string $template_id The id of the Template to remove the Account's access to. (required) + * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateRemoveUserRequest(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) + public function templateRemoveUserRequest(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -3232,6 +3378,7 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem 'Missing the required parameter $template_id when calling templateRemoveUser' ); } + // verify the required parameter 'template_remove_user_request' is set if ($template_remove_user_request === null || (is_array($template_remove_user_request) && count($template_remove_user_request) === 0)) { throw new InvalidArgumentException( @@ -3240,9 +3387,11 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem } $resourcePath = '/template/remove_user/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $template_remove_user_request @@ -3253,27 +3402,23 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_remove_user_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_remove_user_request)); } else { $httpBody = $template_remove_user_request; } @@ -3292,9 +3437,9 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -3302,12 +3447,13 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem $payloadHook('multipart', $multipartContents, $template_remove_user_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3331,11 +3477,11 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3346,17 +3492,17 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem * * Update Template Files * - * @param string $template_id The ID of the template whose files to update. (required) + * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request template_update_files_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\TemplateUpdateFilesResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\TemplateUpdateFilesResponse */ - public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) + public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { - list($response) = $this->templateUpdateFilesWithHttpInfo($template_id, $template_update_files_request); - + list($response) = $this->templateUpdateFilesWithHttpInfo($template_id, $template_update_files_request, $contentType); return $response; } @@ -3365,33 +3511,33 @@ public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFil * * Update Template Files * - * @param string $template_id The ID of the template whose files to update. (required) + * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\TemplateUpdateFilesResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function templateUpdateFilesWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) + public function templateUpdateFilesWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { - $request = $this->templateUpdateFilesRequest($template_id, $template_update_files_request); + $request = $this->templateUpdateFilesRequest($template_id, $template_update_files_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -3404,51 +3550,73 @@ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\Templ sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\TemplateUpdateFilesResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateUpdateFilesResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\TemplateUpdateFilesResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\TemplateUpdateFilesResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\TemplateUpdateFilesResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\TemplateUpdateFilesResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -3457,28 +3625,19 @@ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\Templ $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\TemplateUpdateFilesResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\TemplateUpdateFilesResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -3488,15 +3647,16 @@ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\Templ * * Update Template Files * - * @param string $template_id The ID of the template whose files to update. (required) + * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateUpdateFilesAsync(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) + public function templateUpdateFilesAsync(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { - return $this->templateUpdateFilesAsyncWithHttpInfo($template_id, $template_update_files_request) + return $this->templateUpdateFilesAsyncWithHttpInfo($template_id, $template_update_files_request, $contentType) ->then( function ($response) { return $response[0]; @@ -3509,25 +3669,29 @@ function ($response) { * * Update Template Files * - * @param string $template_id The ID of the template whose files to update. (required) + * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function templateUpdateFilesAsyncWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) + public function templateUpdateFilesAsyncWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { $returnType = '\Dropbox\Sign\Model\TemplateUpdateFilesResponse'; - $request = $this->templateUpdateFilesRequest($template_id, $template_update_files_request); + $request = $this->templateUpdateFilesRequest($template_id, $template_update_files_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -3547,7 +3711,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -3556,13 +3720,14 @@ function ($exception) { /** * Create request for operation 'templateUpdateFiles' * - * @param string $template_id The ID of the template whose files to update. (required) + * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function templateUpdateFilesRequest(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) + public function templateUpdateFilesRequest(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { // verify the required parameter 'template_id' is set if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { @@ -3570,6 +3735,7 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp 'Missing the required parameter $template_id when calling templateUpdateFiles' ); } + // verify the required parameter 'template_update_files_request' is set if ($template_update_files_request === null || (is_array($template_update_files_request) && count($template_update_files_request) === 0)) { throw new InvalidArgumentException( @@ -3578,9 +3744,11 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp } $resourcePath = '/template/update_files/{template_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $template_update_files_request @@ -3591,27 +3759,23 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp // path params if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', + '{template_id}', ObjectSerializer::toPathValue($template_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_update_files_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($template_update_files_request)); } else { $httpBody = $template_update_files_request; } @@ -3630,9 +3794,9 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -3640,12 +3804,13 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp $payloadHook('multipart', $multipartContents, $template_update_files_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -3669,11 +3834,11 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -3682,12 +3847,12 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -3697,4 +3862,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index a83572a10..ce65936ed 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,47 +35,53 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; -use Psr\Http\Message\ResponseInterface; +use JsonException; use RuntimeException; /** * UnclaimedDraftApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class UnclaimedDraftApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ - protected $response; + public const contentTypes = [ + 'unclaimedDraftCreate' => [ + 'application/json', + 'multipart/form-data', + ], + 'unclaimedDraftCreateEmbedded' => [ + 'application/json', + 'multipart/form-data', + ], + 'unclaimedDraftCreateEmbeddedWithTemplate' => [ + 'application/json', + 'multipart/form-data', + ], + 'unclaimedDraftEditAndResend' => [ + 'application/json', + ], + ]; /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec @@ -121,29 +126,21 @@ public function getConfig() return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - /** * Operation unclaimedDraftCreate * * Create Unclaimed Draft * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request unclaimed_draft_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\UnclaimedDraftCreateResponse */ - public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) + public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { - list($response) = $this->unclaimedDraftCreateWithHttpInfo($unclaimed_draft_create_request); - + list($response) = $this->unclaimedDraftCreateWithHttpInfo($unclaimed_draft_create_request, $contentType); return $response; } @@ -153,31 +150,31 @@ public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaime * Create Unclaimed Draft * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) + public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { - $request = $this->unclaimedDraftCreateRequest($unclaimed_draft_create_request); + $request = $this->unclaimedDraftCreateRequest($unclaimed_draft_create_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -190,51 +187,73 @@ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateReque sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -243,28 +262,19 @@ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateReque $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -275,13 +285,14 @@ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateReque * Create Unclaimed Draft * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateAsync(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) + public function unclaimedDraftCreateAsync(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { - return $this->unclaimedDraftCreateAsyncWithHttpInfo($unclaimed_draft_create_request) + return $this->unclaimedDraftCreateAsyncWithHttpInfo($unclaimed_draft_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -295,23 +306,27 @@ function ($response) { * Create Unclaimed Draft * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateAsyncWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) + public function unclaimedDraftCreateAsyncWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; - $request = $this->unclaimedDraftCreateRequest($unclaimed_draft_create_request); + $request = $this->unclaimedDraftCreateRequest($unclaimed_draft_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -331,7 +346,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -341,11 +356,12 @@ function ($exception) { * Create request for operation 'unclaimedDraftCreate' * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) + public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { // verify the required parameter 'unclaimed_draft_create_request' is set if ($unclaimed_draft_create_request === null || (is_array($unclaimed_draft_create_request) && count($unclaimed_draft_create_request) === 0)) { @@ -355,9 +371,11 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u } $resourcePath = '/unclaimed_draft/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $unclaimed_draft_create_request @@ -365,21 +383,17 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_request)); } else { $httpBody = $unclaimed_draft_create_request; } @@ -398,9 +412,9 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -408,12 +422,13 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -437,11 +452,11 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -453,15 +468,15 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u * Create Embedded Unclaimed Draft * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request unclaimed_draft_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\UnclaimedDraftCreateResponse */ - public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) + public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { - list($response) = $this->unclaimedDraftCreateEmbeddedWithHttpInfo($unclaimed_draft_create_embedded_request); - + list($response) = $this->unclaimedDraftCreateEmbeddedWithHttpInfo($unclaimed_draft_create_embedded_request, $contentType); return $response; } @@ -471,31 +486,31 @@ public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedR * Create Embedded Unclaimed Draft * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) + public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { - $request = $this->unclaimedDraftCreateEmbeddedRequest($unclaimed_draft_create_embedded_request); + $request = $this->unclaimedDraftCreateEmbeddedRequest($unclaimed_draft_create_embedded_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -508,51 +523,73 @@ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCre sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -561,28 +598,19 @@ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCre $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -593,13 +621,14 @@ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCre * Create Embedded Unclaimed Draft * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateEmbeddedAsync(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) + public function unclaimedDraftCreateEmbeddedAsync(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { - return $this->unclaimedDraftCreateEmbeddedAsyncWithHttpInfo($unclaimed_draft_create_embedded_request) + return $this->unclaimedDraftCreateEmbeddedAsyncWithHttpInfo($unclaimed_draft_create_embedded_request, $contentType) ->then( function ($response) { return $response[0]; @@ -613,23 +642,27 @@ function ($response) { * Create Embedded Unclaimed Draft * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateEmbeddedAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) + public function unclaimedDraftCreateEmbeddedAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; - $request = $this->unclaimedDraftCreateEmbeddedRequest($unclaimed_draft_create_embedded_request); + $request = $this->unclaimedDraftCreateEmbeddedRequest($unclaimed_draft_create_embedded_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -649,7 +682,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -659,11 +692,12 @@ function ($exception) { * Create request for operation 'unclaimedDraftCreateEmbedded' * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) + public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { // verify the required parameter 'unclaimed_draft_create_embedded_request' is set if ($unclaimed_draft_create_embedded_request === null || (is_array($unclaimed_draft_create_embedded_request) && count($unclaimed_draft_create_embedded_request) === 0)) { @@ -673,9 +707,11 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm } $resourcePath = '/unclaimed_draft/create_embedded'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $unclaimed_draft_create_embedded_request @@ -683,21 +719,17 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_request)); } else { $httpBody = $unclaimed_draft_create_embedded_request; } @@ -716,9 +748,9 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -726,12 +758,13 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -755,11 +788,11 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -771,15 +804,15 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm * Create Embedded Unclaimed Draft with Template * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request unclaimed_draft_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\UnclaimedDraftCreateResponse */ - public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) + public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { - list($response) = $this->unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo($unclaimed_draft_create_embedded_with_template_request); - + list($response) = $this->unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo($unclaimed_draft_create_embedded_with_template_request, $contentType); return $response; } @@ -789,31 +822,31 @@ public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCre * Create Embedded Unclaimed Draft with Template * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) + public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { - $request = $this->unclaimedDraftCreateEmbeddedWithTemplateRequest($unclaimed_draft_create_embedded_with_template_request); + $request = $this->unclaimedDraftCreateEmbeddedWithTemplateRequest($unclaimed_draft_create_embedded_with_template_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -826,51 +859,73 @@ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\Uncla sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -879,28 +934,19 @@ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\Uncla $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -911,13 +957,14 @@ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\Uncla * Create Embedded Unclaimed Draft with Template * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateEmbeddedWithTemplateAsync(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) + public function unclaimedDraftCreateEmbeddedWithTemplateAsync(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { - return $this->unclaimedDraftCreateEmbeddedWithTemplateAsyncWithHttpInfo($unclaimed_draft_create_embedded_with_template_request) + return $this->unclaimedDraftCreateEmbeddedWithTemplateAsyncWithHttpInfo($unclaimed_draft_create_embedded_with_template_request, $contentType) ->then( function ($response) { return $response[0]; @@ -931,23 +978,27 @@ function ($response) { * Create Embedded Unclaimed Draft with Template * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) + public function unclaimedDraftCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; - $request = $this->unclaimedDraftCreateEmbeddedWithTemplateRequest($unclaimed_draft_create_embedded_with_template_request); + $request = $this->unclaimedDraftCreateEmbeddedWithTemplateRequest($unclaimed_draft_create_embedded_with_template_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -967,7 +1018,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -977,11 +1028,12 @@ function ($exception) { * Create request for operation 'unclaimedDraftCreateEmbeddedWithTemplate' * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) + public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { // verify the required parameter 'unclaimed_draft_create_embedded_with_template_request' is set if ($unclaimed_draft_create_embedded_with_template_request === null || (is_array($unclaimed_draft_create_embedded_with_template_request) && count($unclaimed_draft_create_embedded_with_template_request) === 0)) { @@ -991,9 +1043,11 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD } $resourcePath = '/unclaimed_draft/create_embedded_with_template'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $unclaimed_draft_create_embedded_with_template_request @@ -1001,21 +1055,17 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json', 'multipart/form-data'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_with_template_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_create_embedded_with_template_request)); } else { $httpBody = $unclaimed_draft_create_embedded_with_template_request; } @@ -1034,9 +1084,9 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1044,12 +1094,13 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_with_template_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1073,11 +1124,11 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1088,17 +1139,17 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD * * Edit and Resend Unclaimed Draft * - * @param string $signature_request_id The ID of the signature request to edit and resend. (required) + * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request unclaimed_draft_edit_and_resend_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * - * @throws ApiException on non-2xx response + * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return Model\UnclaimedDraftCreateResponse */ - public function unclaimedDraftEditAndResend(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) + public function unclaimedDraftEditAndResend(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { - list($response) = $this->unclaimedDraftEditAndResendWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request); - + list($response) = $this->unclaimedDraftEditAndResendWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request, $contentType); return $response; } @@ -1107,33 +1158,33 @@ public function unclaimedDraftEditAndResend(string $signature_request_id, Model\ * * Edit and Resend Unclaimed Draft * - * @param string $signature_request_id The ID of the signature request to edit and resend. (required) + * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ - public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) + public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { - $request = $this->unclaimedDraftEditAndResendRequest($signature_request_id, $unclaimed_draft_edit_and_resend_request); + $request = $this->unclaimedDraftEditAndResendRequest($signature_request_id, $unclaimed_draft_edit_and_resend_request, $contentType); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1146,51 +1197,73 @@ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_reques sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\UnclaimedDraftCreateResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1199,28 +1272,19 @@ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_reques $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1230,15 +1294,16 @@ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_reques * * Edit and Resend Unclaimed Draft * - * @param string $signature_request_id The ID of the signature request to edit and resend. (required) + * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftEditAndResendAsync(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) + public function unclaimedDraftEditAndResendAsync(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { - return $this->unclaimedDraftEditAndResendAsyncWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request) + return $this->unclaimedDraftEditAndResendAsyncWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1251,25 +1316,29 @@ function ($response) { * * Edit and Resend Unclaimed Draft * - * @param string $signature_request_id The ID of the signature request to edit and resend. (required) + * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface */ - public function unclaimedDraftEditAndResendAsyncWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) + public function unclaimedDraftEditAndResendAsyncWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { $returnType = '\Dropbox\Sign\Model\UnclaimedDraftCreateResponse'; - $request = $this->unclaimedDraftEditAndResendRequest($signature_request_id, $unclaimed_draft_edit_and_resend_request); + $request = $this->unclaimedDraftEditAndResendRequest($signature_request_id, $unclaimed_draft_edit_and_resend_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1289,7 +1358,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1298,13 +1367,14 @@ function ($exception) { /** * Create request for operation 'unclaimedDraftEditAndResend' * - * @param string $signature_request_id The ID of the signature request to edit and resend. (required) + * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request */ - public function unclaimedDraftEditAndResendRequest(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) + public function unclaimedDraftEditAndResendRequest(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { // verify the required parameter 'signature_request_id' is set if ($signature_request_id === null || (is_array($signature_request_id) && count($signature_request_id) === 0)) { @@ -1312,6 +1382,7 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, 'Missing the required parameter $signature_request_id when calling unclaimedDraftEditAndResend' ); } + // verify the required parameter 'unclaimed_draft_edit_and_resend_request' is set if ($unclaimed_draft_edit_and_resend_request === null || (is_array($unclaimed_draft_edit_and_resend_request) && count($unclaimed_draft_edit_and_resend_request) === 0)) { throw new InvalidArgumentException( @@ -1320,9 +1391,11 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, } $resourcePath = '/unclaimed_draft/edit_and_resend/{signature_request_id}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $unclaimed_draft_edit_and_resend_request @@ -1333,27 +1406,23 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, // path params if ($signature_request_id !== null) { $resourcePath = str_replace( - '{' . 'signature_request_id' . '}', + '{signature_request_id}', ObjectSerializer::toPathValue($signature_request_id), $resourcePath ); } - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_edit_and_resend_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($unclaimed_draft_edit_and_resend_request)); } else { $httpBody = $unclaimed_draft_edit_and_resend_request; } @@ -1372,9 +1441,9 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1382,12 +1451,13 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, $payloadHook('multipart', $multipartContents, $unclaimed_draft_edit_and_resend_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1411,11 +1481,11 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1424,12 +1494,12 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -1439,4 +1509,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + mixed $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/ApiException.php b/sdks/php/src/ApiException.php index d86bb4224..42f035f1e 100644 --- a/sdks/php/src/ApiException.php +++ b/sdks/php/src/ApiException.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -34,7 +33,6 @@ * ApiException Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class ApiException extends Exception @@ -63,10 +61,10 @@ class ApiException extends Exception /** * Constructor * - * @param string $message Error message - * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header - * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string + * @param string $message Error message + * @param int $code HTTP status code + * @param string[]|null $responseHeaders HTTP response header + * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct(string $message = '', int $code = 0, ?array $responseHeaders = [], $responseBody = null) { @@ -99,10 +97,8 @@ public function getResponseBody() * Sets the deserialized response object (during deserialization) * * @param mixed $obj Deserialized response object - * - * @return void */ - public function setResponseObject($obj) + public function setResponseObject(mixed $obj) { $this->responseObject = $obj; } diff --git a/sdks/php/src/Configuration.php b/sdks/php/src/Configuration.php index 584f4a2a2..386e29114 100644 --- a/sdks/php/src/Configuration.php +++ b/sdks/php/src/Configuration.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -34,15 +33,29 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class Configuration { + public const BOOLEAN_FORMAT_INT = 'int'; + public const BOOLEAN_FORMAT_STRING = 'string'; + + /** @var Configuration */ + private static $defaultConfiguration; + /** - * @var Configuration + * Associate array to store API key(s) + * + * @var string[] */ - private static $defaultConfiguration; + protected $apiKeys = []; + + /** + * Associate array to store API prefix (e.g. Bearer) + * + * @var string[] + */ + protected $apiKeyPrefixes = []; /** * Access token for OAuth/Bearer authentication @@ -51,6 +64,13 @@ class Configuration */ protected $accessToken = ''; + /** + * Boolean format for query string + * + * @var string + */ + protected $booleanFormatForQueryString = self::BOOLEAN_FORMAT_INT; + /** * Username for HTTP basic authentication * @@ -58,6 +78,13 @@ class Configuration */ protected $username = ''; + /** + * Password for HTTP basic authentication + * + * @var string + */ + protected $password = ''; + /** * The host * @@ -101,7 +128,7 @@ class Configuration protected $options = []; /** @var ?callable */ - protected $payloadHook = null; + protected $payloadHook; /** * Constructor @@ -111,17 +138,68 @@ public function __construct() $this->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(string $apiKeyIdentifier, string $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string|null API key or token + */ + public function getApiKey(string $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(string $apiKeyIdentifier, string $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string|null + */ + public function getApiKeyPrefix(string $apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + /** * Sets the access token for OAuth * * @param string $accessToken Token for OAuth * - * @return self + * @return $this */ public function setAccessToken(string $accessToken) { $this->accessToken = $accessToken; - return $this; } @@ -136,17 +214,42 @@ public function getAccessToken() } /** - * Sets the API key + * Sets boolean format for query string. * - * @param string $key API key or token + * @param string $booleanFormat Boolean format for query string + * + * @return $this */ - public function setUsername(string $key): self + public function setBooleanFormatForQueryString(string $booleanFormat) { - $this->username = $key; + $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(string $username) + { + $this->username = $username; + return $this; + } + /** * Gets the username for HTTP basic authentication * @@ -157,17 +260,39 @@ 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(string $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 self + * @return $this */ public function setHost(string $host) { $this->host = $host; - return $this; } @@ -186,8 +311,8 @@ public function getHost() * * @param string $userAgent the user agent of the api client * + * @return $this * @throws InvalidArgumentException - * @return self */ public function setUserAgent(string $userAgent) { @@ -196,7 +321,6 @@ public function setUserAgent(string $userAgent) } $this->userAgent = $userAgent; - return $this; } @@ -215,12 +339,11 @@ public function getUserAgent() * * @param bool $debug Debug flag * - * @return self + * @return $this */ public function setDebug(bool $debug) { $this->debug = $debug; - return $this; } @@ -239,12 +362,11 @@ public function getDebug() * * @param string $debugFile Debug file * - * @return self + * @return $this */ public function setDebugFile(string $debugFile) { $this->debugFile = $debugFile; - return $this; } @@ -263,12 +385,11 @@ public function getDebugFile() * * @param string $tempFolderPath Temp folder path * - * @return self + * @return $this */ public function setTempFolderPath(string $tempFolderPath) { $this->tempFolderPath = $tempFolderPath; - return $this; } @@ -300,8 +421,6 @@ public static function getDefaultConfiguration() * Sets the default configuration instance * * @param Configuration $config An instance of the Configuration Object - * - * @return void */ public static function setDefaultConfiguration(Configuration $config) { @@ -325,6 +444,31 @@ public static function toDebugReport() return $report; } + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string|null API key with the prefix + */ + public function getApiKeyWithPrefix(string $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 * @@ -341,35 +485,34 @@ public function getHostSettings() } /** - * Returns URL based on the index and variables + * Returns URL based on host settings, 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 + * @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 function getHostFromSettings(int $index, ?array $variables = null) + public static function getHostString(array $hostSettings, int $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']) . '.'); + 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 @@ -381,13 +524,15 @@ public function getHostFromSettings(int $index, ?array $variables = null) } /** - * Set extra request options + * 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 setOptions(array $options): self + public function getHostFromSettings(int $index, ?array $variables = null) { - $this->options = $options; - - return $this; + return self::getHostString($this->getHostSettings(), $index, $variables); } /** diff --git a/sdks/php/src/EventCallbackHelper.php b/sdks/php/src/EventCallbackHelper.php index 094e770c4..9a45e4507 100644 --- a/sdks/php/src/EventCallbackHelper.php +++ b/sdks/php/src/EventCallbackHelper.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * EventCallbackHelper Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ abstract class EventCallbackHelper diff --git a/sdks/php/src/HeaderSelector.php b/sdks/php/src/HeaderSelector.php index 8529bc2a2..49fb0c15c 100644 --- a/sdks/php/src/HeaderSelector.php +++ b/sdks/php/src/HeaderSelector.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -28,20 +27,18 @@ namespace Dropbox\Sign; /** - * ApiException Class Doc Comment + * HeaderSelector Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class HeaderSelector { /** - * @param string[] $accept - * @param string[] $contentTypes - * @return array + * @param string[] $accept + * @return string[] */ - public function selectHeaders(array $accept, array $contentTypes) + public function selectHeaders(array $accept, string $contentType, bool $isMultipart): array { $headers = []; @@ -50,57 +47,183 @@ public function selectHeaders(array $accept, array $contentTypes) $headers['Accept'] = $accept; } - $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + if (!$isMultipart) { + if ($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } return $headers; } /** - * @param string[] $accept - * @return array + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return string|null Accept (e.g. application/json) */ - public function selectHeadersForMultipart(array $accept) + private function selectAcceptHeader(array $accept): ?string { - $headers = $this->selectHeaders($accept, []); + // filter out empty entries + $accept = array_filter($accept); - unset($headers['Content-Type']); + if (count($accept) === 0) { + return null; + } - return $headers; + // 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 header 'Accept' based on an array of Accept provided + * Create an Accept header string from the given "Accept" headers array, recalculating all weights * - * @param string[] $accept Array of header + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" * - * @return string|null Accept (e.g. application/json) + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") */ - private function selectAcceptHeader(array $accept) + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string { - 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 { - return implode(',', $accept); + $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); } /** - * Return the content type based on an array of content-type provided + * 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(array $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 + * @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; + } + + 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) + */ + 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/sdks/php/src/Model/AccountCreateRequest.php b/sdks/php/src/Model/AccountCreateRequest.php index 299eefa02..d756597a3 100644 --- a/sdks/php/src/Model/AccountCreateRequest.php +++ b/sdks/php/src/Model/AccountCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * AccountCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class AccountCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -80,6 +77,25 @@ class AccountCreateRequest implements ModelInterface, ArrayAccess, JsonSerializa 'locale' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + 'client_id' => false, + 'client_secret' => false, + 'locale' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -100,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -181,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['client_secret'] = $data['client_secret'] ?? null; - $this->container['locale'] = $data['locale'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('client_secret', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountCreateRequest { /** @var AccountCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountCreateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +305,6 @@ public function listInvalidProperties() if ($this->container['email_address'] === null) { $invalidProperties[] = "'email_address' can't be null"; } - return $invalidProperties; } @@ -263,6 +338,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -287,6 +365,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -311,6 +392,9 @@ public function getClientSecret() */ public function setClientSecret(?string $client_secret) { + if (is_null($client_secret)) { + throw new InvalidArgumentException('non-nullable client_secret cannot be null'); + } $this->container['client_secret'] = $client_secret; return $this; @@ -335,6 +419,9 @@ public function getLocale() */ public function setLocale(?string $locale) { + if (is_null($locale)) { + throw new InvalidArgumentException('non-nullable locale cannot be null'); + } $this->container['locale'] = $locale; return $this; @@ -343,12 +430,10 @@ public function setLocale(?string $locale) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -356,7 +441,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -369,13 +454,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -387,12 +470,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -401,8 +482,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -419,7 +500,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountCreateResponse.php b/sdks/php/src/Model/AccountCreateResponse.php index 931e9cd7f..1eb26a157 100644 --- a/sdks/php/src/Model/AccountCreateResponse.php +++ b/sdks/php/src/Model/AccountCreateResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * AccountCreateResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountCreateResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class AccountCreateResponse implements ModelInterface, ArrayAccess, JsonSerializ 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account' => false, + 'oauth_data' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account'] = $data['account'] ?? null; - $this->container['oauth_data'] = $data['oauth_data'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('account', $data ?? [], null); + $this->setIfExists('oauth_data', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountCreateResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountCreateResponse { /** @var AccountCreateResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountCreateResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): AccountCreateResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getAccount() */ public function setAccount(?AccountResponse $account) { + if (is_null($account)) { + throw new InvalidArgumentException('non-nullable account cannot be null'); + } $this->container['account'] = $account; return $this; @@ -278,6 +353,9 @@ public function getOauthData() */ public function setOauthData(?OAuthTokenResponse $oauth_data) { + if (is_null($oauth_data)) { + throw new InvalidArgumentException('non-nullable oauth_data cannot be null'); + } $this->container['oauth_data'] = $oauth_data; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountGetResponse.php b/sdks/php/src/Model/AccountGetResponse.php index d572c01fb..5923246b4 100644 --- a/sdks/php/src/Model/AccountGetResponse.php +++ b/sdks/php/src/Model/AccountGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * AccountGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class AccountGetResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account'] = $data['account'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('account', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountGetResponse { /** @var AccountGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountGetResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): AccountGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getAccount() */ public function setAccount(?AccountResponse $account) { + if (is_null($account)) { + throw new InvalidArgumentException('non-nullable account cannot be null'); + } $this->container['account'] = $account; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountResponse.php b/sdks/php/src/Model/AccountResponse.php index e9089384d..436f640bd 100644 --- a/sdks/php/src/Model/AccountResponse.php +++ b/sdks/php/src/Model/AccountResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * AccountResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -95,6 +91,32 @@ class AccountResponse implements ModelInterface, ArrayAccess, JsonSerializable 'usage' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'is_locked' => false, + 'is_paid_hs' => false, + 'is_paid_hf' => false, + 'quotas' => false, + 'callback_url' => true, + 'role_code' => true, + 'team_id' => true, + 'locale' => true, + 'usage' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -115,6 +137,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -217,47 +283,63 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['is_locked'] = $data['is_locked'] ?? null; - $this->container['is_paid_hs'] = $data['is_paid_hs'] ?? null; - $this->container['is_paid_hf'] = $data['is_paid_hf'] ?? null; - $this->container['quotas'] = $data['quotas'] ?? null; - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['role_code'] = $data['role_code'] ?? null; - $this->container['team_id'] = $data['team_id'] ?? null; - $this->container['locale'] = $data['locale'] ?? null; - $this->container['usage'] = $data['usage'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('is_locked', $data ?? [], null); + $this->setIfExists('is_paid_hs', $data ?? [], null); + $this->setIfExists('is_paid_hf', $data ?? [], null); + $this->setIfExists('quotas', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('role_code', $data ?? [], null); + $this->setIfExists('team_id', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); + $this->setIfExists('usage', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountResponse { /** @var AccountResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -267,9 +349,7 @@ public static function init(array $data): AccountResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -302,6 +382,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -326,6 +409,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -350,6 +436,9 @@ public function getIsLocked() */ public function setIsLocked(?bool $is_locked) { + if (is_null($is_locked)) { + throw new InvalidArgumentException('non-nullable is_locked cannot be null'); + } $this->container['is_locked'] = $is_locked; return $this; @@ -374,6 +463,9 @@ public function getIsPaidHs() */ public function setIsPaidHs(?bool $is_paid_hs) { + if (is_null($is_paid_hs)) { + throw new InvalidArgumentException('non-nullable is_paid_hs cannot be null'); + } $this->container['is_paid_hs'] = $is_paid_hs; return $this; @@ -398,6 +490,9 @@ public function getIsPaidHf() */ public function setIsPaidHf(?bool $is_paid_hf) { + if (is_null($is_paid_hf)) { + throw new InvalidArgumentException('non-nullable is_paid_hf cannot be null'); + } $this->container['is_paid_hf'] = $is_paid_hf; return $this; @@ -422,6 +517,9 @@ public function getQuotas() */ public function setQuotas(?AccountResponseQuotas $quotas) { + if (is_null($quotas)) { + throw new InvalidArgumentException('non-nullable quotas cannot be null'); + } $this->container['quotas'] = $quotas; return $this; @@ -446,6 +544,16 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + array_push($this->openAPINullablesSetToNull, 'callback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['callback_url'] = $callback_url; return $this; @@ -470,6 +578,16 @@ public function getRoleCode() */ public function setRoleCode(?string $role_code) { + if (is_null($role_code)) { + array_push($this->openAPINullablesSetToNull, 'role_code'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('role_code', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['role_code'] = $role_code; return $this; @@ -494,6 +612,16 @@ public function getTeamId() */ public function setTeamId(?string $team_id) { + if (is_null($team_id)) { + array_push($this->openAPINullablesSetToNull, 'team_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('team_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['team_id'] = $team_id; return $this; @@ -518,6 +646,16 @@ public function getLocale() */ public function setLocale(?string $locale) { + if (is_null($locale)) { + array_push($this->openAPINullablesSetToNull, 'locale'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('locale', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['locale'] = $locale; return $this; @@ -542,6 +680,9 @@ public function getUsage() */ public function setUsage(?AccountResponseUsage $usage) { + if (is_null($usage)) { + throw new InvalidArgumentException('non-nullable usage cannot be null'); + } $this->container['usage'] = $usage; return $this; @@ -550,12 +691,10 @@ public function setUsage(?AccountResponseUsage $usage) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -563,7 +702,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -576,13 +715,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -594,12 +731,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -608,8 +743,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -626,7 +761,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountResponseQuotas.php b/sdks/php/src/Model/AccountResponseQuotas.php index cccd306d1..d723541ce 100644 --- a/sdks/php/src/Model/AccountResponseQuotas.php +++ b/sdks/php/src/Model/AccountResponseQuotas.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,12 +37,8 @@ * * @category Class * @description Details concerning remaining monthly quotas. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountResponseQuotas implements ModelInterface, ArrayAccess, JsonSerializable { @@ -86,6 +81,27 @@ class AccountResponseQuotas implements ModelInterface, ArrayAccess, JsonSerializ 'num_fax_pages_left' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'api_signature_requests_left' => true, + 'documents_left' => true, + 'templates_total' => true, + 'templates_left' => true, + 'sms_verifications_left' => true, + 'num_fax_pages_left' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -106,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -193,42 +253,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['api_signature_requests_left'] = $data['api_signature_requests_left'] ?? null; - $this->container['documents_left'] = $data['documents_left'] ?? null; - $this->container['templates_total'] = $data['templates_total'] ?? null; - $this->container['templates_left'] = $data['templates_left'] ?? null; - $this->container['sms_verifications_left'] = $data['sms_verifications_left'] ?? null; - $this->container['num_fax_pages_left'] = $data['num_fax_pages_left'] ?? null; + $this->setIfExists('api_signature_requests_left', $data ?? [], null); + $this->setIfExists('documents_left', $data ?? [], null); + $this->setIfExists('templates_total', $data ?? [], null); + $this->setIfExists('templates_left', $data ?? [], null); + $this->setIfExists('sms_verifications_left', $data ?? [], null); + $this->setIfExists('num_fax_pages_left', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountResponseQuotas { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountResponseQuotas { /** @var AccountResponseQuotas $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountResponseQuotas::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -238,9 +314,7 @@ public static function init(array $data): AccountResponseQuotas */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -273,6 +347,16 @@ public function getApiSignatureRequestsLeft() */ public function setApiSignatureRequestsLeft(?int $api_signature_requests_left) { + if (is_null($api_signature_requests_left)) { + array_push($this->openAPINullablesSetToNull, 'api_signature_requests_left'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('api_signature_requests_left', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['api_signature_requests_left'] = $api_signature_requests_left; return $this; @@ -297,6 +381,16 @@ public function getDocumentsLeft() */ public function setDocumentsLeft(?int $documents_left) { + if (is_null($documents_left)) { + array_push($this->openAPINullablesSetToNull, 'documents_left'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('documents_left', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['documents_left'] = $documents_left; return $this; @@ -321,6 +415,16 @@ public function getTemplatesTotal() */ public function setTemplatesTotal(?int $templates_total) { + if (is_null($templates_total)) { + array_push($this->openAPINullablesSetToNull, 'templates_total'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('templates_total', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['templates_total'] = $templates_total; return $this; @@ -345,6 +449,16 @@ public function getTemplatesLeft() */ public function setTemplatesLeft(?int $templates_left) { + if (is_null($templates_left)) { + array_push($this->openAPINullablesSetToNull, 'templates_left'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('templates_left', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['templates_left'] = $templates_left; return $this; @@ -369,6 +483,16 @@ public function getSmsVerificationsLeft() */ public function setSmsVerificationsLeft(?int $sms_verifications_left) { + if (is_null($sms_verifications_left)) { + array_push($this->openAPINullablesSetToNull, 'sms_verifications_left'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sms_verifications_left', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['sms_verifications_left'] = $sms_verifications_left; return $this; @@ -393,6 +517,16 @@ public function getNumFaxPagesLeft() */ public function setNumFaxPagesLeft(?int $num_fax_pages_left) { + if (is_null($num_fax_pages_left)) { + array_push($this->openAPINullablesSetToNull, 'num_fax_pages_left'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('num_fax_pages_left', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['num_fax_pages_left'] = $num_fax_pages_left; return $this; @@ -401,12 +535,10 @@ public function setNumFaxPagesLeft(?int $num_fax_pages_left) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -414,7 +546,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -427,13 +559,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -445,12 +575,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -459,8 +587,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -477,7 +605,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountResponseUsage.php b/sdks/php/src/Model/AccountResponseUsage.php index 847becac0..d59ee3ce3 100644 --- a/sdks/php/src/Model/AccountResponseUsage.php +++ b/sdks/php/src/Model/AccountResponseUsage.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,12 +37,8 @@ * * @category Class * @description Details concerning monthly usage - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountResponseUsage implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +71,22 @@ class AccountResponseUsage implements ModelInterface, ArrayAccess, JsonSerializa 'fax_pages_sent' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'fax_pages_sent' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['fax_pages_sent'] = $data['fax_pages_sent'] ?? null; + $this->setIfExists('fax_pages_sent', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountResponseUsage { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountResponseUsage { /** @var AccountResponseUsage $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountResponseUsage::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -208,9 +279,7 @@ public static function init(array $data): AccountResponseUsage */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -243,6 +312,16 @@ public function getFaxPagesSent() */ public function setFaxPagesSent(?int $fax_pages_sent) { + if (is_null($fax_pages_sent)) { + array_push($this->openAPINullablesSetToNull, 'fax_pages_sent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('fax_pages_sent', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['fax_pages_sent'] = $fax_pages_sent; return $this; @@ -251,12 +330,10 @@ public function setFaxPagesSent(?int $fax_pages_sent) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -264,7 +341,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -277,13 +354,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -295,12 +370,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -309,8 +382,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -327,7 +400,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountUpdateRequest.php b/sdks/php/src/Model/AccountUpdateRequest.php index 9eb908f5b..9860e9268 100644 --- a/sdks/php/src/Model/AccountUpdateRequest.php +++ b/sdks/php/src/Model/AccountUpdateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * AccountUpdateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class AccountUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class AccountUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializa 'locale' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => true, + 'callback_url' => false, + 'locale' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['locale'] = $data['locale'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('locale', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountUpdateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountUpdateRequest { /** @var AccountUpdateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountUpdateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -218,9 +293,7 @@ public static function init(array $data): AccountUpdateRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -253,6 +326,16 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + array_push($this->openAPINullablesSetToNull, 'account_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('account_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['account_id'] = $account_id; return $this; @@ -277,6 +360,9 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -301,6 +387,9 @@ public function getLocale() */ public function setLocale(?string $locale) { + if (is_null($locale)) { + throw new InvalidArgumentException('non-nullable locale cannot be null'); + } $this->container['locale'] = $locale; return $this; @@ -309,12 +398,10 @@ public function setLocale(?string $locale) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -322,7 +409,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -335,13 +422,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -353,12 +438,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -367,8 +450,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -385,7 +468,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountVerifyRequest.php b/sdks/php/src/Model/AccountVerifyRequest.php index 123cb57b2..a7c83be5c 100644 --- a/sdks/php/src/Model/AccountVerifyRequest.php +++ b/sdks/php/src/Model/AccountVerifyRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * AccountVerifyRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class AccountVerifyRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class AccountVerifyRequest implements ModelInterface, ArrayAccess, JsonSerializa 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountVerifyRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountVerifyRequest { /** @var AccountVerifyRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountVerifyRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -211,7 +284,6 @@ public function listInvalidProperties() if ($this->container['email_address'] === null) { $invalidProperties[] = "'email_address' can't be null"; } - return $invalidProperties; } @@ -245,6 +317,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -253,12 +328,10 @@ public function setEmailAddress(string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -266,7 +339,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -279,13 +352,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -297,12 +368,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -311,8 +380,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -329,7 +398,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountVerifyResponse.php b/sdks/php/src/Model/AccountVerifyResponse.php index 51983c5de..8d58413b2 100644 --- a/sdks/php/src/Model/AccountVerifyResponse.php +++ b/sdks/php/src/Model/AccountVerifyResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * AccountVerifyResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountVerifyResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class AccountVerifyResponse implements ModelInterface, ArrayAccess, JsonSerializ 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account'] = $data['account'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('account', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountVerifyResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountVerifyResponse { /** @var AccountVerifyResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountVerifyResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): AccountVerifyResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getAccount() */ public function setAccount(?AccountVerifyResponseAccount $account) { + if (is_null($account)) { + throw new InvalidArgumentException('non-nullable account cannot be null'); + } $this->container['account'] = $account; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/AccountVerifyResponseAccount.php b/sdks/php/src/Model/AccountVerifyResponseAccount.php index 1e045182f..0dafa1045 100644 --- a/sdks/php/src/Model/AccountVerifyResponseAccount.php +++ b/sdks/php/src/Model/AccountVerifyResponseAccount.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * AccountVerifyResponseAccount Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class AccountVerifyResponseAccount implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +71,22 @@ class AccountVerifyResponseAccount implements ModelInterface, ArrayAccess, JsonS 'email_address' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): AccountVerifyResponseAccount { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): AccountVerifyResponseAccount { /** @var AccountVerifyResponseAccount $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, AccountVerifyResponseAccount::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -207,9 +279,7 @@ public static function init(array $data): AccountVerifyResponseAccount */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +312,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -250,12 +323,10 @@ public function setEmailAddress(?string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -326,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppCreateRequest.php b/sdks/php/src/Model/ApiAppCreateRequest.php index c863aad89..3b9626847 100644 --- a/sdks/php/src/Model/ApiAppCreateRequest.php +++ b/sdks/php/src/Model/ApiAppCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * ApiAppCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ApiAppCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -88,6 +84,28 @@ class ApiAppCreateRequest implements ModelInterface, ArrayAccess, JsonSerializab 'white_labeling_options' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'domains' => false, + 'name' => false, + 'callback_url' => false, + 'custom_logo_file' => false, + 'oauth' => false, + 'options' => false, + 'white_labeling_options' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -108,6 +126,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -198,43 +260,59 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['domains'] = $data['domains'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['custom_logo_file'] = $data['custom_logo_file'] ?? null; - $this->container['oauth'] = $data['oauth'] ?? null; - $this->container['options'] = $data['options'] ?? null; - $this->container['white_labeling_options'] = $data['white_labeling_options'] ?? null; + $this->setIfExists('domains', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('custom_logo_file', $data ?? [], null); + $this->setIfExists('oauth', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('white_labeling_options', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppCreateRequest { /** @var ApiAppCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppCreateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -249,18 +327,17 @@ public function listInvalidProperties() if ($this->container['domains'] === null) { $invalidProperties[] = "'domains' can't be null"; } - if ((count($this->container['domains']) > 2)) { + if (count($this->container['domains']) > 2) { $invalidProperties[] = "invalid value for 'domains', number of items must be less than or equal to 2."; } - if ((count($this->container['domains']) < 1)) { + if (count($this->container['domains']) < 1) { $invalidProperties[] = "invalid value for 'domains', number of items must be greater than or equal to 1."; } if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - return $invalidProperties; } @@ -294,10 +371,14 @@ public function getDomains() */ public function setDomains(array $domains) { - if ((count($domains) > 2)) { + if (is_null($domains)) { + throw new InvalidArgumentException('non-nullable domains cannot be null'); + } + + if (count($domains) > 2) { throw new InvalidArgumentException('invalid value for $domains when calling ApiAppCreateRequest., number of items must be less than or equal to 2.'); } - if ((count($domains) < 1)) { + if (count($domains) < 1) { throw new InvalidArgumentException('invalid length for $domains when calling ApiAppCreateRequest., number of items must be greater than or equal to 1.'); } $this->container['domains'] = $domains; @@ -324,6 +405,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -348,6 +432,9 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -372,6 +459,9 @@ public function getCustomLogoFile() */ public function setCustomLogoFile(?SplFileObject $custom_logo_file) { + if (is_null($custom_logo_file)) { + throw new InvalidArgumentException('non-nullable custom_logo_file cannot be null'); + } $this->container['custom_logo_file'] = $custom_logo_file; return $this; @@ -396,6 +486,9 @@ public function getOauth() */ public function setOauth(?SubOAuth $oauth) { + if (is_null($oauth)) { + throw new InvalidArgumentException('non-nullable oauth cannot be null'); + } $this->container['oauth'] = $oauth; return $this; @@ -420,6 +513,9 @@ public function getOptions() */ public function setOptions(?SubOptions $options) { + if (is_null($options)) { + throw new InvalidArgumentException('non-nullable options cannot be null'); + } $this->container['options'] = $options; return $this; @@ -444,6 +540,9 @@ public function getWhiteLabelingOptions() */ public function setWhiteLabelingOptions(?SubWhiteLabelingOptions $white_labeling_options) { + if (is_null($white_labeling_options)) { + throw new InvalidArgumentException('non-nullable white_labeling_options cannot be null'); + } $this->container['white_labeling_options'] = $white_labeling_options; return $this; @@ -452,12 +551,10 @@ public function setWhiteLabelingOptions(?SubWhiteLabelingOptions $white_labeling /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -465,7 +562,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -478,13 +575,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -496,12 +591,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -510,8 +603,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -528,7 +621,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppGetResponse.php b/sdks/php/src/Model/ApiAppGetResponse.php index 7314d7b04..03cb956ef 100644 --- a/sdks/php/src/Model/ApiAppGetResponse.php +++ b/sdks/php/src/Model/ApiAppGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * ApiAppGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class ApiAppGetResponse implements ModelInterface, ArrayAccess, JsonSerializable 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'api_app' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['api_app'] = $data['api_app'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('api_app', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppGetResponse { /** @var ApiAppGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppGetResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): ApiAppGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getApiApp() */ public function setApiApp(?ApiAppResponse $api_app) { + if (is_null($api_app)) { + throw new InvalidArgumentException('non-nullable api_app cannot be null'); + } $this->container['api_app'] = $api_app; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppListResponse.php b/sdks/php/src/Model/ApiAppListResponse.php index c795f6428..b99df032d 100644 --- a/sdks/php/src/Model/ApiAppListResponse.php +++ b/sdks/php/src/Model/ApiAppListResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * ApiAppListResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppListResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class ApiAppListResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'api_apps' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['api_apps'] = $data['api_apps'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('api_apps', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppListResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppListResponse { /** @var ApiAppListResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppListResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): ApiAppListResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getApiApps() */ public function setApiApps(?array $api_apps) { + if (is_null($api_apps)) { + throw new InvalidArgumentException('non-nullable api_apps cannot be null'); + } $this->container['api_apps'] = $api_apps; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppResponse.php b/sdks/php/src/Model/ApiAppResponse.php index cbc677357..8ecab40f6 100644 --- a/sdks/php/src/Model/ApiAppResponse.php +++ b/sdks/php/src/Model/ApiAppResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains information about an API App. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -94,6 +90,31 @@ class ApiAppResponse implements ModelInterface, ArrayAccess, JsonSerializable 'white_labeling_options' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'callback_url' => true, + 'client_id' => false, + 'created_at' => false, + 'domains' => false, + 'name' => false, + 'is_approved' => false, + 'oauth' => true, + 'options' => true, + 'owner_account' => false, + 'white_labeling_options' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -114,6 +135,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -213,46 +278,62 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['domains'] = $data['domains'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['is_approved'] = $data['is_approved'] ?? null; - $this->container['oauth'] = $data['oauth'] ?? null; - $this->container['options'] = $data['options'] ?? null; - $this->container['owner_account'] = $data['owner_account'] ?? null; - $this->container['white_labeling_options'] = $data['white_labeling_options'] ?? null; + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('domains', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('is_approved', $data ?? [], null); + $this->setIfExists('oauth', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('owner_account', $data ?? [], null); + $this->setIfExists('white_labeling_options', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppResponse { /** @var ApiAppResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -262,9 +343,7 @@ public static function init(array $data): ApiAppResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -297,6 +376,16 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + array_push($this->openAPINullablesSetToNull, 'callback_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('callback_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['callback_url'] = $callback_url; return $this; @@ -321,6 +410,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -345,6 +437,9 @@ public function getCreatedAt() */ public function setCreatedAt(?int $created_at) { + if (is_null($created_at)) { + throw new InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -369,6 +464,9 @@ public function getDomains() */ public function setDomains(?array $domains) { + if (is_null($domains)) { + throw new InvalidArgumentException('non-nullable domains cannot be null'); + } $this->container['domains'] = $domains; return $this; @@ -393,6 +491,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -417,6 +518,9 @@ public function getIsApproved() */ public function setIsApproved(?bool $is_approved) { + if (is_null($is_approved)) { + throw new InvalidArgumentException('non-nullable is_approved cannot be null'); + } $this->container['is_approved'] = $is_approved; return $this; @@ -441,6 +545,16 @@ public function getOauth() */ public function setOauth(?ApiAppResponseOAuth $oauth) { + if (is_null($oauth)) { + array_push($this->openAPINullablesSetToNull, 'oauth'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('oauth', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['oauth'] = $oauth; return $this; @@ -465,6 +579,16 @@ public function getOptions() */ public function setOptions(?ApiAppResponseOptions $options) { + if (is_null($options)) { + array_push($this->openAPINullablesSetToNull, 'options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('options', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['options'] = $options; return $this; @@ -489,6 +613,9 @@ public function getOwnerAccount() */ public function setOwnerAccount(?ApiAppResponseOwnerAccount $owner_account) { + if (is_null($owner_account)) { + throw new InvalidArgumentException('non-nullable owner_account cannot be null'); + } $this->container['owner_account'] = $owner_account; return $this; @@ -513,6 +640,16 @@ public function getWhiteLabelingOptions() */ public function setWhiteLabelingOptions(?ApiAppResponseWhiteLabelingOptions $white_labeling_options) { + if (is_null($white_labeling_options)) { + array_push($this->openAPINullablesSetToNull, 'white_labeling_options'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('white_labeling_options', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['white_labeling_options'] = $white_labeling_options; return $this; @@ -521,12 +658,10 @@ public function setWhiteLabelingOptions(?ApiAppResponseWhiteLabelingOptions $whi /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -534,7 +669,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -547,13 +682,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -565,12 +698,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -579,8 +710,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -597,7 +728,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppResponseOAuth.php b/sdks/php/src/Model/ApiAppResponseOAuth.php index 343d42211..6823b6326 100644 --- a/sdks/php/src/Model/ApiAppResponseOAuth.php +++ b/sdks/php/src/Model/ApiAppResponseOAuth.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An object describing the app's OAuth properties, or null if OAuth is not configured for the app. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppResponseOAuth implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class ApiAppResponseOAuth implements ModelInterface, ArrayAccess, JsonSerializab 'charges_users' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'callback_url' => false, + 'secret' => false, + 'scopes' => false, + 'charges_users' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['secret'] = $data['secret'] ?? null; - $this->container['scopes'] = $data['scopes'] ?? null; - $this->container['charges_users'] = $data['charges_users'] ?? null; + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('secret', $data ?? [], null); + $this->setIfExists('scopes', $data ?? [], null); + $this->setIfExists('charges_users', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppResponseOAuth { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppResponseOAuth { /** @var ApiAppResponseOAuth $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppResponseOAuth::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): ApiAppResponseOAuth */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,9 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -285,6 +361,9 @@ public function getSecret() */ public function setSecret(?string $secret) { + if (is_null($secret)) { + throw new InvalidArgumentException('non-nullable secret cannot be null'); + } $this->container['secret'] = $secret; return $this; @@ -309,6 +388,9 @@ public function getScopes() */ public function setScopes(?array $scopes) { + if (is_null($scopes)) { + throw new InvalidArgumentException('non-nullable scopes cannot be null'); + } $this->container['scopes'] = $scopes; return $this; @@ -333,6 +415,9 @@ public function getChargesUsers() */ public function setChargesUsers(?bool $charges_users) { + if (is_null($charges_users)) { + throw new InvalidArgumentException('non-nullable charges_users cannot be null'); + } $this->container['charges_users'] = $charges_users; return $this; @@ -341,12 +426,10 @@ public function setChargesUsers(?bool $charges_users) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -354,7 +437,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -367,13 +450,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -385,12 +466,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -399,8 +478,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -417,7 +496,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppResponseOptions.php b/sdks/php/src/Model/ApiAppResponseOptions.php index 4e24a1f7e..9eccb73f1 100644 --- a/sdks/php/src/Model/ApiAppResponseOptions.php +++ b/sdks/php/src/Model/ApiAppResponseOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An object with options that override account settings. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppResponseOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +72,22 @@ class ApiAppResponseOptions implements ModelInterface, ArrayAccess, JsonSerializ 'can_insert_everywhere' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'can_insert_everywhere' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,37 +224,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['can_insert_everywhere'] = $data['can_insert_everywhere'] ?? null; + $this->setIfExists('can_insert_everywhere', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppResponseOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppResponseOptions { /** @var ApiAppResponseOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppResponseOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -208,9 +280,7 @@ public static function init(array $data): ApiAppResponseOptions */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -243,6 +313,9 @@ public function getCanInsertEverywhere() */ public function setCanInsertEverywhere(?bool $can_insert_everywhere) { + if (is_null($can_insert_everywhere)) { + throw new InvalidArgumentException('non-nullable can_insert_everywhere cannot be null'); + } $this->container['can_insert_everywhere'] = $can_insert_everywhere; return $this; @@ -251,12 +324,10 @@ public function setCanInsertEverywhere(?bool $can_insert_everywhere) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -264,7 +335,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -277,13 +348,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -295,12 +364,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -309,8 +376,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -327,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php index f3fb77f97..4dc4218c6 100644 --- a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php +++ b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An object describing the app's owner - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppResponseOwnerAccount implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class ApiAppResponseOwnerAccount implements ModelInterface, ArrayAccess, JsonSer 'email_address' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppResponseOwnerAccount { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppResponseOwnerAccount { /** @var ApiAppResponseOwnerAccount $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppResponseOwnerAccount::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): ApiAppResponseOwnerAccount */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -273,6 +347,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -281,12 +358,10 @@ public function setEmailAddress(?string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php index c2c659def..1577389cd 100644 --- a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php +++ b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An object with options to customize the app's signer page - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ApiAppResponseWhiteLabelingOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -102,6 +98,35 @@ class ApiAppResponseWhiteLabelingOptions implements ModelInterface, ArrayAccess, 'text_color2' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'header_background_color' => false, + 'legal_version' => false, + 'link_color' => false, + 'page_background_color' => false, + 'primary_button_color' => false, + 'primary_button_color_hover' => false, + 'primary_button_text_color' => false, + 'primary_button_text_color_hover' => false, + 'secondary_button_color' => false, + 'secondary_button_color_hover' => false, + 'secondary_button_text_color' => false, + 'secondary_button_text_color_hover' => false, + 'text_color1' => false, + 'text_color2' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -122,6 +147,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -233,50 +302,66 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['header_background_color'] = $data['header_background_color'] ?? null; - $this->container['legal_version'] = $data['legal_version'] ?? null; - $this->container['link_color'] = $data['link_color'] ?? null; - $this->container['page_background_color'] = $data['page_background_color'] ?? null; - $this->container['primary_button_color'] = $data['primary_button_color'] ?? null; - $this->container['primary_button_color_hover'] = $data['primary_button_color_hover'] ?? null; - $this->container['primary_button_text_color'] = $data['primary_button_text_color'] ?? null; - $this->container['primary_button_text_color_hover'] = $data['primary_button_text_color_hover'] ?? null; - $this->container['secondary_button_color'] = $data['secondary_button_color'] ?? null; - $this->container['secondary_button_color_hover'] = $data['secondary_button_color_hover'] ?? null; - $this->container['secondary_button_text_color'] = $data['secondary_button_text_color'] ?? null; - $this->container['secondary_button_text_color_hover'] = $data['secondary_button_text_color_hover'] ?? null; - $this->container['text_color1'] = $data['text_color1'] ?? null; - $this->container['text_color2'] = $data['text_color2'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('header_background_color', $data ?? [], null); + $this->setIfExists('legal_version', $data ?? [], null); + $this->setIfExists('link_color', $data ?? [], null); + $this->setIfExists('page_background_color', $data ?? [], null); + $this->setIfExists('primary_button_color', $data ?? [], null); + $this->setIfExists('primary_button_color_hover', $data ?? [], null); + $this->setIfExists('primary_button_text_color', $data ?? [], null); + $this->setIfExists('primary_button_text_color_hover', $data ?? [], null); + $this->setIfExists('secondary_button_color', $data ?? [], null); + $this->setIfExists('secondary_button_color_hover', $data ?? [], null); + $this->setIfExists('secondary_button_text_color', $data ?? [], null); + $this->setIfExists('secondary_button_text_color_hover', $data ?? [], null); + $this->setIfExists('text_color1', $data ?? [], null); + $this->setIfExists('text_color2', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppResponseWhiteLabelingOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppResponseWhiteLabelingOptions { /** @var ApiAppResponseWhiteLabelingOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppResponseWhiteLabelingOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -286,9 +371,7 @@ public static function init(array $data): ApiAppResponseWhiteLabelingOptions */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -321,6 +404,9 @@ public function getHeaderBackgroundColor() */ public function setHeaderBackgroundColor(?string $header_background_color) { + if (is_null($header_background_color)) { + throw new InvalidArgumentException('non-nullable header_background_color cannot be null'); + } $this->container['header_background_color'] = $header_background_color; return $this; @@ -345,6 +431,9 @@ public function getLegalVersion() */ public function setLegalVersion(?string $legal_version) { + if (is_null($legal_version)) { + throw new InvalidArgumentException('non-nullable legal_version cannot be null'); + } $this->container['legal_version'] = $legal_version; return $this; @@ -369,6 +458,9 @@ public function getLinkColor() */ public function setLinkColor(?string $link_color) { + if (is_null($link_color)) { + throw new InvalidArgumentException('non-nullable link_color cannot be null'); + } $this->container['link_color'] = $link_color; return $this; @@ -393,6 +485,9 @@ public function getPageBackgroundColor() */ public function setPageBackgroundColor(?string $page_background_color) { + if (is_null($page_background_color)) { + throw new InvalidArgumentException('non-nullable page_background_color cannot be null'); + } $this->container['page_background_color'] = $page_background_color; return $this; @@ -417,6 +512,9 @@ public function getPrimaryButtonColor() */ public function setPrimaryButtonColor(?string $primary_button_color) { + if (is_null($primary_button_color)) { + throw new InvalidArgumentException('non-nullable primary_button_color cannot be null'); + } $this->container['primary_button_color'] = $primary_button_color; return $this; @@ -441,6 +539,9 @@ public function getPrimaryButtonColorHover() */ public function setPrimaryButtonColorHover(?string $primary_button_color_hover) { + if (is_null($primary_button_color_hover)) { + throw new InvalidArgumentException('non-nullable primary_button_color_hover cannot be null'); + } $this->container['primary_button_color_hover'] = $primary_button_color_hover; return $this; @@ -465,6 +566,9 @@ public function getPrimaryButtonTextColor() */ public function setPrimaryButtonTextColor(?string $primary_button_text_color) { + if (is_null($primary_button_text_color)) { + throw new InvalidArgumentException('non-nullable primary_button_text_color cannot be null'); + } $this->container['primary_button_text_color'] = $primary_button_text_color; return $this; @@ -489,6 +593,9 @@ public function getPrimaryButtonTextColorHover() */ public function setPrimaryButtonTextColorHover(?string $primary_button_text_color_hover) { + if (is_null($primary_button_text_color_hover)) { + throw new InvalidArgumentException('non-nullable primary_button_text_color_hover cannot be null'); + } $this->container['primary_button_text_color_hover'] = $primary_button_text_color_hover; return $this; @@ -513,6 +620,9 @@ public function getSecondaryButtonColor() */ public function setSecondaryButtonColor(?string $secondary_button_color) { + if (is_null($secondary_button_color)) { + throw new InvalidArgumentException('non-nullable secondary_button_color cannot be null'); + } $this->container['secondary_button_color'] = $secondary_button_color; return $this; @@ -537,6 +647,9 @@ public function getSecondaryButtonColorHover() */ public function setSecondaryButtonColorHover(?string $secondary_button_color_hover) { + if (is_null($secondary_button_color_hover)) { + throw new InvalidArgumentException('non-nullable secondary_button_color_hover cannot be null'); + } $this->container['secondary_button_color_hover'] = $secondary_button_color_hover; return $this; @@ -561,6 +674,9 @@ public function getSecondaryButtonTextColor() */ public function setSecondaryButtonTextColor(?string $secondary_button_text_color) { + if (is_null($secondary_button_text_color)) { + throw new InvalidArgumentException('non-nullable secondary_button_text_color cannot be null'); + } $this->container['secondary_button_text_color'] = $secondary_button_text_color; return $this; @@ -585,6 +701,9 @@ public function getSecondaryButtonTextColorHover() */ public function setSecondaryButtonTextColorHover(?string $secondary_button_text_color_hover) { + if (is_null($secondary_button_text_color_hover)) { + throw new InvalidArgumentException('non-nullable secondary_button_text_color_hover cannot be null'); + } $this->container['secondary_button_text_color_hover'] = $secondary_button_text_color_hover; return $this; @@ -609,6 +728,9 @@ public function getTextColor1() */ public function setTextColor1(?string $text_color1) { + if (is_null($text_color1)) { + throw new InvalidArgumentException('non-nullable text_color1 cannot be null'); + } $this->container['text_color1'] = $text_color1; return $this; @@ -633,6 +755,9 @@ public function getTextColor2() */ public function setTextColor2(?string $text_color2) { + if (is_null($text_color2)) { + throw new InvalidArgumentException('non-nullable text_color2 cannot be null'); + } $this->container['text_color2'] = $text_color2; return $this; @@ -641,12 +766,10 @@ public function setTextColor2(?string $text_color2) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -654,7 +777,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -667,13 +790,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -685,12 +806,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -699,8 +818,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -717,7 +836,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ApiAppUpdateRequest.php b/sdks/php/src/Model/ApiAppUpdateRequest.php index ddf4dcead..92c0de25d 100644 --- a/sdks/php/src/Model/ApiAppUpdateRequest.php +++ b/sdks/php/src/Model/ApiAppUpdateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * ApiAppUpdateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ApiAppUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -88,6 +84,28 @@ class ApiAppUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializab 'white_labeling_options' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'callback_url' => false, + 'custom_logo_file' => false, + 'domains' => false, + 'name' => false, + 'oauth' => false, + 'options' => false, + 'white_labeling_options' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -108,6 +126,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -198,43 +260,59 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['custom_logo_file'] = $data['custom_logo_file'] ?? null; - $this->container['domains'] = $data['domains'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['oauth'] = $data['oauth'] ?? null; - $this->container['options'] = $data['options'] ?? null; - $this->container['white_labeling_options'] = $data['white_labeling_options'] ?? null; + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('custom_logo_file', $data ?? [], null); + $this->setIfExists('domains', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('oauth', $data ?? [], null); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('white_labeling_options', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ApiAppUpdateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ApiAppUpdateRequest { /** @var ApiAppUpdateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ApiAppUpdateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -283,6 +361,9 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -307,6 +388,9 @@ public function getCustomLogoFile() */ public function setCustomLogoFile(?SplFileObject $custom_logo_file) { + if (is_null($custom_logo_file)) { + throw new InvalidArgumentException('non-nullable custom_logo_file cannot be null'); + } $this->container['custom_logo_file'] = $custom_logo_file; return $this; @@ -331,7 +415,11 @@ public function getDomains() */ public function setDomains(?array $domains) { - if (!is_null($domains) && (count($domains) > 2)) { + if (is_null($domains)) { + throw new InvalidArgumentException('non-nullable domains cannot be null'); + } + + if (count($domains) > 2) { throw new InvalidArgumentException('invalid value for $domains when calling ApiAppUpdateRequest., number of items must be less than or equal to 2.'); } $this->container['domains'] = $domains; @@ -358,6 +446,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -382,6 +473,9 @@ public function getOauth() */ public function setOauth(?SubOAuth $oauth) { + if (is_null($oauth)) { + throw new InvalidArgumentException('non-nullable oauth cannot be null'); + } $this->container['oauth'] = $oauth; return $this; @@ -406,6 +500,9 @@ public function getOptions() */ public function setOptions(?SubOptions $options) { + if (is_null($options)) { + throw new InvalidArgumentException('non-nullable options cannot be null'); + } $this->container['options'] = $options; return $this; @@ -430,6 +527,9 @@ public function getWhiteLabelingOptions() */ public function setWhiteLabelingOptions(?SubWhiteLabelingOptions $white_labeling_options) { + if (is_null($white_labeling_options)) { + throw new InvalidArgumentException('non-nullable white_labeling_options cannot be null'); + } $this->container['white_labeling_options'] = $white_labeling_options; return $this; @@ -438,12 +538,10 @@ public function setWhiteLabelingOptions(?SubWhiteLabelingOptions $white_labeling /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -451,7 +549,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -464,13 +562,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -482,12 +578,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -496,8 +590,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -514,7 +608,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/BulkSendJobGetResponse.php b/sdks/php/src/Model/BulkSendJobGetResponse.php index 455e15b74..da7241056 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponse.php +++ b/sdks/php/src/Model/BulkSendJobGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * BulkSendJobGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class BulkSendJobGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class BulkSendJobGetResponse implements ModelInterface, ArrayAccess, JsonSeriali 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'bulk_send_job' => false, + 'list_info' => false, + 'signature_requests' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -182,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['bulk_send_job'] = $data['bulk_send_job'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['signature_requests'] = $data['signature_requests'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('bulk_send_job', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('signature_requests', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): BulkSendJobGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): BulkSendJobGetResponse { /** @var BulkSendJobGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, BulkSendJobGetResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,9 +300,7 @@ public static function init(array $data): BulkSendJobGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -260,6 +333,9 @@ public function getBulkSendJob() */ public function setBulkSendJob(?BulkSendJobResponse $bulk_send_job) { + if (is_null($bulk_send_job)) { + throw new InvalidArgumentException('non-nullable bulk_send_job cannot be null'); + } $this->container['bulk_send_job'] = $bulk_send_job; return $this; @@ -284,6 +360,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -308,6 +387,9 @@ public function getSignatureRequests() */ public function setSignatureRequests(?array $signature_requests) { + if (is_null($signature_requests)) { + throw new InvalidArgumentException('non-nullable signature_requests cannot be null'); + } $this->container['signature_requests'] = $signature_requests; return $this; @@ -332,6 +414,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -340,12 +425,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -353,7 +436,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -366,13 +449,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -384,12 +465,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -398,8 +477,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -416,7 +495,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php index a3cf4a0d1..4349ced0f 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php +++ b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * BulkSendJobGetResponseSignatureRequests Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class BulkSendJobGetResponseSignatureRequests implements ModelInterface, ArrayAccess, JsonSerializable { @@ -123,6 +119,46 @@ class BulkSendJobGetResponseSignatureRequests implements ModelInterface, ArrayAc 'bulk_send_job_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'test_mode' => true, + 'signature_request_id' => false, + 'requester_email_address' => false, + 'title' => false, + 'original_title' => false, + 'subject' => true, + 'message' => true, + 'metadata' => false, + 'created_at' => false, + 'expires_at' => false, + 'is_complete' => false, + 'is_declined' => false, + 'has_error' => false, + 'files_url' => false, + 'signing_url' => true, + 'details_url' => false, + 'cc_email_addresses' => false, + 'signing_redirect_url' => true, + 'final_copy_uri' => true, + 'template_ids' => true, + 'custom_fields' => true, + 'attachments' => true, + 'response_data' => true, + 'signatures' => false, + 'bulk_send_job_id' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -143,6 +179,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -287,61 +367,77 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['signature_request_id'] = $data['signature_request_id'] ?? null; - $this->container['requester_email_address'] = $data['requester_email_address'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['original_title'] = $data['original_title'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; - $this->container['is_complete'] = $data['is_complete'] ?? null; - $this->container['is_declined'] = $data['is_declined'] ?? null; - $this->container['has_error'] = $data['has_error'] ?? null; - $this->container['files_url'] = $data['files_url'] ?? null; - $this->container['signing_url'] = $data['signing_url'] ?? null; - $this->container['details_url'] = $data['details_url'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['final_copy_uri'] = $data['final_copy_uri'] ?? null; - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['response_data'] = $data['response_data'] ?? null; - $this->container['signatures'] = $data['signatures'] ?? null; - $this->container['bulk_send_job_id'] = $data['bulk_send_job_id'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('signature_request_id', $data ?? [], null); + $this->setIfExists('requester_email_address', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('original_title', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('is_complete', $data ?? [], null); + $this->setIfExists('is_declined', $data ?? [], null); + $this->setIfExists('has_error', $data ?? [], null); + $this->setIfExists('files_url', $data ?? [], null); + $this->setIfExists('signing_url', $data ?? [], null); + $this->setIfExists('details_url', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('final_copy_uri', $data ?? [], null); + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('response_data', $data ?? [], null); + $this->setIfExists('signatures', $data ?? [], null); + $this->setIfExists('bulk_send_job_id', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): BulkSendJobGetResponseSignatureRequests { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): BulkSendJobGetResponseSignatureRequests { /** @var BulkSendJobGetResponseSignatureRequests $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, BulkSendJobGetResponseSignatureRequests::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -351,9 +447,7 @@ public static function init(array $data): BulkSendJobGetResponseSignatureRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -386,6 +480,16 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + array_push($this->openAPINullablesSetToNull, 'test_mode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('test_mode', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['test_mode'] = $test_mode; return $this; @@ -410,6 +514,9 @@ public function getSignatureRequestId() */ public function setSignatureRequestId(?string $signature_request_id) { + if (is_null($signature_request_id)) { + throw new InvalidArgumentException('non-nullable signature_request_id cannot be null'); + } $this->container['signature_request_id'] = $signature_request_id; return $this; @@ -434,6 +541,9 @@ public function getRequesterEmailAddress() */ public function setRequesterEmailAddress(?string $requester_email_address) { + if (is_null($requester_email_address)) { + throw new InvalidArgumentException('non-nullable requester_email_address cannot be null'); + } $this->container['requester_email_address'] = $requester_email_address; return $this; @@ -458,6 +568,9 @@ public function getTitle() */ public function setTitle(?string $title) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -482,6 +595,9 @@ public function getOriginalTitle() */ public function setOriginalTitle(?string $original_title) { + if (is_null($original_title)) { + throw new InvalidArgumentException('non-nullable original_title cannot be null'); + } $this->container['original_title'] = $original_title; return $this; @@ -506,6 +622,16 @@ public function getSubject() */ public function setSubject(?string $subject) { + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['subject'] = $subject; return $this; @@ -530,6 +656,16 @@ public function getMessage() */ public function setMessage(?string $message) { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['message'] = $message; return $this; @@ -554,6 +690,9 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } $this->container['metadata'] = $metadata; return $this; @@ -578,6 +717,9 @@ public function getCreatedAt() */ public function setCreatedAt(?int $created_at) { + if (is_null($created_at)) { + throw new InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -602,6 +744,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -626,6 +771,9 @@ public function getIsComplete() */ public function setIsComplete(?bool $is_complete) { + if (is_null($is_complete)) { + throw new InvalidArgumentException('non-nullable is_complete cannot be null'); + } $this->container['is_complete'] = $is_complete; return $this; @@ -650,6 +798,9 @@ public function getIsDeclined() */ public function setIsDeclined(?bool $is_declined) { + if (is_null($is_declined)) { + throw new InvalidArgumentException('non-nullable is_declined cannot be null'); + } $this->container['is_declined'] = $is_declined; return $this; @@ -674,6 +825,9 @@ public function getHasError() */ public function setHasError(?bool $has_error) { + if (is_null($has_error)) { + throw new InvalidArgumentException('non-nullable has_error cannot be null'); + } $this->container['has_error'] = $has_error; return $this; @@ -698,6 +852,9 @@ public function getFilesUrl() */ public function setFilesUrl(?string $files_url) { + if (is_null($files_url)) { + throw new InvalidArgumentException('non-nullable files_url cannot be null'); + } $this->container['files_url'] = $files_url; return $this; @@ -722,6 +879,16 @@ public function getSigningUrl() */ public function setSigningUrl(?string $signing_url) { + if (is_null($signing_url)) { + array_push($this->openAPINullablesSetToNull, 'signing_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signing_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signing_url'] = $signing_url; return $this; @@ -746,6 +913,9 @@ public function getDetailsUrl() */ public function setDetailsUrl(?string $details_url) { + if (is_null($details_url)) { + throw new InvalidArgumentException('non-nullable details_url cannot be null'); + } $this->container['details_url'] = $details_url; return $this; @@ -770,6 +940,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -794,6 +967,16 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'signing_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signing_redirect_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -818,6 +1001,16 @@ public function getFinalCopyUri() */ public function setFinalCopyUri(?string $final_copy_uri) { + if (is_null($final_copy_uri)) { + array_push($this->openAPINullablesSetToNull, 'final_copy_uri'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('final_copy_uri', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['final_copy_uri'] = $final_copy_uri; return $this; @@ -842,6 +1035,16 @@ public function getTemplateIds() */ public function setTemplateIds(?array $template_ids) { + if (is_null($template_ids)) { + array_push($this->openAPINullablesSetToNull, 'template_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_ids', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['template_ids'] = $template_ids; return $this; @@ -866,6 +1069,16 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + array_push($this->openAPINullablesSetToNull, 'custom_fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom_fields', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -890,6 +1103,16 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['attachments'] = $attachments; return $this; @@ -914,6 +1137,16 @@ public function getResponseData() */ public function setResponseData(?array $response_data) { + if (is_null($response_data)) { + array_push($this->openAPINullablesSetToNull, 'response_data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('response_data', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['response_data'] = $response_data; return $this; @@ -938,6 +1171,9 @@ public function getSignatures() */ public function setSignatures(?array $signatures) { + if (is_null($signatures)) { + throw new InvalidArgumentException('non-nullable signatures cannot be null'); + } $this->container['signatures'] = $signatures; return $this; @@ -962,6 +1198,9 @@ public function getBulkSendJobId() */ public function setBulkSendJobId(?string $bulk_send_job_id) { + if (is_null($bulk_send_job_id)) { + throw new InvalidArgumentException('non-nullable bulk_send_job_id cannot be null'); + } $this->container['bulk_send_job_id'] = $bulk_send_job_id; return $this; @@ -970,12 +1209,10 @@ public function setBulkSendJobId(?string $bulk_send_job_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -983,7 +1220,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -996,13 +1233,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1014,12 +1249,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1028,8 +1261,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1046,7 +1279,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/BulkSendJobListResponse.php b/sdks/php/src/Model/BulkSendJobListResponse.php index 741473fe8..eaca6d2b9 100644 --- a/sdks/php/src/Model/BulkSendJobListResponse.php +++ b/sdks/php/src/Model/BulkSendJobListResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * BulkSendJobListResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class BulkSendJobListResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class BulkSendJobListResponse implements ModelInterface, ArrayAccess, JsonSerial 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'bulk_send_jobs' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['bulk_send_jobs'] = $data['bulk_send_jobs'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('bulk_send_jobs', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): BulkSendJobListResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): BulkSendJobListResponse { /** @var BulkSendJobListResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, BulkSendJobListResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): BulkSendJobListResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getBulkSendJobs() */ public function setBulkSendJobs(?array $bulk_send_jobs) { + if (is_null($bulk_send_jobs)) { + throw new InvalidArgumentException('non-nullable bulk_send_jobs cannot be null'); + } $this->container['bulk_send_jobs'] = $bulk_send_jobs; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/BulkSendJobResponse.php b/sdks/php/src/Model/BulkSendJobResponse.php index 47c0fb6b2..91f641cb3 100644 --- a/sdks/php/src/Model/BulkSendJobResponse.php +++ b/sdks/php/src/Model/BulkSendJobResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains information about the BulkSendJob such as when it was created and how many signature requests are queued. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class BulkSendJobResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class BulkSendJobResponse implements ModelInterface, ArrayAccess, JsonSerializab 'created_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'bulk_send_job_id' => true, + 'total' => false, + 'is_creator' => false, + 'created_at' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['bulk_send_job_id'] = $data['bulk_send_job_id'] ?? null; - $this->container['total'] = $data['total'] ?? null; - $this->container['is_creator'] = $data['is_creator'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; + $this->setIfExists('bulk_send_job_id', $data ?? [], null); + $this->setIfExists('total', $data ?? [], null); + $this->setIfExists('is_creator', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): BulkSendJobResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): BulkSendJobResponse { /** @var BulkSendJobResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, BulkSendJobResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): BulkSendJobResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,16 @@ public function getBulkSendJobId() */ public function setBulkSendJobId(?string $bulk_send_job_id) { + if (is_null($bulk_send_job_id)) { + array_push($this->openAPINullablesSetToNull, 'bulk_send_job_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bulk_send_job_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['bulk_send_job_id'] = $bulk_send_job_id; return $this; @@ -285,6 +368,9 @@ public function getTotal() */ public function setTotal(?int $total) { + if (is_null($total)) { + throw new InvalidArgumentException('non-nullable total cannot be null'); + } $this->container['total'] = $total; return $this; @@ -309,6 +395,9 @@ public function getIsCreator() */ public function setIsCreator(?bool $is_creator) { + if (is_null($is_creator)) { + throw new InvalidArgumentException('non-nullable is_creator cannot be null'); + } $this->container['is_creator'] = $is_creator; return $this; @@ -333,6 +422,9 @@ public function getCreatedAt() */ public function setCreatedAt(?int $created_at) { + if (is_null($created_at)) { + throw new InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -341,12 +433,10 @@ public function setCreatedAt(?int $created_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -354,7 +444,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -367,13 +457,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -385,12 +473,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -399,8 +485,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -417,7 +503,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/BulkSendJobSendResponse.php b/sdks/php/src/Model/BulkSendJobSendResponse.php index 0f4ef7b63..2f247bb77 100644 --- a/sdks/php/src/Model/BulkSendJobSendResponse.php +++ b/sdks/php/src/Model/BulkSendJobSendResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * BulkSendJobSendResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class BulkSendJobSendResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class BulkSendJobSendResponse implements ModelInterface, ArrayAccess, JsonSerial 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'bulk_send_job' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['bulk_send_job'] = $data['bulk_send_job'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('bulk_send_job', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): BulkSendJobSendResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): BulkSendJobSendResponse { /** @var BulkSendJobSendResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, BulkSendJobSendResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): BulkSendJobSendResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getBulkSendJob() */ public function setBulkSendJob(?BulkSendJobResponse $bulk_send_job) { + if (is_null($bulk_send_job)) { + throw new InvalidArgumentException('non-nullable bulk_send_job cannot be null'); + } $this->container['bulk_send_job'] = $bulk_send_job; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlRequest.php b/sdks/php/src/Model/EmbeddedEditUrlRequest.php index 7fe2004c0..17ba3ba6e 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlRequest.php +++ b/sdks/php/src/Model/EmbeddedEditUrlRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * EmbeddedEditUrlRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class EmbeddedEditUrlRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -92,6 +89,31 @@ class EmbeddedEditUrlRequest implements ModelInterface, ArrayAccess, JsonSeriali 'test_mode' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'allow_edit_ccs' => false, + 'cc_roles' => false, + 'editor_options' => false, + 'force_signer_roles' => false, + 'force_subject_message' => false, + 'merge_fields' => false, + 'preview_only' => false, + 'show_preview' => false, + 'show_progress_stepper' => false, + 'test_mode' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -112,6 +134,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -211,46 +277,62 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['allow_edit_ccs'] = $data['allow_edit_ccs'] ?? false; - $this->container['cc_roles'] = $data['cc_roles'] ?? null; - $this->container['editor_options'] = $data['editor_options'] ?? null; - $this->container['force_signer_roles'] = $data['force_signer_roles'] ?? false; - $this->container['force_subject_message'] = $data['force_subject_message'] ?? false; - $this->container['merge_fields'] = $data['merge_fields'] ?? null; - $this->container['preview_only'] = $data['preview_only'] ?? false; - $this->container['show_preview'] = $data['show_preview'] ?? false; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['test_mode'] = $data['test_mode'] ?? false; + $this->setIfExists('allow_edit_ccs', $data ?? [], false); + $this->setIfExists('cc_roles', $data ?? [], null); + $this->setIfExists('editor_options', $data ?? [], null); + $this->setIfExists('force_signer_roles', $data ?? [], false); + $this->setIfExists('force_subject_message', $data ?? [], false); + $this->setIfExists('merge_fields', $data ?? [], null); + $this->setIfExists('preview_only', $data ?? [], false); + $this->setIfExists('show_preview', $data ?? [], false); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('test_mode', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EmbeddedEditUrlRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EmbeddedEditUrlRequest { /** @var EmbeddedEditUrlRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EmbeddedEditUrlRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -260,9 +342,7 @@ public static function init(array $data): EmbeddedEditUrlRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -295,6 +375,9 @@ public function getAllowEditCcs() */ public function setAllowEditCcs(?bool $allow_edit_ccs) { + if (is_null($allow_edit_ccs)) { + throw new InvalidArgumentException('non-nullable allow_edit_ccs cannot be null'); + } $this->container['allow_edit_ccs'] = $allow_edit_ccs; return $this; @@ -319,6 +402,9 @@ public function getCcRoles() */ public function setCcRoles(?array $cc_roles) { + if (is_null($cc_roles)) { + throw new InvalidArgumentException('non-nullable cc_roles cannot be null'); + } $this->container['cc_roles'] = $cc_roles; return $this; @@ -343,6 +429,9 @@ public function getEditorOptions() */ public function setEditorOptions(?SubEditorOptions $editor_options) { + if (is_null($editor_options)) { + throw new InvalidArgumentException('non-nullable editor_options cannot be null'); + } $this->container['editor_options'] = $editor_options; return $this; @@ -367,6 +456,9 @@ public function getForceSignerRoles() */ public function setForceSignerRoles(?bool $force_signer_roles) { + if (is_null($force_signer_roles)) { + throw new InvalidArgumentException('non-nullable force_signer_roles cannot be null'); + } $this->container['force_signer_roles'] = $force_signer_roles; return $this; @@ -391,6 +483,9 @@ public function getForceSubjectMessage() */ public function setForceSubjectMessage(?bool $force_subject_message) { + if (is_null($force_subject_message)) { + throw new InvalidArgumentException('non-nullable force_subject_message cannot be null'); + } $this->container['force_subject_message'] = $force_subject_message; return $this; @@ -415,6 +510,9 @@ public function getMergeFields() */ public function setMergeFields(?array $merge_fields) { + if (is_null($merge_fields)) { + throw new InvalidArgumentException('non-nullable merge_fields cannot be null'); + } $this->container['merge_fields'] = $merge_fields; return $this; @@ -439,6 +537,9 @@ public function getPreviewOnly() */ public function setPreviewOnly(?bool $preview_only) { + if (is_null($preview_only)) { + throw new InvalidArgumentException('non-nullable preview_only cannot be null'); + } $this->container['preview_only'] = $preview_only; return $this; @@ -463,6 +564,9 @@ public function getShowPreview() */ public function setShowPreview(?bool $show_preview) { + if (is_null($show_preview)) { + throw new InvalidArgumentException('non-nullable show_preview cannot be null'); + } $this->container['show_preview'] = $show_preview; return $this; @@ -487,6 +591,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -511,6 +618,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -519,12 +629,10 @@ public function setTestMode(?bool $test_mode) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -532,7 +640,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -545,13 +653,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -563,12 +669,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -577,8 +681,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -595,7 +699,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponse.php b/sdks/php/src/Model/EmbeddedEditUrlResponse.php index 79535fda8..049524722 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * EmbeddedEditUrlResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class EmbeddedEditUrlResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class EmbeddedEditUrlResponse implements ModelInterface, ArrayAccess, JsonSerial 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'embedded' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['embedded'] = $data['embedded'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('embedded', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EmbeddedEditUrlResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EmbeddedEditUrlResponse { /** @var EmbeddedEditUrlResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EmbeddedEditUrlResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): EmbeddedEditUrlResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getEmbedded() */ public function setEmbedded(?EmbeddedEditUrlResponseEmbedded $embedded) { + if (is_null($embedded)) { + throw new InvalidArgumentException('non-nullable embedded cannot be null'); + } $this->container['embedded'] = $embedded; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php index b568090ab..e8167c00c 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An embedded template object. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class EmbeddedEditUrlResponseEmbedded implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class EmbeddedEditUrlResponseEmbedded implements ModelInterface, ArrayAccess, Js 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'edit_url' => false, + 'expires_at' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['edit_url'] = $data['edit_url'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; + $this->setIfExists('edit_url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EmbeddedEditUrlResponseEmbedded { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EmbeddedEditUrlResponseEmbedded { /** @var EmbeddedEditUrlResponseEmbedded $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EmbeddedEditUrlResponseEmbedded::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): EmbeddedEditUrlResponseEmbedded */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getEditUrl() */ public function setEditUrl(?string $edit_url) { + if (is_null($edit_url)) { + throw new InvalidArgumentException('non-nullable edit_url cannot be null'); + } $this->container['edit_url'] = $edit_url; return $this; @@ -273,6 +347,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -281,12 +358,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponse.php b/sdks/php/src/Model/EmbeddedSignUrlResponse.php index 8cf8ebb71..137d58749 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * EmbeddedSignUrlResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class EmbeddedSignUrlResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class EmbeddedSignUrlResponse implements ModelInterface, ArrayAccess, JsonSerial 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'embedded' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['embedded'] = $data['embedded'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('embedded', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EmbeddedSignUrlResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EmbeddedSignUrlResponse { /** @var EmbeddedSignUrlResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EmbeddedSignUrlResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): EmbeddedSignUrlResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getEmbedded() */ public function setEmbedded(?EmbeddedSignUrlResponseEmbedded $embedded) { + if (is_null($embedded)) { + throw new InvalidArgumentException('non-nullable embedded cannot be null'); + } $this->container['embedded'] = $embedded; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php index b33b67d36..7a6629889 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An object that contains necessary information to set up embedded signing. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class EmbeddedSignUrlResponseEmbedded implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class EmbeddedSignUrlResponseEmbedded implements ModelInterface, ArrayAccess, Js 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'sign_url' => false, + 'expires_at' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['sign_url'] = $data['sign_url'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; + $this->setIfExists('sign_url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EmbeddedSignUrlResponseEmbedded { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EmbeddedSignUrlResponseEmbedded { /** @var EmbeddedSignUrlResponseEmbedded $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EmbeddedSignUrlResponseEmbedded::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): EmbeddedSignUrlResponseEmbedded */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getSignUrl() */ public function setSignUrl(?string $sign_url) { + if (is_null($sign_url)) { + throw new InvalidArgumentException('non-nullable sign_url cannot be null'); + } $this->container['sign_url'] = $sign_url; return $this; @@ -273,6 +347,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -281,12 +358,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ErrorResponse.php b/sdks/php/src/Model/ErrorResponse.php index 4770b26d2..620b51c2b 100644 --- a/sdks/php/src/Model/ErrorResponse.php +++ b/sdks/php/src/Model/ErrorResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * ErrorResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class ErrorResponse implements ModelInterface, ArrayAccess, JsonSerializable 'error' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'error' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['error'] = $data['error'] ?? null; + $this->setIfExists('error', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ErrorResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ErrorResponse { /** @var ErrorResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ErrorResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -211,7 +284,6 @@ public function listInvalidProperties() if ($this->container['error'] === null) { $invalidProperties[] = "'error' can't be null"; } - return $invalidProperties; } @@ -245,6 +317,9 @@ public function getError() */ public function setError(ErrorResponseError $error) { + if (is_null($error)) { + throw new InvalidArgumentException('non-nullable error cannot be null'); + } $this->container['error'] = $error; return $this; @@ -253,12 +328,10 @@ public function setError(ErrorResponseError $error) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -266,7 +339,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -279,13 +352,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -297,12 +368,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -311,8 +380,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -329,7 +398,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ErrorResponseError.php b/sdks/php/src/Model/ErrorResponseError.php index 30c5eb346..c14e875d4 100644 --- a/sdks/php/src/Model/ErrorResponseError.php +++ b/sdks/php/src/Model/ErrorResponseError.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,11 +38,8 @@ * * @category Class * @description Contains information about an error that occurred. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ErrorResponseError implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +76,24 @@ class ErrorResponseError implements ModelInterface, ArrayAccess, JsonSerializabl 'error_path' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'error_msg' => false, + 'error_name' => false, + 'error_path' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +114,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +236,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['error_msg'] = $data['error_msg'] ?? null; - $this->container['error_name'] = $data['error_name'] ?? null; - $this->container['error_path'] = $data['error_path'] ?? null; + $this->setIfExists('error_msg', $data ?? [], null); + $this->setIfExists('error_name', $data ?? [], null); + $this->setIfExists('error_path', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ErrorResponseError { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ErrorResponseError { /** @var ErrorResponseError $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ErrorResponseError::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -227,7 +302,6 @@ public function listInvalidProperties() if ($this->container['error_name'] === null) { $invalidProperties[] = "'error_name' can't be null"; } - return $invalidProperties; } @@ -261,6 +335,9 @@ public function getErrorMsg() */ public function setErrorMsg(string $error_msg) { + if (is_null($error_msg)) { + throw new InvalidArgumentException('non-nullable error_msg cannot be null'); + } $this->container['error_msg'] = $error_msg; return $this; @@ -285,6 +362,9 @@ public function getErrorName() */ public function setErrorName(string $error_name) { + if (is_null($error_name)) { + throw new InvalidArgumentException('non-nullable error_name cannot be null'); + } $this->container['error_name'] = $error_name; return $this; @@ -309,6 +389,9 @@ public function getErrorPath() */ public function setErrorPath(?string $error_path) { + if (is_null($error_path)) { + throw new InvalidArgumentException('non-nullable error_path cannot be null'); + } $this->container['error_path'] = $error_path; return $this; @@ -317,12 +400,10 @@ public function setErrorPath(?string $error_path) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -330,7 +411,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -343,13 +424,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -361,12 +440,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -375,8 +452,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -393,7 +470,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EventCallbackRequest.php b/sdks/php/src/Model/EventCallbackRequest.php index 10819f45f..4e7155152 100644 --- a/sdks/php/src/Model/EventCallbackRequest.php +++ b/sdks/php/src/Model/EventCallbackRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * EventCallbackRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class EventCallbackRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -80,6 +77,25 @@ class EventCallbackRequest implements ModelInterface, ArrayAccess, JsonSerializa 'template' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'event' => false, + 'account' => false, + 'signature_request' => false, + 'template' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -100,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -181,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['event'] = $data['event'] ?? null; - $this->container['account'] = $data['account'] ?? null; - $this->container['signature_request'] = $data['signature_request'] ?? null; - $this->container['template'] = $data['template'] ?? null; + $this->setIfExists('event', $data ?? [], null); + $this->setIfExists('account', $data ?? [], null); + $this->setIfExists('signature_request', $data ?? [], null); + $this->setIfExists('template', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EventCallbackRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EventCallbackRequest { /** @var EventCallbackRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EventCallbackRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +305,6 @@ public function listInvalidProperties() if ($this->container['event'] === null) { $invalidProperties[] = "'event' can't be null"; } - return $invalidProperties; } @@ -263,6 +338,9 @@ public function getEvent() */ public function setEvent(EventCallbackRequestEvent $event) { + if (is_null($event)) { + throw new InvalidArgumentException('non-nullable event cannot be null'); + } $this->container['event'] = $event; return $this; @@ -287,6 +365,9 @@ public function getAccount() */ public function setAccount(?AccountResponse $account) { + if (is_null($account)) { + throw new InvalidArgumentException('non-nullable account cannot be null'); + } $this->container['account'] = $account; return $this; @@ -311,6 +392,9 @@ public function getSignatureRequest() */ public function setSignatureRequest(?SignatureRequestResponse $signature_request) { + if (is_null($signature_request)) { + throw new InvalidArgumentException('non-nullable signature_request cannot be null'); + } $this->container['signature_request'] = $signature_request; return $this; @@ -335,6 +419,9 @@ public function getTemplate() */ public function setTemplate(?TemplateResponse $template) { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -343,12 +430,10 @@ public function setTemplate(?TemplateResponse $template) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -356,7 +441,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -369,13 +454,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -387,12 +470,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -401,8 +482,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -419,7 +500,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EventCallbackRequestEvent.php b/sdks/php/src/Model/EventCallbackRequestEvent.php index 0b1ba4d3d..f980761cc 100644 --- a/sdks/php/src/Model/EventCallbackRequestEvent.php +++ b/sdks/php/src/Model/EventCallbackRequestEvent.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * * @category Class * @description Basic information about the event that occurred. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class EventCallbackRequestEvent implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class EventCallbackRequestEvent implements ModelInterface, ArrayAccess, JsonSeri 'event_metadata' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'event_time' => false, + 'event_type' => false, + 'event_hash' => false, + 'event_metadata' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -241,40 +300,56 @@ public function getEventTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['event_time'] = $data['event_time'] ?? null; - $this->container['event_type'] = $data['event_type'] ?? null; - $this->container['event_hash'] = $data['event_hash'] ?? null; - $this->container['event_metadata'] = $data['event_metadata'] ?? null; + $this->setIfExists('event_time', $data ?? [], null); + $this->setIfExists('event_type', $data ?? [], null); + $this->setIfExists('event_hash', $data ?? [], null); + $this->setIfExists('event_metadata', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EventCallbackRequestEvent { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EventCallbackRequestEvent { /** @var EventCallbackRequestEvent $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EventCallbackRequestEvent::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,7 +379,6 @@ public function listInvalidProperties() if ($this->container['event_hash'] === null) { $invalidProperties[] = "'event_hash' can't be null"; } - return $invalidProperties; } @@ -338,6 +412,9 @@ public function getEventTime() */ public function setEventTime(string $event_time) { + if (is_null($event_time)) { + throw new InvalidArgumentException('non-nullable event_time cannot be null'); + } $this->container['event_time'] = $event_time; return $this; @@ -362,6 +439,9 @@ public function getEventType() */ public function setEventType(string $event_type) { + if (is_null($event_type)) { + throw new InvalidArgumentException('non-nullable event_type cannot be null'); + } $allowedValues = $this->getEventTypeAllowableValues(); if (!in_array($event_type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -396,6 +476,9 @@ public function getEventHash() */ public function setEventHash(string $event_hash) { + if (is_null($event_hash)) { + throw new InvalidArgumentException('non-nullable event_hash cannot be null'); + } $this->container['event_hash'] = $event_hash; return $this; @@ -420,6 +503,9 @@ public function getEventMetadata() */ public function setEventMetadata(?EventCallbackRequestEventMetadata $event_metadata) { + if (is_null($event_metadata)) { + throw new InvalidArgumentException('non-nullable event_metadata cannot be null'); + } $this->container['event_metadata'] = $event_metadata; return $this; @@ -428,12 +514,10 @@ public function setEventMetadata(?EventCallbackRequestEventMetadata $event_metad /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -441,7 +525,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -454,13 +538,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -472,12 +554,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -486,8 +566,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -504,7 +584,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php index d2b207b08..d95efdd0a 100644 --- a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php +++ b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * * @category Class * @description Specific metadata about the event. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class EventCallbackRequestEventMetadata implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class EventCallbackRequestEventMetadata implements ModelInterface, ArrayAccess, 'event_message' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'related_signature_id' => true, + 'reported_for_account_id' => true, + 'reported_for_app_id' => true, + 'event_message' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -182,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['related_signature_id'] = $data['related_signature_id'] ?? null; - $this->container['reported_for_account_id'] = $data['reported_for_account_id'] ?? null; - $this->container['reported_for_app_id'] = $data['reported_for_app_id'] ?? null; - $this->container['event_message'] = $data['event_message'] ?? null; + $this->setIfExists('related_signature_id', $data ?? [], null); + $this->setIfExists('reported_for_account_id', $data ?? [], null); + $this->setIfExists('reported_for_app_id', $data ?? [], null); + $this->setIfExists('event_message', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): EventCallbackRequestEventMetadata { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): EventCallbackRequestEventMetadata { /** @var EventCallbackRequestEventMetadata $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, EventCallbackRequestEventMetadata::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -225,9 +300,7 @@ public static function init(array $data): EventCallbackRequestEventMetadata */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -260,6 +333,16 @@ public function getRelatedSignatureId() */ public function setRelatedSignatureId(?string $related_signature_id) { + if (is_null($related_signature_id)) { + array_push($this->openAPINullablesSetToNull, 'related_signature_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('related_signature_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['related_signature_id'] = $related_signature_id; return $this; @@ -284,6 +367,16 @@ public function getReportedForAccountId() */ public function setReportedForAccountId(?string $reported_for_account_id) { + if (is_null($reported_for_account_id)) { + array_push($this->openAPINullablesSetToNull, 'reported_for_account_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reported_for_account_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['reported_for_account_id'] = $reported_for_account_id; return $this; @@ -308,6 +401,16 @@ public function getReportedForAppId() */ public function setReportedForAppId(?string $reported_for_app_id) { + if (is_null($reported_for_app_id)) { + array_push($this->openAPINullablesSetToNull, 'reported_for_app_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reported_for_app_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['reported_for_app_id'] = $reported_for_app_id; return $this; @@ -332,6 +435,16 @@ public function getEventMessage() */ public function setEventMessage(?string $event_message) { + if (is_null($event_message)) { + array_push($this->openAPINullablesSetToNull, 'event_message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('event_message', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['event_message'] = $event_message; return $this; @@ -340,12 +453,10 @@ public function setEventMessage(?string $event_message) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -353,7 +464,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -366,13 +477,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -384,12 +493,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -398,8 +505,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -416,7 +523,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/FileResponse.php b/sdks/php/src/Model/FileResponse.php index 62c76b97e..670289fe1 100644 --- a/sdks/php/src/Model/FileResponse.php +++ b/sdks/php/src/Model/FileResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FileResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FileResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class FileResponse implements ModelInterface, ArrayAccess, JsonSerializable 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'file_url' => false, + 'expires_at' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['file_url'] = $data['file_url'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; + $this->setIfExists('file_url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FileResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FileResponse { /** @var FileResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, FileResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): FileResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getFileUrl() */ public function setFileUrl(?string $file_url) { + if (is_null($file_url)) { + throw new InvalidArgumentException('non-nullable file_url cannot be null'); + } $this->container['file_url'] = $file_url; return $this; @@ -272,6 +346,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -280,12 +357,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/FileResponseDataUri.php b/sdks/php/src/Model/FileResponseDataUri.php index 1ff596a9a..581641db0 100644 --- a/sdks/php/src/Model/FileResponseDataUri.php +++ b/sdks/php/src/Model/FileResponseDataUri.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FileResponseDataUri Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FileResponseDataUri implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +71,22 @@ class FileResponseDataUri implements ModelInterface, ArrayAccess, JsonSerializab 'data_uri' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'data_uri' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['data_uri'] = $data['data_uri'] ?? null; + $this->setIfExists('data_uri', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FileResponseDataUri { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FileResponseDataUri { /** @var FileResponseDataUri $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, FileResponseDataUri::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -207,9 +279,7 @@ public static function init(array $data): FileResponseDataUri */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +312,9 @@ public function getDataUri() */ public function setDataUri(?string $data_uri) { + if (is_null($data_uri)) { + throw new InvalidArgumentException('non-nullable data_uri cannot be null'); + } $this->container['data_uri'] = $data_uri; return $this; @@ -250,12 +323,10 @@ public function setDataUri(?string $data_uri) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -326,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ListInfoResponse.php b/sdks/php/src/Model/ListInfoResponse.php index 33100c388..4c3595b65 100644 --- a/sdks/php/src/Model/ListInfoResponse.php +++ b/sdks/php/src/Model/ListInfoResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains pagination information about the data returned. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ListInfoResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class ListInfoResponse implements ModelInterface, ArrayAccess, JsonSerializable 'page_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'num_pages' => false, + 'num_results' => true, + 'page' => false, + 'page_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['num_pages'] = $data['num_pages'] ?? null; - $this->container['num_results'] = $data['num_results'] ?? null; - $this->container['page'] = $data['page'] ?? null; - $this->container['page_size'] = $data['page_size'] ?? null; + $this->setIfExists('num_pages', $data ?? [], null); + $this->setIfExists('num_results', $data ?? [], null); + $this->setIfExists('page', $data ?? [], null); + $this->setIfExists('page_size', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ListInfoResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ListInfoResponse { /** @var ListInfoResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ListInfoResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): ListInfoResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,9 @@ public function getNumPages() */ public function setNumPages(?int $num_pages) { + if (is_null($num_pages)) { + throw new InvalidArgumentException('non-nullable num_pages cannot be null'); + } $this->container['num_pages'] = $num_pages; return $this; @@ -285,6 +361,16 @@ public function getNumResults() */ public function setNumResults(?int $num_results) { + if (is_null($num_results)) { + array_push($this->openAPINullablesSetToNull, 'num_results'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('num_results', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['num_results'] = $num_results; return $this; @@ -309,6 +395,9 @@ public function getPage() */ public function setPage(?int $page) { + if (is_null($page)) { + throw new InvalidArgumentException('non-nullable page cannot be null'); + } $this->container['page'] = $page; return $this; @@ -333,6 +422,9 @@ public function getPageSize() */ public function setPageSize(?int $page_size) { + if (is_null($page_size)) { + throw new InvalidArgumentException('non-nullable page_size cannot be null'); + } $this->container['page_size'] = $page_size; return $this; @@ -341,12 +433,10 @@ public function setPageSize(?int $page_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -354,7 +444,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -367,13 +457,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -385,12 +473,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -399,8 +485,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -417,7 +503,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ModelInterface.php b/sdks/php/src/Model/ModelInterface.php index c26c5c647..493a0acf7 100644 --- a/sdks/php/src/Model/ModelInterface.php +++ b/sdks/php/src/Model/ModelInterface.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,8 +29,6 @@ /** * Interface abstracting model access. - * - * @author OpenAPI Generator team */ interface ModelInterface { @@ -91,4 +88,14 @@ public function listInvalidProperties(); * @return bool */ public function valid(); + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool; + + /** + * Checks if a nullable property is set to null. + */ + public function isNullableSetToNull(string $property): bool; } diff --git a/sdks/php/src/Model/OAuthTokenGenerateRequest.php b/sdks/php/src/Model/OAuthTokenGenerateRequest.php index 3c23513e9..f6ade509a 100644 --- a/sdks/php/src/Model/OAuthTokenGenerateRequest.php +++ b/sdks/php/src/Model/OAuthTokenGenerateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * OAuthTokenGenerateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class OAuthTokenGenerateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +79,26 @@ class OAuthTokenGenerateRequest implements ModelInterface, ArrayAccess, JsonSeri 'state' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'client_secret' => false, + 'code' => false, + 'grant_type' => false, + 'state' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +119,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -186,41 +247,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['client_secret'] = $data['client_secret'] ?? null; - $this->container['code'] = $data['code'] ?? null; - $this->container['grant_type'] = $data['grant_type'] ?? 'authorization_code'; - $this->container['state'] = $data['state'] ?? null; + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('client_secret', $data ?? [], null); + $this->setIfExists('code', $data ?? [], null); + $this->setIfExists('grant_type', $data ?? [], 'authorization_code'); + $this->setIfExists('state', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): OAuthTokenGenerateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): OAuthTokenGenerateRequest { /** @var OAuthTokenGenerateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, OAuthTokenGenerateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +324,6 @@ public function listInvalidProperties() if ($this->container['state'] === null) { $invalidProperties[] = "'state' can't be null"; } - return $invalidProperties; } @@ -281,6 +357,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -305,6 +384,9 @@ public function getClientSecret() */ public function setClientSecret(string $client_secret) { + if (is_null($client_secret)) { + throw new InvalidArgumentException('non-nullable client_secret cannot be null'); + } $this->container['client_secret'] = $client_secret; return $this; @@ -329,6 +411,9 @@ public function getCode() */ public function setCode(string $code) { + if (is_null($code)) { + throw new InvalidArgumentException('non-nullable code cannot be null'); + } $this->container['code'] = $code; return $this; @@ -353,6 +438,9 @@ public function getGrantType() */ public function setGrantType(string $grant_type) { + if (is_null($grant_type)) { + throw new InvalidArgumentException('non-nullable grant_type cannot be null'); + } $this->container['grant_type'] = $grant_type; return $this; @@ -377,6 +465,9 @@ public function getState() */ public function setState(string $state) { + if (is_null($state)) { + throw new InvalidArgumentException('non-nullable state cannot be null'); + } $this->container['state'] = $state; return $this; @@ -385,12 +476,10 @@ public function setState(string $state) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -398,7 +487,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -411,13 +500,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -429,12 +516,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -443,8 +528,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -461,7 +546,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/OAuthTokenRefreshRequest.php b/sdks/php/src/Model/OAuthTokenRefreshRequest.php index 5bd36eb93..3b4b3dc58 100644 --- a/sdks/php/src/Model/OAuthTokenRefreshRequest.php +++ b/sdks/php/src/Model/OAuthTokenRefreshRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * OAuthTokenRefreshRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class OAuthTokenRefreshRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class OAuthTokenRefreshRequest implements ModelInterface, ArrayAccess, JsonSeria 'refresh_token' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'grant_type' => false, + 'refresh_token' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['grant_type'] = $data['grant_type'] ?? 'refresh_token'; - $this->container['refresh_token'] = $data['refresh_token'] ?? null; + $this->setIfExists('grant_type', $data ?? [], 'refresh_token'); + $this->setIfExists('refresh_token', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): OAuthTokenRefreshRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): OAuthTokenRefreshRequest { /** @var OAuthTokenRefreshRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, OAuthTokenRefreshRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -220,7 +294,6 @@ public function listInvalidProperties() if ($this->container['refresh_token'] === null) { $invalidProperties[] = "'refresh_token' can't be null"; } - return $invalidProperties; } @@ -254,6 +327,9 @@ public function getGrantType() */ public function setGrantType(string $grant_type) { + if (is_null($grant_type)) { + throw new InvalidArgumentException('non-nullable grant_type cannot be null'); + } $this->container['grant_type'] = $grant_type; return $this; @@ -278,6 +354,9 @@ public function getRefreshToken() */ public function setRefreshToken(string $refresh_token) { + if (is_null($refresh_token)) { + throw new InvalidArgumentException('non-nullable refresh_token cannot be null'); + } $this->container['refresh_token'] = $refresh_token; return $this; @@ -286,12 +365,10 @@ public function setRefreshToken(string $refresh_token) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -299,7 +376,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -312,13 +389,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -330,12 +405,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -344,8 +417,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -362,7 +435,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/OAuthTokenResponse.php b/sdks/php/src/Model/OAuthTokenResponse.php index 791384e4c..41c06bbf8 100644 --- a/sdks/php/src/Model/OAuthTokenResponse.php +++ b/sdks/php/src/Model/OAuthTokenResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * OAuthTokenResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class OAuthTokenResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -83,6 +79,26 @@ class OAuthTokenResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'state' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'access_token' => false, + 'token_type' => false, + 'refresh_token' => false, + 'expires_in' => false, + 'state' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +119,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -187,41 +247,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['access_token'] = $data['access_token'] ?? null; - $this->container['token_type'] = $data['token_type'] ?? null; - $this->container['refresh_token'] = $data['refresh_token'] ?? null; - $this->container['expires_in'] = $data['expires_in'] ?? null; - $this->container['state'] = $data['state'] ?? null; + $this->setIfExists('access_token', $data ?? [], null); + $this->setIfExists('token_type', $data ?? [], null); + $this->setIfExists('refresh_token', $data ?? [], null); + $this->setIfExists('expires_in', $data ?? [], null); + $this->setIfExists('state', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): OAuthTokenResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): OAuthTokenResponse { /** @var OAuthTokenResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, OAuthTokenResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,9 +307,7 @@ public static function init(array $data): OAuthTokenResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -266,6 +340,9 @@ public function getAccessToken() */ public function setAccessToken(?string $access_token) { + if (is_null($access_token)) { + throw new InvalidArgumentException('non-nullable access_token cannot be null'); + } $this->container['access_token'] = $access_token; return $this; @@ -290,6 +367,9 @@ public function getTokenType() */ public function setTokenType(?string $token_type) { + if (is_null($token_type)) { + throw new InvalidArgumentException('non-nullable token_type cannot be null'); + } $this->container['token_type'] = $token_type; return $this; @@ -314,6 +394,9 @@ public function getRefreshToken() */ public function setRefreshToken(?string $refresh_token) { + if (is_null($refresh_token)) { + throw new InvalidArgumentException('non-nullable refresh_token cannot be null'); + } $this->container['refresh_token'] = $refresh_token; return $this; @@ -338,6 +421,9 @@ public function getExpiresIn() */ public function setExpiresIn(?int $expires_in) { + if (is_null($expires_in)) { + throw new InvalidArgumentException('non-nullable expires_in cannot be null'); + } $this->container['expires_in'] = $expires_in; return $this; @@ -362,6 +448,16 @@ public function getState() */ public function setState(?string $state) { + if (is_null($state)) { + array_push($this->openAPINullablesSetToNull, 'state'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('state', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['state'] = $state; return $this; @@ -370,12 +466,10 @@ public function setState(?string $state) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -383,7 +477,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -396,13 +490,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -414,12 +506,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -428,8 +518,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -446,7 +536,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ReportCreateRequest.php b/sdks/php/src/Model/ReportCreateRequest.php index 9d2fbb387..32417157c 100644 --- a/sdks/php/src/Model/ReportCreateRequest.php +++ b/sdks/php/src/Model/ReportCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * ReportCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class ReportCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class ReportCreateRequest implements ModelInterface, ArrayAccess, JsonSerializab 'start_date' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'end_date' => false, + 'report_type' => false, + 'start_date' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -193,39 +251,55 @@ public function getReportTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['end_date'] = $data['end_date'] ?? null; - $this->container['report_type'] = $data['report_type'] ?? null; - $this->container['start_date'] = $data['start_date'] ?? null; + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('report_type', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ReportCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ReportCreateRequest { /** @var ReportCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ReportCreateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -243,18 +317,17 @@ public function listInvalidProperties() if ($this->container['report_type'] === null) { $invalidProperties[] = "'report_type' can't be null"; } - if ((count($this->container['report_type']) > 2)) { + if (count($this->container['report_type']) > 2) { $invalidProperties[] = "invalid value for 'report_type', number of items must be less than or equal to 2."; } - if ((count($this->container['report_type']) < 1)) { + if (count($this->container['report_type']) < 1) { $invalidProperties[] = "invalid value for 'report_type', number of items must be greater than or equal to 1."; } if ($this->container['start_date'] === null) { $invalidProperties[] = "'start_date' can't be null"; } - return $invalidProperties; } @@ -288,6 +361,9 @@ public function getEndDate() */ public function setEndDate(string $end_date) { + if (is_null($end_date)) { + throw new InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -312,6 +388,9 @@ public function getReportType() */ public function setReportType(array $report_type) { + if (is_null($report_type)) { + throw new InvalidArgumentException('non-nullable report_type cannot be null'); + } $allowedValues = $this->getReportTypeAllowableValues(); if (array_diff($report_type, $allowedValues)) { throw new InvalidArgumentException( @@ -322,10 +401,10 @@ public function setReportType(array $report_type) ); } - if ((count($report_type) > 2)) { + if (count($report_type) > 2) { throw new InvalidArgumentException('invalid value for $report_type when calling ReportCreateRequest., number of items must be less than or equal to 2.'); } - if ((count($report_type) < 1)) { + if (count($report_type) < 1) { throw new InvalidArgumentException('invalid length for $report_type when calling ReportCreateRequest., number of items must be greater than or equal to 1.'); } $this->container['report_type'] = $report_type; @@ -352,6 +431,9 @@ public function getStartDate() */ public function setStartDate(string $start_date) { + if (is_null($start_date)) { + throw new InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -360,12 +442,10 @@ public function setStartDate(string $start_date) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -373,7 +453,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -386,13 +466,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -404,12 +482,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -418,8 +494,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -436,7 +512,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ReportCreateResponse.php b/sdks/php/src/Model/ReportCreateResponse.php index 73f63b485..ff3d3493d 100644 --- a/sdks/php/src/Model/ReportCreateResponse.php +++ b/sdks/php/src/Model/ReportCreateResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * ReportCreateResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ReportCreateResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class ReportCreateResponse implements ModelInterface, ArrayAccess, JsonSerializa 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'report' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['report'] = $data['report'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('report', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ReportCreateResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ReportCreateResponse { /** @var ReportCreateResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ReportCreateResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): ReportCreateResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getReport() */ public function setReport(?ReportResponse $report) { + if (is_null($report)) { + throw new InvalidArgumentException('non-nullable report cannot be null'); + } $this->container['report'] = $report; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/ReportResponse.php b/sdks/php/src/Model/ReportResponse.php index 018938b1d..ae63216ec 100644 --- a/sdks/php/src/Model/ReportResponse.php +++ b/sdks/php/src/Model/ReportResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,12 +38,8 @@ * * @category Class * @description Contains information about the report request. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class ReportResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -83,6 +78,25 @@ class ReportResponse implements ModelInterface, ArrayAccess, JsonSerializable 'report_type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'success' => false, + 'start_date' => false, + 'end_date' => false, + 'report_type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +258,56 @@ public function getReportTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['success'] = $data['success'] ?? null; - $this->container['start_date'] = $data['start_date'] ?? null; - $this->container['end_date'] = $data['end_date'] ?? null; - $this->container['report_type'] = $data['report_type'] ?? null; + $this->setIfExists('success', $data ?? [], null); + $this->setIfExists('start_date', $data ?? [], null); + $this->setIfExists('end_date', $data ?? [], null); + $this->setIfExists('report_type', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): ReportResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): ReportResponse { /** @var ReportResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, ReportResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -243,9 +317,7 @@ public static function init(array $data): ReportResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -278,6 +350,9 @@ public function getSuccess() */ public function setSuccess(?string $success) { + if (is_null($success)) { + throw new InvalidArgumentException('non-nullable success cannot be null'); + } $this->container['success'] = $success; return $this; @@ -302,6 +377,9 @@ public function getStartDate() */ public function setStartDate(?string $start_date) { + if (is_null($start_date)) { + throw new InvalidArgumentException('non-nullable start_date cannot be null'); + } $this->container['start_date'] = $start_date; return $this; @@ -326,6 +404,9 @@ public function getEndDate() */ public function setEndDate(?string $end_date) { + if (is_null($end_date)) { + throw new InvalidArgumentException('non-nullable end_date cannot be null'); + } $this->container['end_date'] = $end_date; return $this; @@ -350,8 +431,11 @@ public function getReportType() */ public function setReportType(?array $report_type) { + if (is_null($report_type)) { + throw new InvalidArgumentException('non-nullable report_type cannot be null'); + } $allowedValues = $this->getReportTypeAllowableValues(); - if (!is_null($report_type) && array_diff($report_type, $allowedValues)) { + if (array_diff($report_type, $allowedValues)) { throw new InvalidArgumentException( sprintf( "Invalid value for 'report_type', must be one of '%s'", @@ -367,12 +451,10 @@ public function setReportType(?array $report_type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -380,7 +462,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -393,13 +475,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -411,12 +491,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -425,8 +503,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -443,7 +521,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php index 3be6909ed..ea27ccecb 100644 --- a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * SignatureRequestBulkCreateEmbeddedWithTemplateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestBulkCreateEmbeddedWithTemplateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -100,6 +96,34 @@ class SignatureRequestBulkCreateEmbeddedWithTemplateRequest implements ModelInte 'title' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_ids' => false, + 'client_id' => false, + 'signer_file' => false, + 'signer_list' => false, + 'allow_decline' => false, + 'ccs' => false, + 'custom_fields' => false, + 'message' => false, + 'metadata' => false, + 'signing_redirect_url' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -120,6 +144,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -228,49 +296,65 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['signer_file'] = $data['signer_file'] ?? null; - $this->container['signer_list'] = $data['signer_list'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['ccs'] = $data['ccs'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('signer_file', $data ?? [], null); + $this->setIfExists('signer_list', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('ccs', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestBulkCreateEmbeddedWithTemplateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestBulkCreateEmbeddedWithTemplateRequest { /** @var SignatureRequestBulkCreateEmbeddedWithTemplateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestBulkCreateEmbeddedWithTemplateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -333,6 +417,9 @@ public function getTemplateIds() */ public function setTemplateIds(array $template_ids) { + if (is_null($template_ids)) { + throw new InvalidArgumentException('non-nullable template_ids cannot be null'); + } $this->container['template_ids'] = $template_ids; return $this; @@ -357,6 +444,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -381,6 +471,9 @@ public function getSignerFile() */ public function setSignerFile(?SplFileObject $signer_file) { + if (is_null($signer_file)) { + throw new InvalidArgumentException('non-nullable signer_file cannot be null'); + } $this->container['signer_file'] = $signer_file; return $this; @@ -405,6 +498,9 @@ public function getSignerList() */ public function setSignerList(?array $signer_list) { + if (is_null($signer_list)) { + throw new InvalidArgumentException('non-nullable signer_list cannot be null'); + } $this->container['signer_list'] = $signer_list; return $this; @@ -429,6 +525,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -453,6 +552,9 @@ public function getCcs() */ public function setCcs(?array $ccs) { + if (is_null($ccs)) { + throw new InvalidArgumentException('non-nullable ccs cannot be null'); + } $this->container['ccs'] = $ccs; return $this; @@ -477,6 +579,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -501,7 +606,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestBulkCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 5000.'); } @@ -529,6 +637,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -553,6 +665,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -577,7 +692,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestBulkCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -605,6 +723,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -629,7 +750,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestBulkCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -641,12 +765,10 @@ public function setTitle(?string $title) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -654,7 +776,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -667,13 +789,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -685,12 +805,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -699,8 +817,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -717,7 +835,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php index b90dbac52..6a45f46b3 100644 --- a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * SignatureRequestBulkSendWithTemplateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestBulkSendWithTemplateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -100,6 +96,34 @@ class SignatureRequestBulkSendWithTemplateRequest implements ModelInterface, Arr 'title' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_ids' => false, + 'signer_file' => false, + 'signer_list' => false, + 'allow_decline' => false, + 'ccs' => false, + 'client_id' => false, + 'custom_fields' => false, + 'message' => false, + 'metadata' => false, + 'signing_redirect_url' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -120,6 +144,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -228,49 +296,65 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['signer_file'] = $data['signer_file'] ?? null; - $this->container['signer_list'] = $data['signer_list'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['ccs'] = $data['ccs'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('signer_file', $data ?? [], null); + $this->setIfExists('signer_list', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('ccs', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestBulkSendWithTemplateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestBulkSendWithTemplateRequest { /** @var SignatureRequestBulkSendWithTemplateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestBulkSendWithTemplateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -330,6 +414,9 @@ public function getTemplateIds() */ public function setTemplateIds(array $template_ids) { + if (is_null($template_ids)) { + throw new InvalidArgumentException('non-nullable template_ids cannot be null'); + } $this->container['template_ids'] = $template_ids; return $this; @@ -354,6 +441,9 @@ public function getSignerFile() */ public function setSignerFile(?SplFileObject $signer_file) { + if (is_null($signer_file)) { + throw new InvalidArgumentException('non-nullable signer_file cannot be null'); + } $this->container['signer_file'] = $signer_file; return $this; @@ -378,6 +468,9 @@ public function getSignerList() */ public function setSignerList(?array $signer_list) { + if (is_null($signer_list)) { + throw new InvalidArgumentException('non-nullable signer_list cannot be null'); + } $this->container['signer_list'] = $signer_list; return $this; @@ -402,6 +495,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -426,6 +522,9 @@ public function getCcs() */ public function setCcs(?array $ccs) { + if (is_null($ccs)) { + throw new InvalidArgumentException('non-nullable ccs cannot be null'); + } $this->container['ccs'] = $ccs; return $this; @@ -450,6 +549,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -474,6 +576,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -498,7 +603,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestBulkSendWithTemplateRequest., must be smaller than or equal to 5000.'); } @@ -526,6 +634,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -550,6 +662,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -574,7 +689,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestBulkSendWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -602,6 +720,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -626,7 +747,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestBulkSendWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -638,12 +762,10 @@ public function setTitle(?string $title) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -651,7 +773,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -664,13 +786,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -682,12 +802,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -696,8 +814,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -714,7 +832,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php index 0f7456177..ff864d832 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * SignatureRequestCreateEmbeddedRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestCreateEmbeddedRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -122,6 +118,45 @@ class SignatureRequestCreateEmbeddedRequest implements ModelInterface, ArrayAcce 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'files' => false, + 'file_urls' => false, + 'signers' => false, + 'grouped_signers' => false, + 'allow_decline' => false, + 'allow_reassign' => false, + 'attachments' => false, + 'cc_email_addresses' => false, + 'custom_fields' => false, + 'field_options' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'form_fields_per_document' => false, + 'hide_text_tags' => false, + 'message' => false, + 'metadata' => false, + 'signing_options' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'use_text_tags' => false, + 'populate_auto_fill_fields' => false, + 'expires_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -142,6 +177,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -283,60 +362,76 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['grouped_signers'] = $data['grouped_signers'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['hide_text_tags'] = $data['hide_text_tags'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['use_text_tags'] = $data['use_text_tags'] ?? false; - $this->container['populate_auto_fill_fields'] = $data['populate_auto_fill_fields'] ?? false; - $this->container['expires_at'] = $data['expires_at'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('grouped_signers', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('hide_text_tags', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('use_text_tags', $data ?? [], false); + $this->setIfExists('populate_auto_fill_fields', $data ?? [], false); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestCreateEmbeddedRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestCreateEmbeddedRequest { /** @var SignatureRequestCreateEmbeddedRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestCreateEmbeddedRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -396,6 +491,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -420,6 +518,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -444,6 +545,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -468,6 +572,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -492,6 +599,9 @@ public function getGroupedSigners() */ public function setGroupedSigners(?array $grouped_signers) { + if (is_null($grouped_signers)) { + throw new InvalidArgumentException('non-nullable grouped_signers cannot be null'); + } $this->container['grouped_signers'] = $grouped_signers; return $this; @@ -516,6 +626,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -540,6 +653,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -564,6 +680,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -588,6 +707,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -612,6 +734,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -636,6 +761,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -660,6 +788,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -684,6 +815,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -708,6 +842,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(?array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -732,6 +869,9 @@ public function getHideTextTags() */ public function setHideTextTags(?bool $hide_text_tags) { + if (is_null($hide_text_tags)) { + throw new InvalidArgumentException('non-nullable hide_text_tags cannot be null'); + } $this->container['hide_text_tags'] = $hide_text_tags; return $this; @@ -756,7 +896,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestCreateEmbeddedRequest., must be smaller than or equal to 5000.'); } @@ -784,6 +927,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -808,6 +955,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -832,7 +982,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestCreateEmbeddedRequest., must be smaller than or equal to 255.'); } @@ -860,6 +1013,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -884,7 +1040,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestCreateEmbeddedRequest., must be smaller than or equal to 255.'); } @@ -912,6 +1071,9 @@ public function getUseTextTags() */ public function setUseTextTags(?bool $use_text_tags) { + if (is_null($use_text_tags)) { + throw new InvalidArgumentException('non-nullable use_text_tags cannot be null'); + } $this->container['use_text_tags'] = $use_text_tags; return $this; @@ -936,6 +1098,9 @@ public function getPopulateAutoFillFields() */ public function setPopulateAutoFillFields(?bool $populate_auto_fill_fields) { + if (is_null($populate_auto_fill_fields)) { + throw new InvalidArgumentException('non-nullable populate_auto_fill_fields cannot be null'); + } $this->container['populate_auto_fill_fields'] = $populate_auto_fill_fields; return $this; @@ -960,6 +1125,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -968,12 +1143,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -981,7 +1154,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -994,13 +1167,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1012,12 +1183,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1026,8 +1195,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1044,7 +1213,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php index 5a9d50c4c..d65263ff8 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * SignatureRequestCreateEmbeddedWithTemplateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestCreateEmbeddedWithTemplateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -104,6 +100,36 @@ class SignatureRequestCreateEmbeddedWithTemplateRequest implements ModelInterfac 'populate_auto_fill_fields' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_ids' => false, + 'client_id' => false, + 'signers' => false, + 'allow_decline' => false, + 'ccs' => false, + 'custom_fields' => false, + 'files' => false, + 'file_urls' => false, + 'message' => false, + 'metadata' => false, + 'signing_options' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'populate_auto_fill_fields' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -124,6 +150,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -238,51 +308,67 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['ccs'] = $data['ccs'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['populate_auto_fill_fields'] = $data['populate_auto_fill_fields'] ?? false; - } - - /** @deprecated use ::init() */ + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('ccs', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('populate_auto_fill_fields', $data ?? [], false); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestCreateEmbeddedWithTemplateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestCreateEmbeddedWithTemplateRequest { /** @var SignatureRequestCreateEmbeddedWithTemplateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestCreateEmbeddedWithTemplateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -348,6 +434,9 @@ public function getTemplateIds() */ public function setTemplateIds(array $template_ids) { + if (is_null($template_ids)) { + throw new InvalidArgumentException('non-nullable template_ids cannot be null'); + } $this->container['template_ids'] = $template_ids; return $this; @@ -372,6 +461,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -396,6 +488,9 @@ public function getSigners() */ public function setSigners(array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -420,6 +515,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -444,6 +542,9 @@ public function getCcs() */ public function setCcs(?array $ccs) { + if (is_null($ccs)) { + throw new InvalidArgumentException('non-nullable ccs cannot be null'); + } $this->container['ccs'] = $ccs; return $this; @@ -468,6 +569,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -492,6 +596,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -516,6 +623,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -540,7 +650,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 5000.'); } @@ -568,6 +681,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -592,6 +709,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -616,7 +736,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -644,6 +767,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -668,7 +794,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -696,6 +825,9 @@ public function getPopulateAutoFillFields() */ public function setPopulateAutoFillFields(?bool $populate_auto_fill_fields) { + if (is_null($populate_auto_fill_fields)) { + throw new InvalidArgumentException('non-nullable populate_auto_fill_fields cannot be null'); + } $this->container['populate_auto_fill_fields'] = $populate_auto_fill_fields; return $this; @@ -704,12 +836,10 @@ public function setPopulateAutoFillFields(?bool $populate_auto_fill_fields) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -717,7 +847,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -730,13 +860,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -748,12 +876,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -762,8 +888,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -780,7 +906,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestGetResponse.php b/sdks/php/src/Model/SignatureRequestGetResponse.php index 607e3b2bb..135ab3346 100644 --- a/sdks/php/src/Model/SignatureRequestGetResponse.php +++ b/sdks/php/src/Model/SignatureRequestGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * SignatureRequestGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SignatureRequestGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class SignatureRequestGetResponse implements ModelInterface, ArrayAccess, JsonSe 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'signature_request' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['signature_request'] = $data['signature_request'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('signature_request', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestGetResponse { /** @var SignatureRequestGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestGetResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): SignatureRequestGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getSignatureRequest() */ public function setSignatureRequest(?SignatureRequestResponse $signature_request) { + if (is_null($signature_request)) { + throw new InvalidArgumentException('non-nullable signature_request cannot be null'); + } $this->container['signature_request'] = $signature_request; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestListResponse.php b/sdks/php/src/Model/SignatureRequestListResponse.php index 0152544e9..b7f8236b5 100644 --- a/sdks/php/src/Model/SignatureRequestListResponse.php +++ b/sdks/php/src/Model/SignatureRequestListResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * SignatureRequestListResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SignatureRequestListResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class SignatureRequestListResponse implements ModelInterface, ArrayAccess, JsonS 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'signature_requests' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['signature_requests'] = $data['signature_requests'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('signature_requests', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestListResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestListResponse { /** @var SignatureRequestListResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestListResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): SignatureRequestListResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getSignatureRequests() */ public function setSignatureRequests(?array $signature_requests) { + if (is_null($signature_requests)) { + throw new InvalidArgumentException('non-nullable signature_requests cannot be null'); + } $this->container['signature_requests'] = $signature_requests; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestRemindRequest.php b/sdks/php/src/Model/SignatureRequestRemindRequest.php index 3ebd94f21..6e8b2787b 100644 --- a/sdks/php/src/Model/SignatureRequestRemindRequest.php +++ b/sdks/php/src/Model/SignatureRequestRemindRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SignatureRequestRemindRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestRemindRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class SignatureRequestRemindRequest implements ModelInterface, ArrayAccess, Json 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestRemindRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestRemindRequest { /** @var SignatureRequestRemindRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestRemindRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -217,7 +291,6 @@ public function listInvalidProperties() if ($this->container['email_address'] === null) { $invalidProperties[] = "'email_address' can't be null"; } - return $invalidProperties; } @@ -251,6 +324,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -275,6 +351,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -283,12 +362,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -296,7 +373,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -309,13 +386,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -327,12 +402,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -341,8 +414,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -359,7 +432,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponse.php b/sdks/php/src/Model/SignatureRequestResponse.php index 9a49a3cc3..d54e61196 100644 --- a/sdks/php/src/Model/SignatureRequestResponse.php +++ b/sdks/php/src/Model/SignatureRequestResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains information about a signature request. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SignatureRequestResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -124,6 +120,46 @@ class SignatureRequestResponse implements ModelInterface, ArrayAccess, JsonSeria 'bulk_send_job_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'test_mode' => true, + 'signature_request_id' => false, + 'requester_email_address' => false, + 'title' => false, + 'original_title' => false, + 'subject' => true, + 'message' => true, + 'metadata' => false, + 'created_at' => false, + 'expires_at' => false, + 'is_complete' => false, + 'is_declined' => false, + 'has_error' => false, + 'files_url' => false, + 'signing_url' => true, + 'details_url' => false, + 'cc_email_addresses' => false, + 'signing_redirect_url' => true, + 'final_copy_uri' => true, + 'template_ids' => true, + 'custom_fields' => true, + 'attachments' => true, + 'response_data' => true, + 'signatures' => false, + 'bulk_send_job_id' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -144,6 +180,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -288,61 +368,77 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['signature_request_id'] = $data['signature_request_id'] ?? null; - $this->container['requester_email_address'] = $data['requester_email_address'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['original_title'] = $data['original_title'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; - $this->container['is_complete'] = $data['is_complete'] ?? null; - $this->container['is_declined'] = $data['is_declined'] ?? null; - $this->container['has_error'] = $data['has_error'] ?? null; - $this->container['files_url'] = $data['files_url'] ?? null; - $this->container['signing_url'] = $data['signing_url'] ?? null; - $this->container['details_url'] = $data['details_url'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['final_copy_uri'] = $data['final_copy_uri'] ?? null; - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['response_data'] = $data['response_data'] ?? null; - $this->container['signatures'] = $data['signatures'] ?? null; - $this->container['bulk_send_job_id'] = $data['bulk_send_job_id'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('signature_request_id', $data ?? [], null); + $this->setIfExists('requester_email_address', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('original_title', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('is_complete', $data ?? [], null); + $this->setIfExists('is_declined', $data ?? [], null); + $this->setIfExists('has_error', $data ?? [], null); + $this->setIfExists('files_url', $data ?? [], null); + $this->setIfExists('signing_url', $data ?? [], null); + $this->setIfExists('details_url', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('final_copy_uri', $data ?? [], null); + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('response_data', $data ?? [], null); + $this->setIfExists('signatures', $data ?? [], null); + $this->setIfExists('bulk_send_job_id', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponse { /** @var SignatureRequestResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -352,9 +448,7 @@ public static function init(array $data): SignatureRequestResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -387,6 +481,16 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + array_push($this->openAPINullablesSetToNull, 'test_mode'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('test_mode', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['test_mode'] = $test_mode; return $this; @@ -411,6 +515,9 @@ public function getSignatureRequestId() */ public function setSignatureRequestId(?string $signature_request_id) { + if (is_null($signature_request_id)) { + throw new InvalidArgumentException('non-nullable signature_request_id cannot be null'); + } $this->container['signature_request_id'] = $signature_request_id; return $this; @@ -435,6 +542,9 @@ public function getRequesterEmailAddress() */ public function setRequesterEmailAddress(?string $requester_email_address) { + if (is_null($requester_email_address)) { + throw new InvalidArgumentException('non-nullable requester_email_address cannot be null'); + } $this->container['requester_email_address'] = $requester_email_address; return $this; @@ -459,6 +569,9 @@ public function getTitle() */ public function setTitle(?string $title) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -483,6 +596,9 @@ public function getOriginalTitle() */ public function setOriginalTitle(?string $original_title) { + if (is_null($original_title)) { + throw new InvalidArgumentException('non-nullable original_title cannot be null'); + } $this->container['original_title'] = $original_title; return $this; @@ -507,6 +623,16 @@ public function getSubject() */ public function setSubject(?string $subject) { + if (is_null($subject)) { + array_push($this->openAPINullablesSetToNull, 'subject'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('subject', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['subject'] = $subject; return $this; @@ -531,6 +657,16 @@ public function getMessage() */ public function setMessage(?string $message) { + if (is_null($message)) { + array_push($this->openAPINullablesSetToNull, 'message'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('message', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['message'] = $message; return $this; @@ -555,6 +691,9 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } $this->container['metadata'] = $metadata; return $this; @@ -579,6 +718,9 @@ public function getCreatedAt() */ public function setCreatedAt(?int $created_at) { + if (is_null($created_at)) { + throw new InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -603,6 +745,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -627,6 +772,9 @@ public function getIsComplete() */ public function setIsComplete(?bool $is_complete) { + if (is_null($is_complete)) { + throw new InvalidArgumentException('non-nullable is_complete cannot be null'); + } $this->container['is_complete'] = $is_complete; return $this; @@ -651,6 +799,9 @@ public function getIsDeclined() */ public function setIsDeclined(?bool $is_declined) { + if (is_null($is_declined)) { + throw new InvalidArgumentException('non-nullable is_declined cannot be null'); + } $this->container['is_declined'] = $is_declined; return $this; @@ -675,6 +826,9 @@ public function getHasError() */ public function setHasError(?bool $has_error) { + if (is_null($has_error)) { + throw new InvalidArgumentException('non-nullable has_error cannot be null'); + } $this->container['has_error'] = $has_error; return $this; @@ -699,6 +853,9 @@ public function getFilesUrl() */ public function setFilesUrl(?string $files_url) { + if (is_null($files_url)) { + throw new InvalidArgumentException('non-nullable files_url cannot be null'); + } $this->container['files_url'] = $files_url; return $this; @@ -723,6 +880,16 @@ public function getSigningUrl() */ public function setSigningUrl(?string $signing_url) { + if (is_null($signing_url)) { + array_push($this->openAPINullablesSetToNull, 'signing_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signing_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signing_url'] = $signing_url; return $this; @@ -747,6 +914,9 @@ public function getDetailsUrl() */ public function setDetailsUrl(?string $details_url) { + if (is_null($details_url)) { + throw new InvalidArgumentException('non-nullable details_url cannot be null'); + } $this->container['details_url'] = $details_url; return $this; @@ -771,6 +941,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -795,6 +968,16 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'signing_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signing_redirect_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -819,6 +1002,16 @@ public function getFinalCopyUri() */ public function setFinalCopyUri(?string $final_copy_uri) { + if (is_null($final_copy_uri)) { + array_push($this->openAPINullablesSetToNull, 'final_copy_uri'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('final_copy_uri', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['final_copy_uri'] = $final_copy_uri; return $this; @@ -843,6 +1036,16 @@ public function getTemplateIds() */ public function setTemplateIds(?array $template_ids) { + if (is_null($template_ids)) { + array_push($this->openAPINullablesSetToNull, 'template_ids'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('template_ids', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['template_ids'] = $template_ids; return $this; @@ -867,6 +1070,16 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + array_push($this->openAPINullablesSetToNull, 'custom_fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom_fields', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -891,6 +1104,16 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + array_push($this->openAPINullablesSetToNull, 'attachments'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('attachments', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['attachments'] = $attachments; return $this; @@ -915,6 +1138,16 @@ public function getResponseData() */ public function setResponseData(?array $response_data) { + if (is_null($response_data)) { + array_push($this->openAPINullablesSetToNull, 'response_data'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('response_data', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['response_data'] = $response_data; return $this; @@ -939,6 +1172,9 @@ public function getSignatures() */ public function setSignatures(?array $signatures) { + if (is_null($signatures)) { + throw new InvalidArgumentException('non-nullable signatures cannot be null'); + } $this->container['signatures'] = $signatures; return $this; @@ -963,6 +1199,16 @@ public function getBulkSendJobId() */ public function setBulkSendJobId(?string $bulk_send_job_id) { + if (is_null($bulk_send_job_id)) { + array_push($this->openAPINullablesSetToNull, 'bulk_send_job_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('bulk_send_job_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['bulk_send_job_id'] = $bulk_send_job_id; return $this; @@ -971,12 +1217,10 @@ public function setBulkSendJobId(?string $bulk_send_job_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -984,7 +1228,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -997,13 +1241,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1015,12 +1257,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1029,8 +1269,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1047,7 +1287,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseAttachment.php b/sdks/php/src/Model/SignatureRequestResponseAttachment.php index c8d34976d..7ad2e9cc3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseAttachment.php +++ b/sdks/php/src/Model/SignatureRequestResponseAttachment.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Signer attachments. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SignatureRequestResponseAttachment implements ModelInterface, ArrayAccess, JsonSerializable { @@ -86,6 +82,27 @@ class SignatureRequestResponseAttachment implements ModelInterface, ArrayAccess, 'uploaded_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'signer' => false, + 'name' => false, + 'required' => false, + 'instructions' => true, + 'uploaded_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -106,6 +123,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -193,42 +254,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['signer'] = $data['signer'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['instructions'] = $data['instructions'] ?? null; - $this->container['uploaded_at'] = $data['uploaded_at'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('signer', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('instructions', $data ?? [], null); + $this->setIfExists('uploaded_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseAttachment { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseAttachment { /** @var SignatureRequestResponseAttachment $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseAttachment::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -252,7 +329,6 @@ public function listInvalidProperties() if ($this->container['required'] === null) { $invalidProperties[] = "'required' can't be null"; } - return $invalidProperties; } @@ -286,6 +362,9 @@ public function getId() */ public function setId(string $id) { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -310,6 +389,9 @@ public function getSigner() */ public function setSigner(string $signer) { + if (is_null($signer)) { + throw new InvalidArgumentException('non-nullable signer cannot be null'); + } $this->container['signer'] = $signer; return $this; @@ -334,6 +416,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -358,6 +443,9 @@ public function getRequired() */ public function setRequired(bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -382,6 +470,16 @@ public function getInstructions() */ public function setInstructions(?string $instructions) { + if (is_null($instructions)) { + array_push($this->openAPINullablesSetToNull, 'instructions'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('instructions', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['instructions'] = $instructions; return $this; @@ -406,6 +504,16 @@ public function getUploadedAt() */ public function setUploadedAt(?int $uploaded_at) { + if (is_null($uploaded_at)) { + array_push($this->openAPINullablesSetToNull, 'uploaded_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('uploaded_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['uploaded_at'] = $uploaded_at; return $this; @@ -414,12 +522,10 @@ public function setUploadedAt(?int $uploaded_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -427,7 +533,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -440,13 +546,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -458,12 +562,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -472,8 +574,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -490,7 +592,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php index d54d31050..059c123eb 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description An array of Custom Field objects containing the name and type of each custom field. * Text Field uses `SignatureRequestResponseCustomFieldText` * Checkbox Field uses `SignatureRequestResponseCustomFieldCheckbox` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class SignatureRequestResponseCustomFieldBase implements ModelInterface, ArrayAccess, JsonSerializable +class SignatureRequestResponseCustomFieldBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -84,6 +80,26 @@ abstract class SignatureRequestResponseCustomFieldBase implements ModelInterface 'editor' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'name' => false, + 'required' => false, + 'api_id' => false, + 'editor' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -104,6 +120,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -188,23 +248,23 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['editor'] = $data['editor'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('editor', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -226,6 +286,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -241,7 +315,6 @@ public function listInvalidProperties() if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - return $invalidProperties; } @@ -275,6 +348,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -299,6 +375,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -323,6 +402,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -347,6 +429,9 @@ public function getApiId() */ public function setApiId(?string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -371,6 +456,9 @@ public function getEditor() */ public function setEditor(?string $editor) { + if (is_null($editor)) { + throw new InvalidArgumentException('non-nullable editor cannot be null'); + } $this->container['editor'] = $editor; return $this; @@ -379,12 +467,10 @@ public function setEditor(?string $editor) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -392,7 +478,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -405,13 +491,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -423,12 +507,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -437,8 +519,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -455,7 +537,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php index d6b9a0b16..322d68985 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SignatureRequestResponseCustomFieldBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseCustomFieldCheckbox extends SignatureRequestResponseCustomFieldBase { @@ -75,6 +72,23 @@ class SignatureRequestResponseCustomFieldCheckbox extends SignatureRequestRespon 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -170,33 +228,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'checkbox'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseCustomFieldCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseCustomFieldCheckbox { /** @var SignatureRequestResponseCustomFieldCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseCustomFieldCheckbox::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -211,7 +285,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -245,6 +318,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -269,6 +345,9 @@ public function getValue() */ public function setValue(?bool $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -277,12 +356,10 @@ public function setValue(?bool $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -290,7 +367,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -303,13 +380,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -321,12 +396,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -335,8 +408,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -353,7 +426,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php index ac1300a8e..e16a7bed3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SignatureRequestResponseCustomFieldBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseCustomFieldText extends SignatureRequestResponseCustomFieldBase { @@ -75,6 +72,23 @@ class SignatureRequestResponseCustomFieldText extends SignatureRequestResponseCu 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +109,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -170,33 +228,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'text'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseCustomFieldText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseCustomFieldText { /** @var SignatureRequestResponseCustomFieldText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseCustomFieldText::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -211,7 +285,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -245,6 +318,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -269,6 +345,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -277,12 +356,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -290,7 +367,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -303,13 +380,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -321,12 +396,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -335,8 +408,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -353,7 +426,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php index d5a610466..4205be23d 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * SignatureRequestResponseCustomFieldTypeEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class SignatureRequestResponseCustomFieldTypeEnum diff --git a/sdks/php/src/Model/SignatureRequestResponseDataBase.php b/sdks/php/src/Model/SignatureRequestResponseDataBase.php index 5b564fec5..88f24c47a 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description An array of form field objects containing the name, value, and type of each textbox or checkmark field filled in by the signers. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class SignatureRequestResponseDataBase implements ModelInterface, ArrayAccess, JsonSerializable +class SignatureRequestResponseDataBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -84,6 +80,26 @@ abstract class SignatureRequestResponseDataBase implements ModelInterface, Array 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'api_id' => false, + 'signature_id' => false, + 'name' => false, + 'required' => false, + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -104,6 +120,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -188,23 +248,23 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['signature_id'] = $data['signature_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('signature_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -247,6 +307,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -254,9 +328,7 @@ public static function discriminatorClassName(array $data): ?string */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -289,6 +361,9 @@ public function getApiId() */ public function setApiId(?string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -313,6 +388,9 @@ public function getSignatureId() */ public function setSignatureId(?string $signature_id) { + if (is_null($signature_id)) { + throw new InvalidArgumentException('non-nullable signature_id cannot be null'); + } $this->container['signature_id'] = $signature_id; return $this; @@ -337,6 +415,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -361,6 +442,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -385,6 +469,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -393,12 +480,10 @@ public function setType(?string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -406,7 +491,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -419,13 +504,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -437,12 +520,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -451,8 +532,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -469,7 +550,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php b/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php index bb4ea4b1c..d2e30d5f4 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * SignatureRequestResponseDataTypeEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class SignatureRequestResponseDataTypeEnum diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php index 45bf82397..91de390b6 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueCheckbox Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueCheckbox extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueCheckbox extends SignatureRequestResponse 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'checkbox'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueCheckbox { /** @var SignatureRequestResponseDataValueCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueCheckbox::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueCheck */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?bool $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?bool $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php index db8fb4819..8b735d836 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueCheckboxMerge Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueCheckboxMerge extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueCheckboxMerge extends SignatureRequestRes 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox-merge'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'checkbox-merge'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueCheckboxMerge { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueCheckboxMerge { /** @var SignatureRequestResponseDataValueCheckboxMerge $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueCheckboxMerge::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueCheck */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php index 792407548..fa4935362 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueDateSigned Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueDateSigned extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueDateSigned extends SignatureRequestRespon 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'date_signed'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'date_signed'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueDateSigned { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueDateSigned { /** @var SignatureRequestResponseDataValueDateSigned $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueDateSigned::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueDateS */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php index f4ac50109..ea40c2f7f 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueDropdown Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueDropdown extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueDropdown extends SignatureRequestResponse 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'dropdown'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'dropdown'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueDropdown { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueDropdown { /** @var SignatureRequestResponseDataValueDropdown $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueDropdown::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueDropd */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php index 4276a4e78..375b78317 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueInitials Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueInitials extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueInitials extends SignatureRequestResponse 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'initials'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'initials'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueInitials { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueInitials { /** @var SignatureRequestResponseDataValueInitials $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueInitials::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueIniti */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php index 7d502feca..379952458 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueRadio Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueRadio extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueRadio extends SignatureRequestResponseDat 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'radio'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'radio'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueRadio { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueRadio { /** @var SignatureRequestResponseDataValueRadio $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueRadio::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueRadio */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?bool $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?bool $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php index bbdcfb16a..b63e32de3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueSignature Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueSignature extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueSignature extends SignatureRequestRespons 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'signature'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'signature'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueSignature { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueSignature { /** @var SignatureRequestResponseDataValueSignature $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueSignature::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueSigna */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php index d67e26738..b5e7d429f 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueText Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueText extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueText extends SignatureRequestResponseData 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'text'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueText { /** @var SignatureRequestResponseDataValueText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueText::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueText */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php index 4dce57c71..d8a14b627 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,17 +28,15 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** * SignatureRequestResponseDataValueTextMerge Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestResponseDataValueTextMerge extends SignatureRequestResponseDataBase { @@ -74,6 +71,23 @@ class SignatureRequestResponseDataValueTextMerge extends SignatureRequestRespons 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -169,33 +227,49 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text-merge'; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('type', $data ?? [], 'text-merge'); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseDataValueTextMerge { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseDataValueTextMerge { /** @var SignatureRequestResponseDataValueTextMerge $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueTextMerge::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,9 +279,7 @@ public static function init(array $data): SignatureRequestResponseDataValueTextM */ public function listInvalidProperties() { - $invalidProperties = parent::listInvalidProperties(); - - return $invalidProperties; + return parent::listInvalidProperties(); } /** @@ -240,6 +312,9 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -264,6 +339,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -272,12 +350,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -285,7 +361,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -298,13 +374,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -316,12 +390,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -330,8 +402,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -348,7 +420,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseSignatures.php b/sdks/php/src/Model/SignatureRequestResponseSignatures.php index 87fb09f3d..6f0d6406d 100644 --- a/sdks/php/src/Model/SignatureRequestResponseSignatures.php +++ b/sdks/php/src/Model/SignatureRequestResponseSignatures.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An array of signature objects, 1 for each signer. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SignatureRequestResponseSignatures implements ModelInterface, ArrayAccess, JsonSerializable { @@ -112,6 +108,40 @@ class SignatureRequestResponseSignatures implements ModelInterface, ArrayAccess, 'error' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'signature_id' => false, + 'signer_group_guid' => true, + 'signer_email_address' => false, + 'signer_name' => true, + 'signer_role' => true, + 'order' => true, + 'status_code' => false, + 'decline_reason' => true, + 'signed_at' => true, + 'last_viewed_at' => true, + 'last_reminded_at' => true, + 'has_pin' => false, + 'has_sms_auth' => true, + 'has_sms_delivery' => true, + 'sms_phone_number' => true, + 'reassigned_by' => true, + 'reassignment_reason' => true, + 'reassigned_from' => true, + 'error' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -132,6 +162,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,55 +332,71 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['signature_id'] = $data['signature_id'] ?? null; - $this->container['signer_group_guid'] = $data['signer_group_guid'] ?? null; - $this->container['signer_email_address'] = $data['signer_email_address'] ?? null; - $this->container['signer_name'] = $data['signer_name'] ?? null; - $this->container['signer_role'] = $data['signer_role'] ?? null; - $this->container['order'] = $data['order'] ?? null; - $this->container['status_code'] = $data['status_code'] ?? null; - $this->container['decline_reason'] = $data['decline_reason'] ?? null; - $this->container['signed_at'] = $data['signed_at'] ?? null; - $this->container['last_viewed_at'] = $data['last_viewed_at'] ?? null; - $this->container['last_reminded_at'] = $data['last_reminded_at'] ?? null; - $this->container['has_pin'] = $data['has_pin'] ?? null; - $this->container['has_sms_auth'] = $data['has_sms_auth'] ?? null; - $this->container['has_sms_delivery'] = $data['has_sms_delivery'] ?? null; - $this->container['sms_phone_number'] = $data['sms_phone_number'] ?? null; - $this->container['reassigned_by'] = $data['reassigned_by'] ?? null; - $this->container['reassignment_reason'] = $data['reassignment_reason'] ?? null; - $this->container['reassigned_from'] = $data['reassigned_from'] ?? null; - $this->container['error'] = $data['error'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('signature_id', $data ?? [], null); + $this->setIfExists('signer_group_guid', $data ?? [], null); + $this->setIfExists('signer_email_address', $data ?? [], null); + $this->setIfExists('signer_name', $data ?? [], null); + $this->setIfExists('signer_role', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('status_code', $data ?? [], null); + $this->setIfExists('decline_reason', $data ?? [], null); + $this->setIfExists('signed_at', $data ?? [], null); + $this->setIfExists('last_viewed_at', $data ?? [], null); + $this->setIfExists('last_reminded_at', $data ?? [], null); + $this->setIfExists('has_pin', $data ?? [], null); + $this->setIfExists('has_sms_auth', $data ?? [], null); + $this->setIfExists('has_sms_delivery', $data ?? [], null); + $this->setIfExists('sms_phone_number', $data ?? [], null); + $this->setIfExists('reassigned_by', $data ?? [], null); + $this->setIfExists('reassignment_reason', $data ?? [], null); + $this->setIfExists('reassigned_from', $data ?? [], null); + $this->setIfExists('error', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestResponseSignatures { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestResponseSignatures { /** @var SignatureRequestResponseSignatures $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestResponseSignatures::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -316,9 +406,7 @@ public static function init(array $data): SignatureRequestResponseSignatures */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -351,6 +439,9 @@ public function getSignatureId() */ public function setSignatureId(?string $signature_id) { + if (is_null($signature_id)) { + throw new InvalidArgumentException('non-nullable signature_id cannot be null'); + } $this->container['signature_id'] = $signature_id; return $this; @@ -375,6 +466,16 @@ public function getSignerGroupGuid() */ public function setSignerGroupGuid(?string $signer_group_guid) { + if (is_null($signer_group_guid)) { + array_push($this->openAPINullablesSetToNull, 'signer_group_guid'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signer_group_guid', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signer_group_guid'] = $signer_group_guid; return $this; @@ -399,6 +500,9 @@ public function getSignerEmailAddress() */ public function setSignerEmailAddress(?string $signer_email_address) { + if (is_null($signer_email_address)) { + throw new InvalidArgumentException('non-nullable signer_email_address cannot be null'); + } $this->container['signer_email_address'] = $signer_email_address; return $this; @@ -423,6 +527,16 @@ public function getSignerName() */ public function setSignerName(?string $signer_name) { + if (is_null($signer_name)) { + array_push($this->openAPINullablesSetToNull, 'signer_name'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signer_name', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signer_name'] = $signer_name; return $this; @@ -447,6 +561,16 @@ public function getSignerRole() */ public function setSignerRole(?string $signer_role) { + if (is_null($signer_role)) { + array_push($this->openAPINullablesSetToNull, 'signer_role'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signer_role', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signer_role'] = $signer_role; return $this; @@ -471,6 +595,16 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['order'] = $order; return $this; @@ -495,6 +629,9 @@ public function getStatusCode() */ public function setStatusCode(?string $status_code) { + if (is_null($status_code)) { + throw new InvalidArgumentException('non-nullable status_code cannot be null'); + } $this->container['status_code'] = $status_code; return $this; @@ -519,6 +656,16 @@ public function getDeclineReason() */ public function setDeclineReason(?string $decline_reason) { + if (is_null($decline_reason)) { + array_push($this->openAPINullablesSetToNull, 'decline_reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('decline_reason', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['decline_reason'] = $decline_reason; return $this; @@ -543,6 +690,16 @@ public function getSignedAt() */ public function setSignedAt(?int $signed_at) { + if (is_null($signed_at)) { + array_push($this->openAPINullablesSetToNull, 'signed_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signed_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signed_at'] = $signed_at; return $this; @@ -567,6 +724,16 @@ public function getLastViewedAt() */ public function setLastViewedAt(?int $last_viewed_at) { + if (is_null($last_viewed_at)) { + array_push($this->openAPINullablesSetToNull, 'last_viewed_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_viewed_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['last_viewed_at'] = $last_viewed_at; return $this; @@ -591,6 +758,16 @@ public function getLastRemindedAt() */ public function setLastRemindedAt(?int $last_reminded_at) { + if (is_null($last_reminded_at)) { + array_push($this->openAPINullablesSetToNull, 'last_reminded_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('last_reminded_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['last_reminded_at'] = $last_reminded_at; return $this; @@ -615,6 +792,9 @@ public function getHasPin() */ public function setHasPin(?bool $has_pin) { + if (is_null($has_pin)) { + throw new InvalidArgumentException('non-nullable has_pin cannot be null'); + } $this->container['has_pin'] = $has_pin; return $this; @@ -639,6 +819,16 @@ public function getHasSmsAuth() */ public function setHasSmsAuth(?bool $has_sms_auth) { + if (is_null($has_sms_auth)) { + array_push($this->openAPINullablesSetToNull, 'has_sms_auth'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('has_sms_auth', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['has_sms_auth'] = $has_sms_auth; return $this; @@ -663,6 +853,16 @@ public function getHasSmsDelivery() */ public function setHasSmsDelivery(?bool $has_sms_delivery) { + if (is_null($has_sms_delivery)) { + array_push($this->openAPINullablesSetToNull, 'has_sms_delivery'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('has_sms_delivery', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['has_sms_delivery'] = $has_sms_delivery; return $this; @@ -687,6 +887,16 @@ public function getSmsPhoneNumber() */ public function setSmsPhoneNumber(?string $sms_phone_number) { + if (is_null($sms_phone_number)) { + array_push($this->openAPINullablesSetToNull, 'sms_phone_number'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('sms_phone_number', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['sms_phone_number'] = $sms_phone_number; return $this; @@ -711,6 +921,16 @@ public function getReassignedBy() */ public function setReassignedBy(?string $reassigned_by) { + if (is_null($reassigned_by)) { + array_push($this->openAPINullablesSetToNull, 'reassigned_by'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reassigned_by', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['reassigned_by'] = $reassigned_by; return $this; @@ -735,6 +955,16 @@ public function getReassignmentReason() */ public function setReassignmentReason(?string $reassignment_reason) { + if (is_null($reassignment_reason)) { + array_push($this->openAPINullablesSetToNull, 'reassignment_reason'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reassignment_reason', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['reassignment_reason'] = $reassignment_reason; return $this; @@ -759,6 +989,16 @@ public function getReassignedFrom() */ public function setReassignedFrom(?string $reassigned_from) { + if (is_null($reassigned_from)) { + array_push($this->openAPINullablesSetToNull, 'reassigned_from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('reassigned_from', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['reassigned_from'] = $reassigned_from; return $this; @@ -783,6 +1023,16 @@ public function getError() */ public function setError(?string $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; @@ -791,12 +1041,10 @@ public function setError(?string $error) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -804,7 +1052,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -817,13 +1065,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -835,12 +1081,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -849,8 +1093,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -867,7 +1111,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestSendRequest.php b/sdks/php/src/Model/SignatureRequestSendRequest.php index c68fb8f49..a8c369353 100644 --- a/sdks/php/src/Model/SignatureRequestSendRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * SignatureRequestSendRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestSendRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -126,6 +122,47 @@ class SignatureRequestSendRequest implements ModelInterface, ArrayAccess, JsonSe 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'files' => false, + 'file_urls' => false, + 'signers' => false, + 'grouped_signers' => false, + 'allow_decline' => false, + 'allow_reassign' => false, + 'attachments' => false, + 'cc_email_addresses' => false, + 'client_id' => false, + 'custom_fields' => false, + 'field_options' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'form_fields_per_document' => false, + 'hide_text_tags' => false, + 'is_qualified_signature' => false, + 'is_eid' => false, + 'message' => false, + 'metadata' => false, + 'signing_options' => false, + 'signing_redirect_url' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'use_text_tags' => false, + 'expires_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -146,6 +183,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -293,62 +374,78 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['grouped_signers'] = $data['grouped_signers'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['hide_text_tags'] = $data['hide_text_tags'] ?? false; - $this->container['is_qualified_signature'] = $data['is_qualified_signature'] ?? false; - $this->container['is_eid'] = $data['is_eid'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['use_text_tags'] = $data['use_text_tags'] ?? false; - $this->container['expires_at'] = $data['expires_at'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('grouped_signers', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('hide_text_tags', $data ?? [], false); + $this->setIfExists('is_qualified_signature', $data ?? [], false); + $this->setIfExists('is_eid', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('use_text_tags', $data ?? [], false); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestSendRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestSendRequest { /** @var SignatureRequestSendRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestSendRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -405,6 +502,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -429,6 +529,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -453,6 +556,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -477,6 +583,9 @@ public function getGroupedSigners() */ public function setGroupedSigners(?array $grouped_signers) { + if (is_null($grouped_signers)) { + throw new InvalidArgumentException('non-nullable grouped_signers cannot be null'); + } $this->container['grouped_signers'] = $grouped_signers; return $this; @@ -501,6 +610,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -525,6 +637,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -549,6 +664,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -573,6 +691,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -597,6 +718,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -621,6 +745,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -645,6 +772,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -669,6 +799,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -693,6 +826,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -717,6 +853,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(?array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -741,6 +880,9 @@ public function getHideTextTags() */ public function setHideTextTags(?bool $hide_text_tags) { + if (is_null($hide_text_tags)) { + throw new InvalidArgumentException('non-nullable hide_text_tags cannot be null'); + } $this->container['hide_text_tags'] = $hide_text_tags; return $this; @@ -767,6 +909,9 @@ public function getIsQualifiedSignature() */ public function setIsQualifiedSignature(?bool $is_qualified_signature) { + if (is_null($is_qualified_signature)) { + throw new InvalidArgumentException('non-nullable is_qualified_signature cannot be null'); + } $this->container['is_qualified_signature'] = $is_qualified_signature; return $this; @@ -791,6 +936,9 @@ public function getIsEid() */ public function setIsEid(?bool $is_eid) { + if (is_null($is_eid)) { + throw new InvalidArgumentException('non-nullable is_eid cannot be null'); + } $this->container['is_eid'] = $is_eid; return $this; @@ -815,7 +963,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestSendRequest., must be smaller than or equal to 5000.'); } @@ -843,6 +994,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -867,6 +1022,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -891,6 +1049,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -915,7 +1076,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestSendRequest., must be smaller than or equal to 255.'); } @@ -943,6 +1107,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -967,7 +1134,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestSendRequest., must be smaller than or equal to 255.'); } @@ -995,6 +1165,9 @@ public function getUseTextTags() */ public function setUseTextTags(?bool $use_text_tags) { + if (is_null($use_text_tags)) { + throw new InvalidArgumentException('non-nullable use_text_tags cannot be null'); + } $this->container['use_text_tags'] = $use_text_tags; return $this; @@ -1019,6 +1192,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -1027,12 +1210,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1040,7 +1221,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -1053,13 +1234,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1071,12 +1250,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1085,8 +1262,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1103,7 +1280,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php index c08ce5f24..89df4633e 100644 --- a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,9 @@ * SignatureRequestSendWithTemplateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team + * @description * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestSendWithTemplateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -108,6 +105,38 @@ class SignatureRequestSendWithTemplateRequest implements ModelInterface, ArrayAc 'title' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_ids' => false, + 'signers' => false, + 'allow_decline' => false, + 'ccs' => false, + 'client_id' => false, + 'custom_fields' => false, + 'files' => false, + 'file_urls' => false, + 'is_qualified_signature' => false, + 'is_eid' => false, + 'message' => false, + 'metadata' => false, + 'signing_options' => false, + 'signing_redirect_url' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -128,6 +157,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -248,53 +321,69 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['ccs'] = $data['ccs'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['is_qualified_signature'] = $data['is_qualified_signature'] ?? false; - $this->container['is_eid'] = $data['is_eid'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('ccs', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('is_qualified_signature', $data ?? [], false); + $this->setIfExists('is_eid', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestSendWithTemplateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestSendWithTemplateRequest { /** @var SignatureRequestSendWithTemplateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestSendWithTemplateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -357,6 +446,9 @@ public function getTemplateIds() */ public function setTemplateIds(array $template_ids) { + if (is_null($template_ids)) { + throw new InvalidArgumentException('non-nullable template_ids cannot be null'); + } $this->container['template_ids'] = $template_ids; return $this; @@ -381,6 +473,9 @@ public function getSigners() */ public function setSigners(array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -405,6 +500,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -429,6 +527,9 @@ public function getCcs() */ public function setCcs(?array $ccs) { + if (is_null($ccs)) { + throw new InvalidArgumentException('non-nullable ccs cannot be null'); + } $this->container['ccs'] = $ccs; return $this; @@ -453,6 +554,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -477,6 +581,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -501,6 +608,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -525,6 +635,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -551,6 +664,9 @@ public function getIsQualifiedSignature() */ public function setIsQualifiedSignature(?bool $is_qualified_signature) { + if (is_null($is_qualified_signature)) { + throw new InvalidArgumentException('non-nullable is_qualified_signature cannot be null'); + } $this->container['is_qualified_signature'] = $is_qualified_signature; return $this; @@ -575,6 +691,9 @@ public function getIsEid() */ public function setIsEid(?bool $is_eid) { + if (is_null($is_eid)) { + throw new InvalidArgumentException('non-nullable is_eid cannot be null'); + } $this->container['is_eid'] = $is_eid; return $this; @@ -599,7 +718,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling SignatureRequestSendWithTemplateRequest., must be smaller than or equal to 5000.'); } @@ -627,6 +749,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -651,6 +777,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -675,6 +804,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -699,7 +831,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling SignatureRequestSendWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -727,6 +862,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -751,7 +889,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling SignatureRequestSendWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -763,12 +904,10 @@ public function setTitle(?string $title) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -776,7 +915,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -789,13 +928,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -807,12 +944,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -821,8 +956,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -839,7 +974,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SignatureRequestUpdateRequest.php b/sdks/php/src/Model/SignatureRequestUpdateRequest.php index b54c560a2..7299d0927 100644 --- a/sdks/php/src/Model/SignatureRequestUpdateRequest.php +++ b/sdks/php/src/Model/SignatureRequestUpdateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SignatureRequestUpdateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SignatureRequestUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -80,6 +77,25 @@ class SignatureRequestUpdateRequest implements ModelInterface, ArrayAccess, Json 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'signature_id' => false, + 'email_address' => false, + 'name' => false, + 'expires_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -100,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -181,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['signature_id'] = $data['signature_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; + $this->setIfExists('signature_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SignatureRequestUpdateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SignatureRequestUpdateRequest { /** @var SignatureRequestUpdateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SignatureRequestUpdateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +305,6 @@ public function listInvalidProperties() if ($this->container['signature_id'] === null) { $invalidProperties[] = "'signature_id' can't be null"; } - return $invalidProperties; } @@ -263,6 +338,9 @@ public function getSignatureId() */ public function setSignatureId(string $signature_id) { + if (is_null($signature_id)) { + throw new InvalidArgumentException('non-nullable signature_id cannot be null'); + } $this->container['signature_id'] = $signature_id; return $this; @@ -287,6 +365,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -311,6 +392,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -335,6 +419,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -343,12 +437,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -356,7 +448,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -369,13 +461,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -387,12 +477,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -401,8 +489,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -419,7 +507,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubAttachment.php b/sdks/php/src/Model/SubAttachment.php index 20e960823..cfc9204cf 100644 --- a/sdks/php/src/Model/SubAttachment.php +++ b/sdks/php/src/Model/SubAttachment.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubAttachment Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubAttachment implements ModelInterface, ArrayAccess, JsonSerializable { @@ -80,6 +77,25 @@ class SubAttachment implements ModelInterface, ArrayAccess, JsonSerializable 'required' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'signer_index' => false, + 'instructions' => false, + 'required' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -100,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -181,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['signer_index'] = $data['signer_index'] ?? null; - $this->container['instructions'] = $data['instructions'] ?? null; - $this->container['required'] = $data['required'] ?? false; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('signer_index', $data ?? [], null); + $this->setIfExists('instructions', $data ?? [], null); + $this->setIfExists('required', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubAttachment { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubAttachment { /** @var SubAttachment $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubAttachment::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -232,7 +308,6 @@ public function listInvalidProperties() if ($this->container['signer_index'] === null) { $invalidProperties[] = "'signer_index' can't be null"; } - return $invalidProperties; } @@ -266,6 +341,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -290,6 +368,9 @@ public function getSignerIndex() */ public function setSignerIndex(int $signer_index) { + if (is_null($signer_index)) { + throw new InvalidArgumentException('non-nullable signer_index cannot be null'); + } $this->container['signer_index'] = $signer_index; return $this; @@ -314,6 +395,9 @@ public function getInstructions() */ public function setInstructions(?string $instructions) { + if (is_null($instructions)) { + throw new InvalidArgumentException('non-nullable instructions cannot be null'); + } $this->container['instructions'] = $instructions; return $this; @@ -338,6 +422,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -346,12 +433,10 @@ public function setRequired(?bool $required) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -359,7 +444,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -372,13 +457,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -390,12 +473,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -404,8 +485,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -422,7 +503,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubBulkSignerList.php b/sdks/php/src/Model/SubBulkSignerList.php index be242b967..52401ab0f 100644 --- a/sdks/php/src/Model/SubBulkSignerList.php +++ b/sdks/php/src/Model/SubBulkSignerList.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubBulkSignerList Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubBulkSignerList implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class SubBulkSignerList implements ModelInterface, ArrayAccess, JsonSerializable 'signers' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'custom_fields' => false, + 'signers' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubBulkSignerList { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubBulkSignerList { /** @var SubBulkSignerList $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubBulkSignerList::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -212,9 +286,7 @@ public static function init(array $data): SubBulkSignerList */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -247,6 +319,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -271,6 +346,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -279,12 +357,10 @@ public function setSigners(?array $signers) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -292,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -305,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -323,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -337,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -355,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubBulkSignerListCustomField.php b/sdks/php/src/Model/SubBulkSignerListCustomField.php index 9afee26cb..c22f8b9aa 100644 --- a/sdks/php/src/Model/SubBulkSignerListCustomField.php +++ b/sdks/php/src/Model/SubBulkSignerListCustomField.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubBulkSignerListCustomField Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubBulkSignerListCustomField implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class SubBulkSignerListCustomField implements ModelInterface, ArrayAccess, JsonS 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubBulkSignerListCustomField { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubBulkSignerListCustomField { /** @var SubBulkSignerListCustomField $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubBulkSignerListCustomField::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -220,7 +294,6 @@ public function listInvalidProperties() if ($this->container['value'] === null) { $invalidProperties[] = "'value' can't be null"; } - return $invalidProperties; } @@ -254,6 +327,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -278,6 +354,9 @@ public function getValue() */ public function setValue(string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -286,12 +365,10 @@ public function setValue(string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -299,7 +376,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -312,13 +389,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -330,12 +405,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -344,8 +417,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -362,7 +435,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubCC.php b/sdks/php/src/Model/SubCC.php index c07dcfbe0..1e2977b34 100644 --- a/sdks/php/src/Model/SubCC.php +++ b/sdks/php/src/Model/SubCC.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubCC Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubCC implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class SubCC implements ModelInterface, ArrayAccess, JsonSerializable 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'role' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['role'] = $data['role'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubCC { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubCC { /** @var SubCC $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubCC::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -220,7 +294,6 @@ public function listInvalidProperties() if ($this->container['email_address'] === null) { $invalidProperties[] = "'email_address' can't be null"; } - return $invalidProperties; } @@ -254,6 +327,9 @@ public function getRole() */ public function setRole(string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -278,6 +354,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -286,12 +365,10 @@ public function setEmailAddress(string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -299,7 +376,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -312,13 +389,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -330,12 +405,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -344,8 +417,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -362,7 +435,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubCustomField.php b/sdks/php/src/Model/SubCustomField.php index 9b0342904..909e60355 100644 --- a/sdks/php/src/Model/SubCustomField.php +++ b/sdks/php/src/Model/SubCustomField.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,11 +38,8 @@ * * @category Class * @description When used together with merge fields, `custom_fields` allows users to add pre-filled data to their signature requests. Pre-filled data can be used with \"send-once\" signature requests by adding merge fields with `form_fields_per_document` or [Text Tags](https://app.hellosign.com/api/textTagsWalkthrough#TextTagIntro) while passing values back with `custom_fields` together in one API call. For using pre-filled on repeatable signature requests, merge fields are added to templates in the Dropbox Sign UI or by calling [/template/create_embedded_draft](/api/reference/operation/templateCreateEmbeddedDraft) and then passing `custom_fields` on subsequent signature requests referencing that template. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubCustomField implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +78,25 @@ class SubCustomField implements ModelInterface, ArrayAccess, JsonSerializable 'value' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'editor' => false, + 'required' => false, + 'value' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -182,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['editor'] = $data['editor'] ?? null; - $this->container['required'] = $data['required'] ?? false; - $this->container['value'] = $data['value'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('editor', $data ?? [], null); + $this->setIfExists('required', $data ?? [], false); + $this->setIfExists('value', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubCustomField { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubCustomField { /** @var SubCustomField $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubCustomField::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -230,7 +306,6 @@ public function listInvalidProperties() if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - return $invalidProperties; } @@ -264,6 +339,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -288,6 +366,9 @@ public function getEditor() */ public function setEditor(?string $editor) { + if (is_null($editor)) { + throw new InvalidArgumentException('non-nullable editor cannot be null'); + } $this->container['editor'] = $editor; return $this; @@ -312,6 +393,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -336,6 +420,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -344,12 +431,10 @@ public function setValue(?string $value) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -357,7 +442,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -370,13 +455,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -388,12 +471,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -402,8 +483,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -420,7 +501,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubEditorOptions.php b/sdks/php/src/Model/SubEditorOptions.php index b53caa2ad..a9d9bf736 100644 --- a/sdks/php/src/Model/SubEditorOptions.php +++ b/sdks/php/src/Model/SubEditorOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,11 +38,8 @@ * * @category Class * @description This allows the requester to specify editor options when a preparing a document - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubEditorOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +74,23 @@ class SubEditorOptions implements ModelInterface, ArrayAccess, JsonSerializable 'allow_edit_documents' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'allow_edit_signers' => false, + 'allow_edit_documents' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['allow_edit_signers'] = $data['allow_edit_signers'] ?? false; - $this->container['allow_edit_documents'] = $data['allow_edit_documents'] ?? false; + $this->setIfExists('allow_edit_signers', $data ?? [], false); + $this->setIfExists('allow_edit_documents', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubEditorOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubEditorOptions { /** @var SubEditorOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubEditorOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +287,7 @@ public static function init(array $data): SubEditorOptions */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +320,9 @@ public function getAllowEditSigners() */ public function setAllowEditSigners(?bool $allow_edit_signers) { + if (is_null($allow_edit_signers)) { + throw new InvalidArgumentException('non-nullable allow_edit_signers cannot be null'); + } $this->container['allow_edit_signers'] = $allow_edit_signers; return $this; @@ -272,6 +347,9 @@ public function getAllowEditDocuments() */ public function setAllowEditDocuments(?bool $allow_edit_documents) { + if (is_null($allow_edit_documents)) { + throw new InvalidArgumentException('non-nullable allow_edit_documents cannot be null'); + } $this->container['allow_edit_documents'] = $allow_edit_documents; return $this; @@ -280,12 +358,10 @@ public function setAllowEditDocuments(?bool $allow_edit_documents) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFieldOptions.php b/sdks/php/src/Model/SubFieldOptions.php index 3bb948219..bc3a856d3 100644 --- a/sdks/php/src/Model/SubFieldOptions.php +++ b/sdks/php/src/Model/SubFieldOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * * @category Class * @description This allows the requester to specify field options for a signature request. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFieldOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +72,22 @@ class SubFieldOptions implements ModelInterface, ArrayAccess, JsonSerializable 'date_format' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'date_format' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -192,37 +248,53 @@ public function getDateFormatAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['date_format'] = $data['date_format'] ?? null; + $this->setIfExists('date_format', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFieldOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFieldOptions { /** @var SubFieldOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFieldOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -279,6 +351,9 @@ public function getDateFormat() */ public function setDateFormat(string $date_format) { + if (is_null($date_format)) { + throw new InvalidArgumentException('non-nullable date_format cannot be null'); + } $allowedValues = $this->getDateFormatAllowableValues(); if (!in_array($date_format, $allowedValues, true)) { throw new InvalidArgumentException( @@ -297,12 +372,10 @@ public function setDateFormat(string $date_format) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -310,7 +383,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -323,13 +396,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -341,12 +412,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -355,8 +424,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -373,7 +442,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldGroup.php b/sdks/php/src/Model/SubFormFieldGroup.php index 2982638e8..eea7c2a96 100644 --- a/sdks/php/src/Model/SubFormFieldGroup.php +++ b/sdks/php/src/Model/SubFormFieldGroup.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubFormFieldGroup Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldGroup implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class SubFormFieldGroup implements ModelInterface, ArrayAccess, JsonSerializable 'requirement' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'group_id' => false, + 'group_label' => false, + 'requirement' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['group_id'] = $data['group_id'] ?? null; - $this->container['group_label'] = $data['group_label'] ?? null; - $this->container['requirement'] = $data['requirement'] ?? null; + $this->setIfExists('group_id', $data ?? [], null); + $this->setIfExists('group_label', $data ?? [], null); + $this->setIfExists('requirement', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldGroup { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldGroup { /** @var SubFormFieldGroup $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldGroup::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +304,6 @@ public function listInvalidProperties() if ($this->container['requirement'] === null) { $invalidProperties[] = "'requirement' can't be null"; } - return $invalidProperties; } @@ -263,6 +337,9 @@ public function getGroupId() */ public function setGroupId(string $group_id) { + if (is_null($group_id)) { + throw new InvalidArgumentException('non-nullable group_id cannot be null'); + } $this->container['group_id'] = $group_id; return $this; @@ -287,6 +364,9 @@ public function getGroupLabel() */ public function setGroupLabel(string $group_label) { + if (is_null($group_label)) { + throw new InvalidArgumentException('non-nullable group_label cannot be null'); + } $this->container['group_label'] = $group_label; return $this; @@ -311,6 +391,9 @@ public function getRequirement() */ public function setRequirement(string $requirement) { + if (is_null($requirement)) { + throw new InvalidArgumentException('non-nullable requirement cannot be null'); + } $this->container['requirement'] = $requirement; return $this; @@ -319,12 +402,10 @@ public function setRequirement(string $requirement) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -332,7 +413,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -345,13 +426,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -363,12 +442,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -377,8 +454,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -395,7 +472,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldRule.php b/sdks/php/src/Model/SubFormFieldRule.php index 06adccf64..4726be3f9 100644 --- a/sdks/php/src/Model/SubFormFieldRule.php +++ b/sdks/php/src/Model/SubFormFieldRule.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubFormFieldRule Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldRule implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class SubFormFieldRule implements ModelInterface, ArrayAccess, JsonSerializable 'actions' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'trigger_operator' => false, + 'triggers' => false, + 'actions' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -182,40 +241,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['trigger_operator'] = $data['trigger_operator'] ?? 'AND'; - $this->container['triggers'] = $data['triggers'] ?? null; - $this->container['actions'] = $data['actions'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('trigger_operator', $data ?? [], 'AND'); + $this->setIfExists('triggers', $data ?? [], null); + $this->setIfExists('actions', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldRule { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldRule { /** @var SubFormFieldRule $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldRule::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -236,18 +311,18 @@ public function listInvalidProperties() if ($this->container['triggers'] === null) { $invalidProperties[] = "'triggers' can't be null"; } - if ((count($this->container['triggers']) > 1)) { + if (count($this->container['triggers']) > 1) { $invalidProperties[] = "invalid value for 'triggers', number of items must be less than or equal to 1."; } - if ((count($this->container['triggers']) < 1)) { + if (count($this->container['triggers']) < 1) { $invalidProperties[] = "invalid value for 'triggers', number of items must be greater than or equal to 1."; } if ($this->container['actions'] === null) { $invalidProperties[] = "'actions' can't be null"; } - if ((count($this->container['actions']) < 1)) { + if (count($this->container['actions']) < 1) { $invalidProperties[] = "invalid value for 'actions', number of items must be greater than or equal to 1."; } @@ -284,6 +359,9 @@ public function getId() */ public function setId(string $id) { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -308,6 +386,9 @@ public function getTriggerOperator() */ public function setTriggerOperator(string $trigger_operator) { + if (is_null($trigger_operator)) { + throw new InvalidArgumentException('non-nullable trigger_operator cannot be null'); + } $this->container['trigger_operator'] = $trigger_operator; return $this; @@ -332,10 +413,14 @@ public function getTriggers() */ public function setTriggers(array $triggers) { - if ((count($triggers) > 1)) { + if (is_null($triggers)) { + throw new InvalidArgumentException('non-nullable triggers cannot be null'); + } + + if (count($triggers) > 1) { throw new InvalidArgumentException('invalid value for $triggers when calling SubFormFieldRule., number of items must be less than or equal to 1.'); } - if ((count($triggers) < 1)) { + if (count($triggers) < 1) { throw new InvalidArgumentException('invalid length for $triggers when calling SubFormFieldRule., number of items must be greater than or equal to 1.'); } $this->container['triggers'] = $triggers; @@ -362,7 +447,11 @@ public function getActions() */ public function setActions(array $actions) { - if ((count($actions) < 1)) { + if (is_null($actions)) { + throw new InvalidArgumentException('non-nullable actions cannot be null'); + } + + if (count($actions) < 1) { throw new InvalidArgumentException('invalid length for $actions when calling SubFormFieldRule., number of items must be greater than or equal to 1.'); } $this->container['actions'] = $actions; @@ -373,12 +462,10 @@ public function setActions(array $actions) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -386,7 +473,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -399,13 +486,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -417,12 +502,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -431,8 +514,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -449,7 +532,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldRuleAction.php b/sdks/php/src/Model/SubFormFieldRuleAction.php index c1802e157..0c19592b8 100644 --- a/sdks/php/src/Model/SubFormFieldRuleAction.php +++ b/sdks/php/src/Model/SubFormFieldRuleAction.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubFormFieldRuleAction Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldRuleAction implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class SubFormFieldRuleAction implements ModelInterface, ArrayAccess, JsonSeriali 'group_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'hidden' => false, + 'type' => false, + 'field_id' => false, + 'group_id' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -198,40 +257,56 @@ public function getTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['hidden'] = $data['hidden'] ?? null; - $this->container['type'] = $data['type'] ?? null; - $this->container['field_id'] = $data['field_id'] ?? null; - $this->container['group_id'] = $data['group_id'] ?? null; + $this->setIfExists('hidden', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('field_id', $data ?? [], null); + $this->setIfExists('group_id', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldRuleAction { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldRuleAction { /** @var SubFormFieldRuleAction $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldRuleAction::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -291,6 +366,9 @@ public function getHidden() */ public function setHidden(bool $hidden) { + if (is_null($hidden)) { + throw new InvalidArgumentException('non-nullable hidden cannot be null'); + } $this->container['hidden'] = $hidden; return $this; @@ -315,6 +393,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -349,6 +430,9 @@ public function getFieldId() */ public function setFieldId(?string $field_id) { + if (is_null($field_id)) { + throw new InvalidArgumentException('non-nullable field_id cannot be null'); + } $this->container['field_id'] = $field_id; return $this; @@ -373,6 +457,9 @@ public function getGroupId() */ public function setGroupId(?string $group_id) { + if (is_null($group_id)) { + throw new InvalidArgumentException('non-nullable group_id cannot be null'); + } $this->container['group_id'] = $group_id; return $this; @@ -381,12 +468,10 @@ public function setGroupId(?string $group_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -394,7 +479,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -407,13 +492,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -425,12 +508,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -439,8 +520,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -457,7 +538,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldRuleTrigger.php b/sdks/php/src/Model/SubFormFieldRuleTrigger.php index 1fbabd217..1d38083cb 100644 --- a/sdks/php/src/Model/SubFormFieldRuleTrigger.php +++ b/sdks/php/src/Model/SubFormFieldRuleTrigger.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubFormFieldRuleTrigger Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldRuleTrigger implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class SubFormFieldRuleTrigger implements ModelInterface, ArrayAccess, JsonSerial 'values' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'operator' => false, + 'value' => false, + 'values' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +263,56 @@ public function getOperatorAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['id'] = $data['id'] ?? null; - $this->container['operator'] = $data['operator'] ?? null; - $this->container['value'] = $data['value'] ?? null; - $this->container['values'] = $data['values'] ?? null; + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('operator', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldRuleTrigger { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldRuleTrigger { /** @var SubFormFieldRuleTrigger $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldRuleTrigger::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -297,6 +372,9 @@ public function getId() */ public function setId(string $id) { + if (is_null($id)) { + throw new InvalidArgumentException('non-nullable id cannot be null'); + } $this->container['id'] = $id; return $this; @@ -321,6 +399,9 @@ public function getOperator() */ public function setOperator(string $operator) { + if (is_null($operator)) { + throw new InvalidArgumentException('non-nullable operator cannot be null'); + } $allowedValues = $this->getOperatorAllowableValues(); if (!in_array($operator, $allowedValues, true)) { throw new InvalidArgumentException( @@ -355,6 +436,9 @@ public function getValue() */ public function setValue(?string $value) { + if (is_null($value)) { + throw new InvalidArgumentException('non-nullable value cannot be null'); + } $this->container['value'] = $value; return $this; @@ -379,6 +463,9 @@ public function getValues() */ public function setValues(?array $values) { + if (is_null($values)) { + throw new InvalidArgumentException('non-nullable values cannot be null'); + } $this->container['values'] = $values; return $this; @@ -387,12 +474,10 @@ public function setValues(?array $values) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -400,7 +485,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -413,13 +498,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -431,12 +514,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -445,8 +526,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -463,7 +544,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php index 273b7e238..a7193e75e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class SubFormFieldsPerDocumentBase implements ModelInterface, ArrayAccess, JsonSerializable +class SubFormFieldsPerDocumentBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -96,6 +92,32 @@ abstract class SubFormFieldsPerDocumentBase implements ModelInterface, ArrayAcce 'page' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'document_index' => false, + 'api_id' => false, + 'height' => false, + 'required' => false, + 'signer' => false, + 'type' => false, + 'width' => false, + 'x' => false, + 'y' => false, + 'name' => false, + 'page' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -116,6 +138,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -218,29 +284,29 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['document_index'] = $data['document_index'] ?? null; - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['height'] = $data['height'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['signer'] = $data['signer'] ?? null; - $this->container['type'] = $data['type'] ?? null; - $this->container['width'] = $data['width'] ?? null; - $this->container['x'] = $data['x'] ?? null; - $this->container['y'] = $data['y'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['page'] = $data['page'] ?? null; + $this->setIfExists('document_index', $data ?? [], null); + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('signer', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('page', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -286,6 +352,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -322,7 +402,6 @@ public function listInvalidProperties() if ($this->container['y'] === null) { $invalidProperties[] = "'y' can't be null"; } - return $invalidProperties; } @@ -356,6 +435,9 @@ public function getDocumentIndex() */ public function setDocumentIndex(int $document_index) { + if (is_null($document_index)) { + throw new InvalidArgumentException('non-nullable document_index cannot be null'); + } $this->container['document_index'] = $document_index; return $this; @@ -380,6 +462,9 @@ public function getApiId() */ public function setApiId(string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -404,6 +489,9 @@ public function getHeight() */ public function setHeight(int $height) { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } $this->container['height'] = $height; return $this; @@ -428,6 +516,9 @@ public function getRequired() */ public function setRequired(bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -436,7 +527,7 @@ public function setRequired(bool $required) /** * Gets signer * - * @return int|string + * @return string */ public function getSigner() { @@ -446,12 +537,15 @@ public function getSigner() /** * Sets signer * - * @param int|string $signer Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data. + * @param string $signer Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data. * * @return self */ - public function setSigner($signer) + public function setSigner(string $signer) { + if (is_null($signer)) { + throw new InvalidArgumentException('non-nullable signer cannot be null'); + } $this->container['signer'] = $signer; return $this; @@ -476,6 +570,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -500,6 +597,9 @@ public function getWidth() */ public function setWidth(int $width) { + if (is_null($width)) { + throw new InvalidArgumentException('non-nullable width cannot be null'); + } $this->container['width'] = $width; return $this; @@ -524,6 +624,9 @@ public function getX() */ public function setX(int $x) { + if (is_null($x)) { + throw new InvalidArgumentException('non-nullable x cannot be null'); + } $this->container['x'] = $x; return $this; @@ -548,6 +651,9 @@ public function getY() */ public function setY(int $y) { + if (is_null($y)) { + throw new InvalidArgumentException('non-nullable y cannot be null'); + } $this->container['y'] = $y; return $this; @@ -572,6 +678,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -596,6 +705,16 @@ public function getPage() */ public function setPage(?int $page) { + if (is_null($page)) { + array_push($this->openAPINullablesSetToNull, 'page'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('page', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['page'] = $page; return $this; @@ -604,12 +723,10 @@ public function setPage(?int $page) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -617,7 +734,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -630,13 +747,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -648,12 +763,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -662,8 +775,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -680,7 +793,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php index 73b035443..46ff7d15d 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentCheckbox extends SubFormFieldsPerDocumentBase { @@ -77,6 +74,24 @@ class SubFormFieldsPerDocumentCheckbox extends SubFormFieldsPerDocumentBase 'group' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'is_checked' => false, + 'group' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -175,34 +234,50 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; - $this->container['is_checked'] = $data['is_checked'] ?? null; - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('type', $data ?? [], 'checkbox'); + $this->setIfExists('is_checked', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentCheckbox { /** @var SubFormFieldsPerDocumentCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentCheckbox::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -220,7 +295,6 @@ public function listInvalidProperties() if ($this->container['is_checked'] === null) { $invalidProperties[] = "'is_checked' can't be null"; } - return $invalidProperties; } @@ -254,6 +328,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -278,6 +355,9 @@ public function getIsChecked() */ public function setIsChecked(bool $is_checked) { + if (is_null($is_checked)) { + throw new InvalidArgumentException('non-nullable is_checked cannot be null'); + } $this->container['is_checked'] = $is_checked; return $this; @@ -302,6 +382,9 @@ public function getGroup() */ public function setGroup(?string $group) { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } $this->container['group'] = $group; return $this; @@ -310,12 +393,10 @@ public function setGroup(?string $group) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +404,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +417,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +433,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +445,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php index 7c2add6a2..a168d5b8b 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentCheckboxMerge extends SubFormFieldsPerDocumentBase { @@ -73,6 +70,22 @@ class SubFormFieldsPerDocumentCheckboxMerge extends SubFormFieldsPerDocumentBase 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox-merge'; + $this->setIfExists('type', $data ?? [], 'checkbox-merge'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentCheckboxMerge { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentCheckboxMerge { /** @var SubFormFieldsPerDocumentCheckboxMerge $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentCheckboxMerge::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php index 22f989b9d..373ebfad5 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentDateSigned extends SubFormFieldsPerDocumentBase { @@ -78,6 +74,24 @@ class SubFormFieldsPerDocumentDateSigned extends SubFormFieldsPerDocumentBase 'font_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'font_family' => false, + 'font_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +112,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,34 +278,50 @@ public function getFontFamilyAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'date_signed'; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['font_size'] = $data['font_size'] ?? 12; + $this->setIfExists('type', $data ?? [], 'date_signed'); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('font_size', $data ?? [], 12); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentDateSigned { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentDateSigned { /** @var SubFormFieldsPerDocumentDateSigned $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentDateSigned::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +378,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -328,8 +405,11 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $allowedValues = $this->getFontFamilyAllowableValues(); - if (!is_null($font_family) && !in_array($font_family, $allowedValues, true)) { + if (!in_array($font_family, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'font_family', must be one of '%s'", @@ -362,6 +442,9 @@ public function getFontSize() */ public function setFontSize(?int $font_size) { + if (is_null($font_size)) { + throw new InvalidArgumentException('non-nullable font_size cannot be null'); + } $this->container['font_size'] = $font_size; return $this; @@ -370,12 +453,10 @@ public function setFontSize(?int $font_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -383,7 +464,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -396,13 +477,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -414,12 +493,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -428,8 +505,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -446,7 +523,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php index f4b1cb5bd..5231c34d7 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentDropdown extends SubFormFieldsPerDocumentBase { @@ -82,6 +78,26 @@ class SubFormFieldsPerDocumentDropdown extends SubFormFieldsPerDocumentBase 'font_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'options' => false, + 'content' => false, + 'font_family' => false, + 'font_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +118,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,36 +290,52 @@ public function getFontFamilyAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'dropdown'; - $this->container['options'] = $data['options'] ?? null; - $this->container['content'] = $data['content'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['font_size'] = $data['font_size'] ?? 12; + $this->setIfExists('type', $data ?? [], 'dropdown'); + $this->setIfExists('options', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('font_size', $data ?? [], 12); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentDropdown { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentDropdown { /** @var SubFormFieldsPerDocumentDropdown $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentDropdown::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -277,7 +353,7 @@ public function listInvalidProperties() if ($this->container['options'] === null) { $invalidProperties[] = "'options' can't be null"; } - if ((count($this->container['options']) < 1)) { + if (count($this->container['options']) < 1) { $invalidProperties[] = "invalid value for 'options', number of items must be greater than or equal to 1."; } @@ -323,6 +399,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -347,7 +426,11 @@ public function getOptions() */ public function setOptions(array $options) { - if ((count($options) < 1)) { + if (is_null($options)) { + throw new InvalidArgumentException('non-nullable options cannot be null'); + } + + if (count($options) < 1) { throw new InvalidArgumentException('invalid length for $options when calling SubFormFieldsPerDocumentDropdown., number of items must be greater than or equal to 1.'); } $this->container['options'] = $options; @@ -374,6 +457,9 @@ public function getContent() */ public function setContent(?string $content) { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -398,8 +484,11 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $allowedValues = $this->getFontFamilyAllowableValues(); - if (!is_null($font_family) && !in_array($font_family, $allowedValues, true)) { + if (!in_array($font_family, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'font_family', must be one of '%s'", @@ -432,6 +521,9 @@ public function getFontSize() */ public function setFontSize(?int $font_size) { + if (is_null($font_size)) { + throw new InvalidArgumentException('non-nullable font_size cannot be null'); + } $this->container['font_size'] = $font_size; return $this; @@ -440,12 +532,10 @@ public function setFontSize(?int $font_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -453,7 +543,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -466,13 +556,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -484,12 +572,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -498,8 +584,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -516,7 +602,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php b/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php index 6880c6dac..1296e1456 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * SubFormFieldsPerDocumentFontEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class SubFormFieldsPerDocumentFontEnum diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php index 7a9b19714..f5d0dc4e7 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentHyperlink extends SubFormFieldsPerDocumentBase { @@ -82,6 +78,26 @@ class SubFormFieldsPerDocumentHyperlink extends SubFormFieldsPerDocumentBase 'font_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'content' => false, + 'content_url' => false, + 'font_family' => false, + 'font_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +118,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,36 +290,52 @@ public function getFontFamilyAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'hyperlink'; - $this->container['content'] = $data['content'] ?? null; - $this->container['content_url'] = $data['content_url'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['font_size'] = $data['font_size'] ?? 12; + $this->setIfExists('type', $data ?? [], 'hyperlink'); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('content_url', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('font_size', $data ?? [], 12); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentHyperlink { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentHyperlink { /** @var SubFormFieldsPerDocumentHyperlink $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentHyperlink::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -322,6 +398,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -346,6 +425,9 @@ public function getContent() */ public function setContent(string $content) { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -370,6 +452,9 @@ public function getContentUrl() */ public function setContentUrl(string $content_url) { + if (is_null($content_url)) { + throw new InvalidArgumentException('non-nullable content_url cannot be null'); + } $this->container['content_url'] = $content_url; return $this; @@ -394,8 +479,11 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $allowedValues = $this->getFontFamilyAllowableValues(); - if (!is_null($font_family) && !in_array($font_family, $allowedValues, true)) { + if (!in_array($font_family, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'font_family', must be one of '%s'", @@ -428,6 +516,9 @@ public function getFontSize() */ public function setFontSize(?int $font_size) { + if (is_null($font_size)) { + throw new InvalidArgumentException('non-nullable font_size cannot be null'); + } $this->container['font_size'] = $font_size; return $this; @@ -436,12 +527,10 @@ public function setFontSize(?int $font_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -449,7 +538,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -462,13 +551,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -480,12 +567,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -494,8 +579,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -512,7 +597,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php index c13441367..a0888674b 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentInitials extends SubFormFieldsPerDocumentBase { @@ -73,6 +70,22 @@ class SubFormFieldsPerDocumentInitials extends SubFormFieldsPerDocumentBase 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'initials'; + $this->setIfExists('type', $data ?? [], 'initials'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentInitials { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentInitials { /** @var SubFormFieldsPerDocumentInitials $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentInitials::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php index 62c9fa4e8..153ef7681 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentRadio extends SubFormFieldsPerDocumentBase { @@ -77,6 +74,24 @@ class SubFormFieldsPerDocumentRadio extends SubFormFieldsPerDocumentBase 'is_checked' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'group' => false, + 'is_checked' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +112,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -175,34 +234,50 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'radio'; - $this->container['group'] = $data['group'] ?? null; - $this->container['is_checked'] = $data['is_checked'] ?? null; + $this->setIfExists('type', $data ?? [], 'radio'); + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('is_checked', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentRadio { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentRadio { /** @var SubFormFieldsPerDocumentRadio $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentRadio::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -223,7 +298,6 @@ public function listInvalidProperties() if ($this->container['is_checked'] === null) { $invalidProperties[] = "'is_checked' can't be null"; } - return $invalidProperties; } @@ -257,6 +331,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -281,6 +358,9 @@ public function getGroup() */ public function setGroup(string $group) { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } $this->container['group'] = $group; return $this; @@ -305,6 +385,9 @@ public function getIsChecked() */ public function setIsChecked(bool $is_checked) { + if (is_null($is_checked)) { + throw new InvalidArgumentException('non-nullable is_checked cannot be null'); + } $this->container['is_checked'] = $is_checked; return $this; @@ -313,12 +396,10 @@ public function setIsChecked(bool $is_checked) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -326,7 +407,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -339,13 +420,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -357,12 +436,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -371,8 +448,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -389,7 +466,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php index 08df4c6e3..c839a224c 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentSignature extends SubFormFieldsPerDocumentBase { @@ -73,6 +70,22 @@ class SubFormFieldsPerDocumentSignature extends SubFormFieldsPerDocumentBase 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'signature'; + $this->setIfExists('type', $data ?? [], 'signature'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentSignature { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentSignature { /** @var SubFormFieldsPerDocumentSignature $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentSignature::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php index 09ceea997..b460cd63e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentText extends SubFormFieldsPerDocumentBase { @@ -94,6 +90,32 @@ class SubFormFieldsPerDocumentText extends SubFormFieldsPerDocumentBase 'font_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'placeholder' => false, + 'auto_fill_type' => false, + 'link_id' => false, + 'masked' => false, + 'validation_type' => false, + 'validation_custom_regex' => false, + 'validation_custom_regex_format_label' => false, + 'content' => false, + 'font_family' => false, + 'font_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -114,6 +136,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -291,42 +357,58 @@ public function getFontFamilyAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; - $this->container['placeholder'] = $data['placeholder'] ?? null; - $this->container['auto_fill_type'] = $data['auto_fill_type'] ?? null; - $this->container['link_id'] = $data['link_id'] ?? null; - $this->container['masked'] = $data['masked'] ?? null; - $this->container['validation_type'] = $data['validation_type'] ?? null; - $this->container['validation_custom_regex'] = $data['validation_custom_regex'] ?? null; - $this->container['validation_custom_regex_format_label'] = $data['validation_custom_regex_format_label'] ?? null; - $this->container['content'] = $data['content'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['font_size'] = $data['font_size'] ?? 12; + $this->setIfExists('type', $data ?? [], 'text'); + $this->setIfExists('placeholder', $data ?? [], null); + $this->setIfExists('auto_fill_type', $data ?? [], null); + $this->setIfExists('link_id', $data ?? [], null); + $this->setIfExists('masked', $data ?? [], null); + $this->setIfExists('validation_type', $data ?? [], null); + $this->setIfExists('validation_custom_regex', $data ?? [], null); + $this->setIfExists('validation_custom_regex_format_label', $data ?? [], null); + $this->setIfExists('content', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('font_size', $data ?? [], 12); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentText { /** @var SubFormFieldsPerDocumentText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentText::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -392,6 +474,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -416,6 +501,9 @@ public function getPlaceholder() */ public function setPlaceholder(?string $placeholder) { + if (is_null($placeholder)) { + throw new InvalidArgumentException('non-nullable placeholder cannot be null'); + } $this->container['placeholder'] = $placeholder; return $this; @@ -440,6 +528,9 @@ public function getAutoFillType() */ public function setAutoFillType(?string $auto_fill_type) { + if (is_null($auto_fill_type)) { + throw new InvalidArgumentException('non-nullable auto_fill_type cannot be null'); + } $this->container['auto_fill_type'] = $auto_fill_type; return $this; @@ -464,6 +555,9 @@ public function getLinkId() */ public function setLinkId(?string $link_id) { + if (is_null($link_id)) { + throw new InvalidArgumentException('non-nullable link_id cannot be null'); + } $this->container['link_id'] = $link_id; return $this; @@ -488,6 +582,9 @@ public function getMasked() */ public function setMasked(?bool $masked) { + if (is_null($masked)) { + throw new InvalidArgumentException('non-nullable masked cannot be null'); + } $this->container['masked'] = $masked; return $this; @@ -512,8 +609,11 @@ public function getValidationType() */ public function setValidationType(?string $validation_type) { + if (is_null($validation_type)) { + throw new InvalidArgumentException('non-nullable validation_type cannot be null'); + } $allowedValues = $this->getValidationTypeAllowableValues(); - if (!is_null($validation_type) && !in_array($validation_type, $allowedValues, true)) { + if (!in_array($validation_type, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'validation_type', must be one of '%s'", @@ -546,6 +646,9 @@ public function getValidationCustomRegex() */ public function setValidationCustomRegex(?string $validation_custom_regex) { + if (is_null($validation_custom_regex)) { + throw new InvalidArgumentException('non-nullable validation_custom_regex cannot be null'); + } $this->container['validation_custom_regex'] = $validation_custom_regex; return $this; @@ -570,6 +673,9 @@ public function getValidationCustomRegexFormatLabel() */ public function setValidationCustomRegexFormatLabel(?string $validation_custom_regex_format_label) { + if (is_null($validation_custom_regex_format_label)) { + throw new InvalidArgumentException('non-nullable validation_custom_regex_format_label cannot be null'); + } $this->container['validation_custom_regex_format_label'] = $validation_custom_regex_format_label; return $this; @@ -594,6 +700,9 @@ public function getContent() */ public function setContent(?string $content) { + if (is_null($content)) { + throw new InvalidArgumentException('non-nullable content cannot be null'); + } $this->container['content'] = $content; return $this; @@ -618,8 +727,11 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $allowedValues = $this->getFontFamilyAllowableValues(); - if (!is_null($font_family) && !in_array($font_family, $allowedValues, true)) { + if (!in_array($font_family, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'font_family', must be one of '%s'", @@ -652,6 +764,9 @@ public function getFontSize() */ public function setFontSize(?int $font_size) { + if (is_null($font_size)) { + throw new InvalidArgumentException('non-nullable font_size cannot be null'); + } $this->container['font_size'] = $font_size; return $this; @@ -660,12 +775,10 @@ public function setFontSize(?int $font_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -673,7 +786,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -686,13 +799,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -704,12 +815,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -718,8 +827,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -736,7 +845,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php index 08ceb07ec..9a426e845 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `SubFormFieldsPerDocumentBase`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubFormFieldsPerDocumentTextMerge extends SubFormFieldsPerDocumentBase { @@ -78,6 +74,24 @@ class SubFormFieldsPerDocumentTextMerge extends SubFormFieldsPerDocumentBase 'font_size' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'font_family' => false, + 'font_size' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +112,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,34 +278,50 @@ public function getFontFamilyAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text-merge'; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['font_size'] = $data['font_size'] ?? 12; + $this->setIfExists('type', $data ?? [], 'text-merge'); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('font_size', $data ?? [], 12); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubFormFieldsPerDocumentTextMerge { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubFormFieldsPerDocumentTextMerge { /** @var SubFormFieldsPerDocumentTextMerge $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentTextMerge::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -304,6 +378,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -328,8 +405,11 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $allowedValues = $this->getFontFamilyAllowableValues(); - if (!is_null($font_family) && !in_array($font_family, $allowedValues, true)) { + if (!in_array($font_family, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'font_family', must be one of '%s'", @@ -362,6 +442,9 @@ public function getFontSize() */ public function setFontSize(?int $font_size) { + if (is_null($font_size)) { + throw new InvalidArgumentException('non-nullable font_size cannot be null'); + } $this->container['font_size'] = $font_size; return $this; @@ -370,12 +453,10 @@ public function setFontSize(?int $font_size) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -383,7 +464,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -396,13 +477,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -414,12 +493,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -428,8 +505,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -446,7 +523,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php b/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php index efe5595e6..d2e45310e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * SubFormFieldsPerDocumentTypeEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class SubFormFieldsPerDocumentTypeEnum diff --git a/sdks/php/src/Model/SubMergeField.php b/sdks/php/src/Model/SubMergeField.php index cbc6ffc78..162a22763 100644 --- a/sdks/php/src/Model/SubMergeField.php +++ b/sdks/php/src/Model/SubMergeField.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubMergeField Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubMergeField implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class SubMergeField implements ModelInterface, ArrayAccess, JsonSerializable 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -188,38 +245,54 @@ public function getTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['type'] = $data['type'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('type', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubMergeField { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubMergeField { /** @var SubMergeField $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubMergeField::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -279,6 +352,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -303,6 +379,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -321,12 +400,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -334,7 +411,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -347,13 +424,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -365,12 +440,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -379,8 +452,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -397,7 +470,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubOAuth.php b/sdks/php/src/Model/SubOAuth.php index 488da3405..a47eccb0b 100644 --- a/sdks/php/src/Model/SubOAuth.php +++ b/sdks/php/src/Model/SubOAuth.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * * @category Class * @description OAuth related parameters. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubOAuth implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class SubOAuth implements ModelInterface, ArrayAccess, JsonSerializable 'scopes' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'callback_url' => false, + 'scopes' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -201,38 +258,54 @@ public function getScopesAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['callback_url'] = $data['callback_url'] ?? null; - $this->container['scopes'] = $data['scopes'] ?? null; + $this->setIfExists('callback_url', $data ?? [], null); + $this->setIfExists('scopes', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubOAuth { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubOAuth { /** @var SubOAuth $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubOAuth::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -242,9 +315,7 @@ public static function init(array $data): SubOAuth */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -277,6 +348,9 @@ public function getCallbackUrl() */ public function setCallbackUrl(?string $callback_url) { + if (is_null($callback_url)) { + throw new InvalidArgumentException('non-nullable callback_url cannot be null'); + } $this->container['callback_url'] = $callback_url; return $this; @@ -301,8 +375,11 @@ public function getScopes() */ public function setScopes(?array $scopes) { + if (is_null($scopes)) { + throw new InvalidArgumentException('non-nullable scopes cannot be null'); + } $allowedValues = $this->getScopesAllowableValues(); - if (!is_null($scopes) && array_diff($scopes, $allowedValues)) { + if (array_diff($scopes, $allowedValues)) { throw new InvalidArgumentException( sprintf( "Invalid value for 'scopes', must be one of '%s'", @@ -318,12 +395,10 @@ public function setScopes(?array $scopes) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -331,7 +406,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -344,13 +419,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -362,12 +435,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -376,8 +447,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -394,7 +465,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubOptions.php b/sdks/php/src/Model/SubOptions.php index 0ac89500c..e5343174e 100644 --- a/sdks/php/src/Model/SubOptions.php +++ b/sdks/php/src/Model/SubOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,11 +38,8 @@ * * @category Class * @description Additional options supported by API App. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +72,22 @@ class SubOptions implements ModelInterface, ArrayAccess, JsonSerializable 'can_insert_everywhere' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'can_insert_everywhere' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +224,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['can_insert_everywhere'] = $data['can_insert_everywhere'] ?? false; + $this->setIfExists('can_insert_everywhere', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubOptions { /** @var SubOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -207,9 +280,7 @@ public static function init(array $data): SubOptions */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +313,9 @@ public function getCanInsertEverywhere() */ public function setCanInsertEverywhere(?bool $can_insert_everywhere) { + if (is_null($can_insert_everywhere)) { + throw new InvalidArgumentException('non-nullable can_insert_everywhere cannot be null'); + } $this->container['can_insert_everywhere'] = $can_insert_everywhere; return $this; @@ -250,12 +324,10 @@ public function setCanInsertEverywhere(?bool $can_insert_everywhere) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +335,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +348,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +364,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +376,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -326,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php index 950503cd4..9ac5753f7 100644 --- a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php +++ b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubSignatureRequestGroupedSigners Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubSignatureRequestGroupedSigners implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class SubSignatureRequestGroupedSigners implements ModelInterface, ArrayAccess, 'order' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'group' => false, + 'signers' => false, + 'order' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['group'] = $data['group'] ?? null; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['order'] = $data['order'] ?? null; + $this->setIfExists('group', $data ?? [], null); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubSignatureRequestGroupedSigners { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubSignatureRequestGroupedSigners { /** @var SubSignatureRequestGroupedSigners $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubSignatureRequestGroupedSigners::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +301,6 @@ public function listInvalidProperties() if ($this->container['signers'] === null) { $invalidProperties[] = "'signers' can't be null"; } - return $invalidProperties; } @@ -260,6 +334,9 @@ public function getGroup() */ public function setGroup(string $group) { + if (is_null($group)) { + throw new InvalidArgumentException('non-nullable group cannot be null'); + } $this->container['group'] = $group; return $this; @@ -284,6 +361,9 @@ public function getSigners() */ public function setSigners(array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -308,6 +388,16 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['order'] = $order; return $this; @@ -316,12 +406,10 @@ public function setOrder(?int $order) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -329,7 +417,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -342,13 +430,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -360,12 +446,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -374,8 +458,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -392,7 +476,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubSignatureRequestSigner.php b/sdks/php/src/Model/SubSignatureRequestSigner.php index eca198308..22f3a8f3d 100644 --- a/sdks/php/src/Model/SubSignatureRequestSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestSigner.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubSignatureRequestSigner Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubSignatureRequestSigner implements ModelInterface, ArrayAccess, JsonSerializable { @@ -85,6 +81,27 @@ class SubSignatureRequestSigner implements ModelInterface, ArrayAccess, JsonSeri 'sms_phone_number_type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'email_address' => false, + 'order' => true, + 'pin' => false, + 'sms_phone_number' => false, + 'sms_phone_number_type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -208,42 +269,58 @@ public function getSmsPhoneNumberTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['order'] = $data['order'] ?? null; - $this->container['pin'] = $data['pin'] ?? null; - $this->container['sms_phone_number'] = $data['sms_phone_number'] ?? null; - $this->container['sms_phone_number_type'] = $data['sms_phone_number_type'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); + $this->setIfExists('pin', $data ?? [], null); + $this->setIfExists('sms_phone_number', $data ?? [], null); + $this->setIfExists('sms_phone_number_type', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubSignatureRequestSigner { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubSignatureRequestSigner { /** @var SubSignatureRequestSigner $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubSignatureRequestSigner::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -311,6 +388,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -335,6 +415,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -359,6 +442,16 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['order'] = $order; return $this; @@ -383,10 +476,13 @@ public function getPin() */ public function setPin(?string $pin) { - if (!is_null($pin) && (mb_strlen($pin) > 12)) { + if (is_null($pin)) { + throw new InvalidArgumentException('non-nullable pin cannot be null'); + } + if (mb_strlen($pin) > 12) { throw new InvalidArgumentException('invalid length for $pin when calling SubSignatureRequestSigner., must be smaller than or equal to 12.'); } - if (!is_null($pin) && (mb_strlen($pin) < 4)) { + if (mb_strlen($pin) < 4) { throw new InvalidArgumentException('invalid length for $pin when calling SubSignatureRequestSigner., must be bigger than or equal to 4.'); } @@ -414,6 +510,9 @@ public function getSmsPhoneNumber() */ public function setSmsPhoneNumber(?string $sms_phone_number) { + if (is_null($sms_phone_number)) { + throw new InvalidArgumentException('non-nullable sms_phone_number cannot be null'); + } $this->container['sms_phone_number'] = $sms_phone_number; return $this; @@ -438,8 +537,11 @@ public function getSmsPhoneNumberType() */ public function setSmsPhoneNumberType(?string $sms_phone_number_type) { + if (is_null($sms_phone_number_type)) { + throw new InvalidArgumentException('non-nullable sms_phone_number_type cannot be null'); + } $allowedValues = $this->getSmsPhoneNumberTypeAllowableValues(); - if (!is_null($sms_phone_number_type) && !in_array($sms_phone_number_type, $allowedValues, true)) { + if (!in_array($sms_phone_number_type, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'sms_phone_number_type', must be one of '%s'", @@ -456,12 +558,10 @@ public function setSmsPhoneNumberType(?string $sms_phone_number_type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -469,7 +569,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -482,13 +582,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -500,12 +598,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -514,8 +610,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -532,7 +628,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php index d0c2f7c9a..664e84af7 100644 --- a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * SubSignatureRequestTemplateSigner Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubSignatureRequestTemplateSigner implements ModelInterface, ArrayAccess, JsonSerializable { @@ -85,6 +81,27 @@ class SubSignatureRequestTemplateSigner implements ModelInterface, ArrayAccess, 'sms_phone_number_type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'role' => false, + 'name' => false, + 'email_address' => false, + 'pin' => false, + 'sms_phone_number' => false, + 'sms_phone_number_type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -208,42 +269,58 @@ public function getSmsPhoneNumberTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['role'] = $data['role'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['pin'] = $data['pin'] ?? null; - $this->container['sms_phone_number'] = $data['sms_phone_number'] ?? null; - $this->container['sms_phone_number_type'] = $data['sms_phone_number_type'] ?? null; + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('pin', $data ?? [], null); + $this->setIfExists('sms_phone_number', $data ?? [], null); + $this->setIfExists('sms_phone_number_type', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubSignatureRequestTemplateSigner { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubSignatureRequestTemplateSigner { /** @var SubSignatureRequestTemplateSigner $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubSignatureRequestTemplateSigner::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -314,6 +391,9 @@ public function getRole() */ public function setRole(string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -338,6 +418,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -362,6 +445,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -386,10 +472,13 @@ public function getPin() */ public function setPin(?string $pin) { - if (!is_null($pin) && (mb_strlen($pin) > 12)) { + if (is_null($pin)) { + throw new InvalidArgumentException('non-nullable pin cannot be null'); + } + if (mb_strlen($pin) > 12) { throw new InvalidArgumentException('invalid length for $pin when calling SubSignatureRequestTemplateSigner., must be smaller than or equal to 12.'); } - if (!is_null($pin) && (mb_strlen($pin) < 4)) { + if (mb_strlen($pin) < 4) { throw new InvalidArgumentException('invalid length for $pin when calling SubSignatureRequestTemplateSigner., must be bigger than or equal to 4.'); } @@ -417,6 +506,9 @@ public function getSmsPhoneNumber() */ public function setSmsPhoneNumber(?string $sms_phone_number) { + if (is_null($sms_phone_number)) { + throw new InvalidArgumentException('non-nullable sms_phone_number cannot be null'); + } $this->container['sms_phone_number'] = $sms_phone_number; return $this; @@ -441,8 +533,11 @@ public function getSmsPhoneNumberType() */ public function setSmsPhoneNumberType(?string $sms_phone_number_type) { + if (is_null($sms_phone_number_type)) { + throw new InvalidArgumentException('non-nullable sms_phone_number_type cannot be null'); + } $allowedValues = $this->getSmsPhoneNumberTypeAllowableValues(); - if (!is_null($sms_phone_number_type) && !in_array($sms_phone_number_type, $allowedValues, true)) { + if (!in_array($sms_phone_number_type, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'sms_phone_number_type', must be one of '%s'", @@ -459,12 +554,10 @@ public function setSmsPhoneNumberType(?string $sms_phone_number_type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -472,7 +565,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -485,13 +578,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -503,12 +594,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -517,8 +606,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -535,7 +624,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubSigningOptions.php b/sdks/php/src/Model/SubSigningOptions.php index d6151831f..d8547cdb7 100644 --- a/sdks/php/src/Model/SubSigningOptions.php +++ b/sdks/php/src/Model/SubSigningOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * * @category Class * @description This allows the requester to specify the types allowed for creating a signature. **NOTE:** If `signing_options` are not defined in the request, the allowed types will default to those specified in the account settings. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubSigningOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -84,6 +80,26 @@ class SubSigningOptions implements ModelInterface, ArrayAccess, JsonSerializable 'upload' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'default_type' => false, + 'draw' => false, + 'phone' => false, + 'type' => false, + 'upload' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -104,6 +120,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -208,41 +268,57 @@ public function getDefaultTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['default_type'] = $data['default_type'] ?? null; - $this->container['draw'] = $data['draw'] ?? false; - $this->container['phone'] = $data['phone'] ?? false; - $this->container['type'] = $data['type'] ?? false; - $this->container['upload'] = $data['upload'] ?? false; + $this->setIfExists('default_type', $data ?? [], null); + $this->setIfExists('draw', $data ?? [], false); + $this->setIfExists('phone', $data ?? [], false); + $this->setIfExists('type', $data ?? [], false); + $this->setIfExists('upload', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubSigningOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubSigningOptions { /** @var SubSigningOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubSigningOptions::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -299,6 +375,9 @@ public function getDefaultType() */ public function setDefaultType(string $default_type) { + if (is_null($default_type)) { + throw new InvalidArgumentException('non-nullable default_type cannot be null'); + } $allowedValues = $this->getDefaultTypeAllowableValues(); if (!in_array($default_type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -333,6 +412,9 @@ public function getDraw() */ public function setDraw(?bool $draw) { + if (is_null($draw)) { + throw new InvalidArgumentException('non-nullable draw cannot be null'); + } $this->container['draw'] = $draw; return $this; @@ -357,6 +439,9 @@ public function getPhone() */ public function setPhone(?bool $phone) { + if (is_null($phone)) { + throw new InvalidArgumentException('non-nullable phone cannot be null'); + } $this->container['phone'] = $phone; return $this; @@ -381,6 +466,9 @@ public function getType() */ public function setType(?bool $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -405,6 +493,9 @@ public function getUpload() */ public function setUpload(?bool $upload) { + if (is_null($upload)) { + throw new InvalidArgumentException('non-nullable upload cannot be null'); + } $this->container['upload'] = $upload; return $this; @@ -413,12 +504,10 @@ public function setUpload(?bool $upload) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -426,7 +515,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -439,13 +528,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -457,12 +544,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -471,8 +556,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -489,7 +574,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubTeamResponse.php b/sdks/php/src/Model/SubTeamResponse.php index da57cfff9..2a5aa4822 100644 --- a/sdks/php/src/Model/SubTeamResponse.php +++ b/sdks/php/src/Model/SubTeamResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * SubTeamResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class SubTeamResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class SubTeamResponse implements ModelInterface, ArrayAccess, JsonSerializable 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team_id' => false, + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team_id'] = $data['team_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('team_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubTeamResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubTeamResponse { /** @var SubTeamResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubTeamResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): SubTeamResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTeamId() */ public function setTeamId(?string $team_id) { + if (is_null($team_id)) { + throw new InvalidArgumentException('non-nullable team_id cannot be null'); + } $this->container['team_id'] = $team_id; return $this; @@ -272,6 +346,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -280,12 +357,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubTemplateRole.php b/sdks/php/src/Model/SubTemplateRole.php index 399c64b2b..b5bab34f9 100644 --- a/sdks/php/src/Model/SubTemplateRole.php +++ b/sdks/php/src/Model/SubTemplateRole.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubTemplateRole Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubTemplateRole implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class SubTemplateRole implements ModelInterface, ArrayAccess, JsonSerializable 'order' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'order' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['order'] = $data['order'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubTemplateRole { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubTemplateRole { /** @var SubTemplateRole $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubTemplateRole::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -212,9 +286,7 @@ public static function init(array $data): SubTemplateRole */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -247,6 +319,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -271,6 +346,16 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['order'] = $order; return $this; @@ -279,12 +364,10 @@ public function setOrder(?int $order) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -292,7 +375,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -305,13 +388,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -323,12 +404,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -337,8 +416,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -355,7 +434,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubUnclaimedDraftSigner.php b/sdks/php/src/Model/SubUnclaimedDraftSigner.php index 646a6454f..ecb101c45 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftSigner.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubUnclaimedDraftSigner Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubUnclaimedDraftSigner implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class SubUnclaimedDraftSigner implements ModelInterface, ArrayAccess, JsonSerial 'order' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + 'name' => false, + 'order' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['order'] = $data['order'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubUnclaimedDraftSigner { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubUnclaimedDraftSigner { /** @var SubUnclaimedDraftSigner $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubUnclaimedDraftSigner::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +301,6 @@ public function listInvalidProperties() if ($this->container['name'] === null) { $invalidProperties[] = "'name' can't be null"; } - return $invalidProperties; } @@ -260,6 +334,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -284,6 +361,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -308,6 +388,16 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + array_push($this->openAPINullablesSetToNull, 'order'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('order', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['order'] = $order; return $this; @@ -316,12 +406,10 @@ public function setOrder(?int $order) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -329,7 +417,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -342,13 +430,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -360,12 +446,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -374,8 +458,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -392,7 +476,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php index f55a46edf..f5ce064ac 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * SubUnclaimedDraftTemplateSigner Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubUnclaimedDraftTemplateSigner implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class SubUnclaimedDraftTemplateSigner implements ModelInterface, ArrayAccess, Js 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'role' => false, + 'name' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['role'] = $data['role'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubUnclaimedDraftTemplateSigner { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubUnclaimedDraftTemplateSigner { /** @var SubUnclaimedDraftTemplateSigner $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubUnclaimedDraftTemplateSigner::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +304,6 @@ public function listInvalidProperties() if ($this->container['email_address'] === null) { $invalidProperties[] = "'email_address' can't be null"; } - return $invalidProperties; } @@ -263,6 +337,9 @@ public function getRole() */ public function setRole(string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -287,6 +364,9 @@ public function getName() */ public function setName(string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -311,6 +391,9 @@ public function getEmailAddress() */ public function setEmailAddress(string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -319,12 +402,10 @@ public function setEmailAddress(string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -332,7 +413,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -345,13 +426,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -363,12 +442,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -377,8 +454,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -395,7 +472,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/SubWhiteLabelingOptions.php b/sdks/php/src/Model/SubWhiteLabelingOptions.php index abed8147c..2487bbfd0 100644 --- a/sdks/php/src/Model/SubWhiteLabelingOptions.php +++ b/sdks/php/src/Model/SubWhiteLabelingOptions.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * * @category Class * @description An array of elements and values serialized to a string, to be used to customize the app's signer page. (Only applies to some API plans) Take a look at our [white labeling guide](https://developers.hellosign.com/api/reference/premium-branding/) to learn more. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class SubWhiteLabelingOptions implements ModelInterface, ArrayAccess, JsonSerializable { @@ -104,6 +100,36 @@ class SubWhiteLabelingOptions implements ModelInterface, ArrayAccess, JsonSerial 'reset_to_default' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'header_background_color' => false, + 'legal_version' => false, + 'link_color' => false, + 'page_background_color' => false, + 'primary_button_color' => false, + 'primary_button_color_hover' => false, + 'primary_button_text_color' => false, + 'primary_button_text_color_hover' => false, + 'secondary_button_color' => false, + 'secondary_button_color_hover' => false, + 'secondary_button_text_color' => false, + 'secondary_button_text_color_hover' => false, + 'text_color1' => false, + 'text_color2' => false, + 'reset_to_default' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -124,6 +150,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -254,51 +324,67 @@ public function getLegalVersionAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['header_background_color'] = $data['header_background_color'] ?? '#1A1A1A'; - $this->container['legal_version'] = $data['legal_version'] ?? 'terms1'; - $this->container['link_color'] = $data['link_color'] ?? '#00B3E6'; - $this->container['page_background_color'] = $data['page_background_color'] ?? '#F7F8F9'; - $this->container['primary_button_color'] = $data['primary_button_color'] ?? '#00B3E6'; - $this->container['primary_button_color_hover'] = $data['primary_button_color_hover'] ?? '#00B3E6'; - $this->container['primary_button_text_color'] = $data['primary_button_text_color'] ?? '#FFFFFF'; - $this->container['primary_button_text_color_hover'] = $data['primary_button_text_color_hover'] ?? '#FFFFFF'; - $this->container['secondary_button_color'] = $data['secondary_button_color'] ?? '#FFFFFF'; - $this->container['secondary_button_color_hover'] = $data['secondary_button_color_hover'] ?? '#FFFFFF'; - $this->container['secondary_button_text_color'] = $data['secondary_button_text_color'] ?? '#00B3E6'; - $this->container['secondary_button_text_color_hover'] = $data['secondary_button_text_color_hover'] ?? '#00B3E6'; - $this->container['text_color1'] = $data['text_color1'] ?? '#808080'; - $this->container['text_color2'] = $data['text_color2'] ?? '#FFFFFF'; - $this->container['reset_to_default'] = $data['reset_to_default'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('header_background_color', $data ?? [], '#1A1A1A'); + $this->setIfExists('legal_version', $data ?? [], 'terms1'); + $this->setIfExists('link_color', $data ?? [], '#00B3E6'); + $this->setIfExists('page_background_color', $data ?? [], '#F7F8F9'); + $this->setIfExists('primary_button_color', $data ?? [], '#00B3E6'); + $this->setIfExists('primary_button_color_hover', $data ?? [], '#00B3E6'); + $this->setIfExists('primary_button_text_color', $data ?? [], '#FFFFFF'); + $this->setIfExists('primary_button_text_color_hover', $data ?? [], '#FFFFFF'); + $this->setIfExists('secondary_button_color', $data ?? [], '#FFFFFF'); + $this->setIfExists('secondary_button_color_hover', $data ?? [], '#FFFFFF'); + $this->setIfExists('secondary_button_text_color', $data ?? [], '#00B3E6'); + $this->setIfExists('secondary_button_text_color_hover', $data ?? [], '#00B3E6'); + $this->setIfExists('text_color1', $data ?? [], '#808080'); + $this->setIfExists('text_color2', $data ?? [], '#FFFFFF'); + $this->setIfExists('reset_to_default', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): SubWhiteLabelingOptions { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): SubWhiteLabelingOptions { /** @var SubWhiteLabelingOptions $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, SubWhiteLabelingOptions::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -352,6 +438,9 @@ public function getHeaderBackgroundColor() */ public function setHeaderBackgroundColor(?string $header_background_color) { + if (is_null($header_background_color)) { + throw new InvalidArgumentException('non-nullable header_background_color cannot be null'); + } $this->container['header_background_color'] = $header_background_color; return $this; @@ -376,8 +465,11 @@ public function getLegalVersion() */ public function setLegalVersion(?string $legal_version) { + if (is_null($legal_version)) { + throw new InvalidArgumentException('non-nullable legal_version cannot be null'); + } $allowedValues = $this->getLegalVersionAllowableValues(); - if (!is_null($legal_version) && !in_array($legal_version, $allowedValues, true)) { + if (!in_array($legal_version, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'legal_version', must be one of '%s'", @@ -410,6 +502,9 @@ public function getLinkColor() */ public function setLinkColor(?string $link_color) { + if (is_null($link_color)) { + throw new InvalidArgumentException('non-nullable link_color cannot be null'); + } $this->container['link_color'] = $link_color; return $this; @@ -434,6 +529,9 @@ public function getPageBackgroundColor() */ public function setPageBackgroundColor(?string $page_background_color) { + if (is_null($page_background_color)) { + throw new InvalidArgumentException('non-nullable page_background_color cannot be null'); + } $this->container['page_background_color'] = $page_background_color; return $this; @@ -458,6 +556,9 @@ public function getPrimaryButtonColor() */ public function setPrimaryButtonColor(?string $primary_button_color) { + if (is_null($primary_button_color)) { + throw new InvalidArgumentException('non-nullable primary_button_color cannot be null'); + } $this->container['primary_button_color'] = $primary_button_color; return $this; @@ -482,6 +583,9 @@ public function getPrimaryButtonColorHover() */ public function setPrimaryButtonColorHover(?string $primary_button_color_hover) { + if (is_null($primary_button_color_hover)) { + throw new InvalidArgumentException('non-nullable primary_button_color_hover cannot be null'); + } $this->container['primary_button_color_hover'] = $primary_button_color_hover; return $this; @@ -506,6 +610,9 @@ public function getPrimaryButtonTextColor() */ public function setPrimaryButtonTextColor(?string $primary_button_text_color) { + if (is_null($primary_button_text_color)) { + throw new InvalidArgumentException('non-nullable primary_button_text_color cannot be null'); + } $this->container['primary_button_text_color'] = $primary_button_text_color; return $this; @@ -530,6 +637,9 @@ public function getPrimaryButtonTextColorHover() */ public function setPrimaryButtonTextColorHover(?string $primary_button_text_color_hover) { + if (is_null($primary_button_text_color_hover)) { + throw new InvalidArgumentException('non-nullable primary_button_text_color_hover cannot be null'); + } $this->container['primary_button_text_color_hover'] = $primary_button_text_color_hover; return $this; @@ -554,6 +664,9 @@ public function getSecondaryButtonColor() */ public function setSecondaryButtonColor(?string $secondary_button_color) { + if (is_null($secondary_button_color)) { + throw new InvalidArgumentException('non-nullable secondary_button_color cannot be null'); + } $this->container['secondary_button_color'] = $secondary_button_color; return $this; @@ -578,6 +691,9 @@ public function getSecondaryButtonColorHover() */ public function setSecondaryButtonColorHover(?string $secondary_button_color_hover) { + if (is_null($secondary_button_color_hover)) { + throw new InvalidArgumentException('non-nullable secondary_button_color_hover cannot be null'); + } $this->container['secondary_button_color_hover'] = $secondary_button_color_hover; return $this; @@ -602,6 +718,9 @@ public function getSecondaryButtonTextColor() */ public function setSecondaryButtonTextColor(?string $secondary_button_text_color) { + if (is_null($secondary_button_text_color)) { + throw new InvalidArgumentException('non-nullable secondary_button_text_color cannot be null'); + } $this->container['secondary_button_text_color'] = $secondary_button_text_color; return $this; @@ -626,6 +745,9 @@ public function getSecondaryButtonTextColorHover() */ public function setSecondaryButtonTextColorHover(?string $secondary_button_text_color_hover) { + if (is_null($secondary_button_text_color_hover)) { + throw new InvalidArgumentException('non-nullable secondary_button_text_color_hover cannot be null'); + } $this->container['secondary_button_text_color_hover'] = $secondary_button_text_color_hover; return $this; @@ -650,6 +772,9 @@ public function getTextColor1() */ public function setTextColor1(?string $text_color1) { + if (is_null($text_color1)) { + throw new InvalidArgumentException('non-nullable text_color1 cannot be null'); + } $this->container['text_color1'] = $text_color1; return $this; @@ -674,6 +799,9 @@ public function getTextColor2() */ public function setTextColor2(?string $text_color2) { + if (is_null($text_color2)) { + throw new InvalidArgumentException('non-nullable text_color2 cannot be null'); + } $this->container['text_color2'] = $text_color2; return $this; @@ -698,6 +826,9 @@ public function getResetToDefault() */ public function setResetToDefault(?bool $reset_to_default) { + if (is_null($reset_to_default)) { + throw new InvalidArgumentException('non-nullable reset_to_default cannot be null'); + } $this->container['reset_to_default'] = $reset_to_default; return $this; @@ -706,12 +837,10 @@ public function setResetToDefault(?bool $reset_to_default) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -719,7 +848,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -732,13 +861,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -750,12 +877,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -764,8 +889,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -782,7 +907,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamAddMemberRequest.php b/sdks/php/src/Model/TeamAddMemberRequest.php index 1caf129bf..ccbeb33de 100644 --- a/sdks/php/src/Model/TeamAddMemberRequest.php +++ b/sdks/php/src/Model/TeamAddMemberRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * TeamAddMemberRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TeamAddMemberRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class TeamAddMemberRequest implements ModelInterface, ArrayAccess, JsonSerializa 'role' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'role' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -197,39 +255,55 @@ public function getRoleAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['role'] = $data['role'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamAddMemberRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamAddMemberRequest { /** @var TeamAddMemberRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamAddMemberRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -283,6 +357,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -307,6 +384,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -331,8 +411,11 @@ public function getRole() */ public function setRole(?string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $allowedValues = $this->getRoleAllowableValues(); - if (!is_null($role) && !in_array($role, $allowedValues, true)) { + if (!in_array($role, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'role', must be one of '%s'", @@ -349,12 +432,10 @@ public function setRole(?string $role) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -362,7 +443,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -375,13 +456,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -393,12 +472,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -407,8 +484,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -425,7 +502,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamCreateRequest.php b/sdks/php/src/Model/TeamCreateRequest.php index ad51504c4..c5b13041c 100644 --- a/sdks/php/src/Model/TeamCreateRequest.php +++ b/sdks/php/src/Model/TeamCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * TeamCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TeamCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class TeamCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? 'Untitled Team'; + $this->setIfExists('name', $data ?? [], 'Untitled Team'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamCreateRequest { /** @var TeamCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamCreateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -206,9 +279,7 @@ public static function init(array $data): TeamCreateRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -241,6 +312,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -249,12 +323,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -262,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -275,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -293,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -307,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -325,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamGetInfoResponse.php b/sdks/php/src/Model/TeamGetInfoResponse.php index d46fb6e9c..3a8cef425 100644 --- a/sdks/php/src/Model/TeamGetInfoResponse.php +++ b/sdks/php/src/Model/TeamGetInfoResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamGetInfoResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamGetInfoResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TeamGetInfoResponse implements ModelInterface, ArrayAccess, JsonSerializab 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team'] = $data['team'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('team', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamGetInfoResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamGetInfoResponse { /** @var TeamGetInfoResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamGetInfoResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TeamGetInfoResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTeam() */ public function setTeam(?TeamInfoResponse $team) { + if (is_null($team)) { + throw new InvalidArgumentException('non-nullable team cannot be null'); + } $this->container['team'] = $team; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamGetResponse.php b/sdks/php/src/Model/TeamGetResponse.php index 0ff83b21a..23e6d47f3 100644 --- a/sdks/php/src/Model/TeamGetResponse.php +++ b/sdks/php/src/Model/TeamGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TeamGetResponse implements ModelInterface, ArrayAccess, JsonSerializable 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team'] = $data['team'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('team', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamGetResponse { /** @var TeamGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamGetResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TeamGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTeam() */ public function setTeam(?TeamResponse $team) { + if (is_null($team)) { + throw new InvalidArgumentException('non-nullable team cannot be null'); + } $this->container['team'] = $team; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamInfoResponse.php b/sdks/php/src/Model/TeamInfoResponse.php index 782008377..f17965833 100644 --- a/sdks/php/src/Model/TeamInfoResponse.php +++ b/sdks/php/src/Model/TeamInfoResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamInfoResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamInfoResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -83,6 +79,26 @@ class TeamInfoResponse implements ModelInterface, ArrayAccess, JsonSerializable 'num_sub_teams' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team_id' => false, + 'team_parent' => true, + 'name' => false, + 'num_members' => false, + 'num_sub_teams' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +119,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -187,41 +247,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team_id'] = $data['team_id'] ?? null; - $this->container['team_parent'] = $data['team_parent'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['num_members'] = $data['num_members'] ?? null; - $this->container['num_sub_teams'] = $data['num_sub_teams'] ?? null; + $this->setIfExists('team_id', $data ?? [], null); + $this->setIfExists('team_parent', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('num_members', $data ?? [], null); + $this->setIfExists('num_sub_teams', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamInfoResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamInfoResponse { /** @var TeamInfoResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamInfoResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -231,9 +307,7 @@ public static function init(array $data): TeamInfoResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -266,6 +340,9 @@ public function getTeamId() */ public function setTeamId(?string $team_id) { + if (is_null($team_id)) { + throw new InvalidArgumentException('non-nullable team_id cannot be null'); + } $this->container['team_id'] = $team_id; return $this; @@ -290,6 +367,16 @@ public function getTeamParent() */ public function setTeamParent(?TeamParentResponse $team_parent) { + if (is_null($team_parent)) { + array_push($this->openAPINullablesSetToNull, 'team_parent'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('team_parent', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['team_parent'] = $team_parent; return $this; @@ -314,6 +401,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -338,6 +428,9 @@ public function getNumMembers() */ public function setNumMembers(?int $num_members) { + if (is_null($num_members)) { + throw new InvalidArgumentException('non-nullable num_members cannot be null'); + } $this->container['num_members'] = $num_members; return $this; @@ -362,6 +455,9 @@ public function getNumSubTeams() */ public function setNumSubTeams(?int $num_sub_teams) { + if (is_null($num_sub_teams)) { + throw new InvalidArgumentException('non-nullable num_sub_teams cannot be null'); + } $this->container['num_sub_teams'] = $num_sub_teams; return $this; @@ -370,12 +466,10 @@ public function setNumSubTeams(?int $num_sub_teams) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -383,7 +477,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -396,13 +490,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -414,12 +506,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -428,8 +518,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -446,7 +536,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamInviteResponse.php b/sdks/php/src/Model/TeamInviteResponse.php index 40a9b7a11..61ae10e80 100644 --- a/sdks/php/src/Model/TeamInviteResponse.php +++ b/sdks/php/src/Model/TeamInviteResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamInviteResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamInviteResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -85,6 +81,27 @@ class TeamInviteResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'email_address' => false, + 'team_id' => false, + 'role' => false, + 'sent_at' => false, + 'redeemed_at' => false, + 'expires_at' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -192,42 +253,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['team_id'] = $data['team_id'] ?? null; - $this->container['role'] = $data['role'] ?? null; - $this->container['sent_at'] = $data['sent_at'] ?? null; - $this->container['redeemed_at'] = $data['redeemed_at'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('team_id', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('sent_at', $data ?? [], null); + $this->setIfExists('redeemed_at', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamInviteResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamInviteResponse { /** @var TeamInviteResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamInviteResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -237,9 +314,7 @@ public static function init(array $data): TeamInviteResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -272,6 +347,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -296,6 +374,9 @@ public function getTeamId() */ public function setTeamId(?string $team_id) { + if (is_null($team_id)) { + throw new InvalidArgumentException('non-nullable team_id cannot be null'); + } $this->container['team_id'] = $team_id; return $this; @@ -320,6 +401,9 @@ public function getRole() */ public function setRole(?string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -344,6 +428,9 @@ public function getSentAt() */ public function setSentAt(?int $sent_at) { + if (is_null($sent_at)) { + throw new InvalidArgumentException('non-nullable sent_at cannot be null'); + } $this->container['sent_at'] = $sent_at; return $this; @@ -368,6 +455,9 @@ public function getRedeemedAt() */ public function setRedeemedAt(?int $redeemed_at) { + if (is_null($redeemed_at)) { + throw new InvalidArgumentException('non-nullable redeemed_at cannot be null'); + } $this->container['redeemed_at'] = $redeemed_at; return $this; @@ -392,6 +482,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -400,12 +493,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -413,7 +504,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -426,13 +517,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -444,12 +533,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -458,8 +545,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -476,7 +563,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamInvitesResponse.php b/sdks/php/src/Model/TeamInvitesResponse.php index 5dc9d0247..79d213fc4 100644 --- a/sdks/php/src/Model/TeamInvitesResponse.php +++ b/sdks/php/src/Model/TeamInvitesResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamInvitesResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamInvitesResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TeamInvitesResponse implements ModelInterface, ArrayAccess, JsonSerializab 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team_invites' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team_invites'] = $data['team_invites'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('team_invites', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamInvitesResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamInvitesResponse { /** @var TeamInvitesResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamInvitesResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TeamInvitesResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTeamInvites() */ public function setTeamInvites(?array $team_invites) { + if (is_null($team_invites)) { + throw new InvalidArgumentException('non-nullable team_invites cannot be null'); + } $this->container['team_invites'] = $team_invites; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamMemberResponse.php b/sdks/php/src/Model/TeamMemberResponse.php index db3be66f3..394f3c397 100644 --- a/sdks/php/src/Model/TeamMemberResponse.php +++ b/sdks/php/src/Model/TeamMemberResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamMemberResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamMemberResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class TeamMemberResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'role' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'role' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['role'] = $data['role'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamMemberResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamMemberResponse { /** @var TeamMemberResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamMemberResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): TeamMemberResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -278,6 +353,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -302,6 +380,9 @@ public function getRole() */ public function setRole(?string $role) { + if (is_null($role)) { + throw new InvalidArgumentException('non-nullable role cannot be null'); + } $this->container['role'] = $role; return $this; @@ -310,12 +391,10 @@ public function setRole(?string $role) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamMembersResponse.php b/sdks/php/src/Model/TeamMembersResponse.php index 0c2d6f2f8..02def6040 100644 --- a/sdks/php/src/Model/TeamMembersResponse.php +++ b/sdks/php/src/Model/TeamMembersResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamMembersResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamMembersResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class TeamMembersResponse implements ModelInterface, ArrayAccess, JsonSerializab 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team_members' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team_members'] = $data['team_members'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('team_members', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamMembersResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamMembersResponse { /** @var TeamMembersResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamMembersResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): TeamMembersResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getTeamMembers() */ public function setTeamMembers(?array $team_members) { + if (is_null($team_members)) { + throw new InvalidArgumentException('non-nullable team_members cannot be null'); + } $this->container['team_members'] = $team_members; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamParentResponse.php b/sdks/php/src/Model/TeamParentResponse.php index 36a50d9a8..08f085d35 100644 --- a/sdks/php/src/Model/TeamParentResponse.php +++ b/sdks/php/src/Model/TeamParentResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Information about the parent team if a team has one, set to `null` otherwise. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamParentResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class TeamParentResponse implements ModelInterface, ArrayAccess, JsonSerializabl 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'team_id' => false, + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['team_id'] = $data['team_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('team_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamParentResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamParentResponse { /** @var TeamParentResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamParentResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): TeamParentResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getTeamId() */ public function setTeamId(?string $team_id) { + if (is_null($team_id)) { + throw new InvalidArgumentException('non-nullable team_id cannot be null'); + } $this->container['team_id'] = $team_id; return $this; @@ -273,6 +347,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -281,12 +358,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamRemoveMemberRequest.php b/sdks/php/src/Model/TeamRemoveMemberRequest.php index bb8bc2d34..723cde1d1 100644 --- a/sdks/php/src/Model/TeamRemoveMemberRequest.php +++ b/sdks/php/src/Model/TeamRemoveMemberRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * TeamRemoveMemberRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TeamRemoveMemberRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -83,6 +79,26 @@ class TeamRemoveMemberRequest implements ModelInterface, ArrayAccess, JsonSerial 'new_role' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'new_owner_email_address' => false, + 'new_team_id' => false, + 'new_role' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -103,6 +119,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -207,41 +267,57 @@ public function getNewRoleAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['new_owner_email_address'] = $data['new_owner_email_address'] ?? null; - $this->container['new_team_id'] = $data['new_team_id'] ?? null; - $this->container['new_role'] = $data['new_role'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('new_owner_email_address', $data ?? [], null); + $this->setIfExists('new_team_id', $data ?? [], null); + $this->setIfExists('new_role', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamRemoveMemberRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamRemoveMemberRequest { /** @var TeamRemoveMemberRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamRemoveMemberRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -295,6 +371,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -319,6 +398,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -343,6 +425,9 @@ public function getNewOwnerEmailAddress() */ public function setNewOwnerEmailAddress(?string $new_owner_email_address) { + if (is_null($new_owner_email_address)) { + throw new InvalidArgumentException('non-nullable new_owner_email_address cannot be null'); + } $this->container['new_owner_email_address'] = $new_owner_email_address; return $this; @@ -367,6 +452,9 @@ public function getNewTeamId() */ public function setNewTeamId(?string $new_team_id) { + if (is_null($new_team_id)) { + throw new InvalidArgumentException('non-nullable new_team_id cannot be null'); + } $this->container['new_team_id'] = $new_team_id; return $this; @@ -391,8 +479,11 @@ public function getNewRole() */ public function setNewRole(?string $new_role) { + if (is_null($new_role)) { + throw new InvalidArgumentException('non-nullable new_role cannot be null'); + } $allowedValues = $this->getNewRoleAllowableValues(); - if (!is_null($new_role) && !in_array($new_role, $allowedValues, true)) { + if (!in_array($new_role, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'new_role', must be one of '%s'", @@ -409,12 +500,10 @@ public function setNewRole(?string $new_role) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -422,7 +511,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -435,13 +524,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -453,12 +540,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -467,8 +552,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -485,7 +570,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamResponse.php b/sdks/php/src/Model/TeamResponse.php index 5287609f0..89f6b4488 100644 --- a/sdks/php/src/Model/TeamResponse.php +++ b/sdks/php/src/Model/TeamResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains information about your team and its members - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class TeamResponse implements ModelInterface, ArrayAccess, JsonSerializable 'invited_emails' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'accounts' => false, + 'invited_accounts' => false, + 'invited_emails' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['accounts'] = $data['accounts'] ?? null; - $this->container['invited_accounts'] = $data['invited_accounts'] ?? null; - $this->container['invited_emails'] = $data['invited_emails'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('accounts', $data ?? [], null); + $this->setIfExists('invited_accounts', $data ?? [], null); + $this->setIfExists('invited_emails', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamResponse { /** @var TeamResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): TeamResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -285,6 +361,9 @@ public function getAccounts() */ public function setAccounts(?array $accounts) { + if (is_null($accounts)) { + throw new InvalidArgumentException('non-nullable accounts cannot be null'); + } $this->container['accounts'] = $accounts; return $this; @@ -309,6 +388,9 @@ public function getInvitedAccounts() */ public function setInvitedAccounts(?array $invited_accounts) { + if (is_null($invited_accounts)) { + throw new InvalidArgumentException('non-nullable invited_accounts cannot be null'); + } $this->container['invited_accounts'] = $invited_accounts; return $this; @@ -333,6 +415,9 @@ public function getInvitedEmails() */ public function setInvitedEmails(?array $invited_emails) { + if (is_null($invited_emails)) { + throw new InvalidArgumentException('non-nullable invited_emails cannot be null'); + } $this->container['invited_emails'] = $invited_emails; return $this; @@ -341,12 +426,10 @@ public function setInvitedEmails(?array $invited_emails) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -354,7 +437,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -367,13 +450,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -385,12 +466,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -399,8 +478,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -417,7 +496,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamSubTeamsResponse.php b/sdks/php/src/Model/TeamSubTeamsResponse.php index 3e9a646be..e4a357ef3 100644 --- a/sdks/php/src/Model/TeamSubTeamsResponse.php +++ b/sdks/php/src/Model/TeamSubTeamsResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TeamSubTeamsResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TeamSubTeamsResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class TeamSubTeamsResponse implements ModelInterface, ArrayAccess, JsonSerializa 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'sub_teams' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['sub_teams'] = $data['sub_teams'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('sub_teams', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamSubTeamsResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamSubTeamsResponse { /** @var TeamSubTeamsResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamSubTeamsResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): TeamSubTeamsResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getSubTeams() */ public function setSubTeams(?array $sub_teams) { + if (is_null($sub_teams)) { + throw new InvalidArgumentException('non-nullable sub_teams cannot be null'); + } $this->container['sub_teams'] = $sub_teams; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TeamUpdateRequest.php b/sdks/php/src/Model/TeamUpdateRequest.php index 08f5760dc..1cdb41939 100644 --- a/sdks/php/src/Model/TeamUpdateRequest.php +++ b/sdks/php/src/Model/TeamUpdateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * TeamUpdateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TeamUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class TeamUpdateRequest implements ModelInterface, ArrayAccess, JsonSerializable 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TeamUpdateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TeamUpdateRequest { /** @var TeamUpdateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TeamUpdateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -206,9 +279,7 @@ public static function init(array $data): TeamUpdateRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -241,6 +312,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -249,12 +323,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -262,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -275,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -293,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -307,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -325,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateAddUserRequest.php b/sdks/php/src/Model/TemplateAddUserRequest.php index eb131d57b..eb696a8b1 100644 --- a/sdks/php/src/Model/TemplateAddUserRequest.php +++ b/sdks/php/src/Model/TemplateAddUserRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * TemplateAddUserRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateAddUserRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class TemplateAddUserRequest implements ModelInterface, ArrayAccess, JsonSeriali 'skip_notification' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'skip_notification' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['skip_notification'] = $data['skip_notification'] ?? false; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('skip_notification', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateAddUserRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateAddUserRequest { /** @var TemplateAddUserRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateAddUserRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -218,9 +293,7 @@ public static function init(array $data): TemplateAddUserRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -253,6 +326,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -277,6 +353,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -301,6 +380,9 @@ public function getSkipNotification() */ public function setSkipNotification(?bool $skip_notification) { + if (is_null($skip_notification)) { + throw new InvalidArgumentException('non-nullable skip_notification cannot be null'); + } $this->container['skip_notification'] = $skip_notification; return $this; @@ -309,12 +391,10 @@ public function setSkipNotification(?bool $skip_notification) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -322,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -335,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -353,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -367,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -385,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php index 83b3dcd3a..cfb6d0ca1 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * TemplateCreateEmbeddedDraftRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateCreateEmbeddedDraftRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -124,6 +120,46 @@ class TemplateCreateEmbeddedDraftRequest implements ModelInterface, ArrayAccess, 'use_preexisting_fields' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'files' => false, + 'file_urls' => false, + 'allow_ccs' => false, + 'allow_reassign' => false, + 'attachments' => false, + 'cc_roles' => false, + 'editor_options' => false, + 'field_options' => false, + 'force_signer_roles' => false, + 'force_subject_message' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'form_fields_per_document' => false, + 'merge_fields' => false, + 'message' => false, + 'metadata' => false, + 'show_preview' => false, + 'show_progress_stepper' => false, + 'signer_roles' => false, + 'skip_me_now' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'use_preexisting_fields' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -144,6 +180,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -288,61 +368,77 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['allow_ccs'] = $data['allow_ccs'] ?? true; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_roles'] = $data['cc_roles'] ?? null; - $this->container['editor_options'] = $data['editor_options'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['force_signer_roles'] = $data['force_signer_roles'] ?? false; - $this->container['force_subject_message'] = $data['force_subject_message'] ?? false; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['merge_fields'] = $data['merge_fields'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['show_preview'] = $data['show_preview'] ?? false; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['signer_roles'] = $data['signer_roles'] ?? null; - $this->container['skip_me_now'] = $data['skip_me_now'] ?? false; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['use_preexisting_fields'] = $data['use_preexisting_fields'] ?? false; - } - - /** @deprecated use ::init() */ + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('allow_ccs', $data ?? [], true); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_roles', $data ?? [], null); + $this->setIfExists('editor_options', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('force_signer_roles', $data ?? [], false); + $this->setIfExists('force_subject_message', $data ?? [], false); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('merge_fields', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('show_preview', $data ?? [], false); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('signer_roles', $data ?? [], null); + $this->setIfExists('skip_me_now', $data ?? [], false); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('use_preexisting_fields', $data ?? [], false); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateEmbeddedDraftRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateEmbeddedDraftRequest { /** @var TemplateCreateEmbeddedDraftRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -398,6 +494,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -422,6 +521,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -446,6 +548,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -470,6 +575,9 @@ public function getAllowCcs() */ public function setAllowCcs(?bool $allow_ccs) { + if (is_null($allow_ccs)) { + throw new InvalidArgumentException('non-nullable allow_ccs cannot be null'); + } $this->container['allow_ccs'] = $allow_ccs; return $this; @@ -494,6 +602,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -518,6 +629,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -542,6 +656,9 @@ public function getCcRoles() */ public function setCcRoles(?array $cc_roles) { + if (is_null($cc_roles)) { + throw new InvalidArgumentException('non-nullable cc_roles cannot be null'); + } $this->container['cc_roles'] = $cc_roles; return $this; @@ -566,6 +683,9 @@ public function getEditorOptions() */ public function setEditorOptions(?SubEditorOptions $editor_options) { + if (is_null($editor_options)) { + throw new InvalidArgumentException('non-nullable editor_options cannot be null'); + } $this->container['editor_options'] = $editor_options; return $this; @@ -590,6 +710,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -614,6 +737,9 @@ public function getForceSignerRoles() */ public function setForceSignerRoles(?bool $force_signer_roles) { + if (is_null($force_signer_roles)) { + throw new InvalidArgumentException('non-nullable force_signer_roles cannot be null'); + } $this->container['force_signer_roles'] = $force_signer_roles; return $this; @@ -638,6 +764,9 @@ public function getForceSubjectMessage() */ public function setForceSubjectMessage(?bool $force_subject_message) { + if (is_null($force_subject_message)) { + throw new InvalidArgumentException('non-nullable force_subject_message cannot be null'); + } $this->container['force_subject_message'] = $force_subject_message; return $this; @@ -662,6 +791,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -686,6 +818,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -710,6 +845,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(?array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -734,6 +872,9 @@ public function getMergeFields() */ public function setMergeFields(?array $merge_fields) { + if (is_null($merge_fields)) { + throw new InvalidArgumentException('non-nullable merge_fields cannot be null'); + } $this->container['merge_fields'] = $merge_fields; return $this; @@ -758,7 +899,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling TemplateCreateEmbeddedDraftRequest., must be smaller than or equal to 5000.'); } @@ -786,6 +930,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -810,6 +958,9 @@ public function getShowPreview() */ public function setShowPreview(?bool $show_preview) { + if (is_null($show_preview)) { + throw new InvalidArgumentException('non-nullable show_preview cannot be null'); + } $this->container['show_preview'] = $show_preview; return $this; @@ -834,6 +985,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -858,6 +1012,9 @@ public function getSignerRoles() */ public function setSignerRoles(?array $signer_roles) { + if (is_null($signer_roles)) { + throw new InvalidArgumentException('non-nullable signer_roles cannot be null'); + } $this->container['signer_roles'] = $signer_roles; return $this; @@ -882,6 +1039,9 @@ public function getSkipMeNow() */ public function setSkipMeNow(?bool $skip_me_now) { + if (is_null($skip_me_now)) { + throw new InvalidArgumentException('non-nullable skip_me_now cannot be null'); + } $this->container['skip_me_now'] = $skip_me_now; return $this; @@ -906,7 +1066,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 200)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 200) { throw new InvalidArgumentException('invalid length for $subject when calling TemplateCreateEmbeddedDraftRequest., must be smaller than or equal to 200.'); } @@ -934,6 +1097,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -958,6 +1124,9 @@ public function getTitle() */ public function setTitle(?string $title) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -982,6 +1151,9 @@ public function getUsePreexistingFields() */ public function setUsePreexistingFields(?bool $use_preexisting_fields) { + if (is_null($use_preexisting_fields)) { + throw new InvalidArgumentException('non-nullable use_preexisting_fields cannot be null'); + } $this->container['use_preexisting_fields'] = $use_preexisting_fields; return $this; @@ -990,12 +1162,10 @@ public function setUsePreexistingFields(?bool $use_preexisting_fields) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1003,7 +1173,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -1016,13 +1186,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1034,12 +1202,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1048,8 +1214,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1066,7 +1232,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php index beec359d5..1270cf16a 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateCreateEmbeddedDraftResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateCreateEmbeddedDraftResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TemplateCreateEmbeddedDraftResponse implements ModelInterface, ArrayAccess 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template'] = $data['template'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateEmbeddedDraftResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateEmbeddedDraftResponse { /** @var TemplateCreateEmbeddedDraftResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TemplateCreateEmbeddedDraftResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTemplate() */ public function setTemplate(?TemplateCreateEmbeddedDraftResponseTemplate $template) { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php index b8ab59bc6..0090f4192 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Template object with parameters: `template_id`, `edit_url`, `expires_at`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateCreateEmbeddedDraftResponseTemplate implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class TemplateCreateEmbeddedDraftResponseTemplate implements ModelInterface, Arr 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_id' => false, + 'edit_url' => false, + 'expires_at' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_id'] = $data['template_id'] ?? null; - $this->container['edit_url'] = $data['edit_url'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('template_id', $data ?? [], null); + $this->setIfExists('edit_url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateEmbeddedDraftResponseTemplate { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateEmbeddedDraftResponseTemplate { /** @var TemplateCreateEmbeddedDraftResponseTemplate $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftResponseTemplate::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): TemplateCreateEmbeddedDraftResponseTem */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,9 @@ public function getTemplateId() */ public function setTemplateId(?string $template_id) { + if (is_null($template_id)) { + throw new InvalidArgumentException('non-nullable template_id cannot be null'); + } $this->container['template_id'] = $template_id; return $this; @@ -285,6 +361,9 @@ public function getEditUrl() */ public function setEditUrl(?string $edit_url) { + if (is_null($edit_url)) { + throw new InvalidArgumentException('non-nullable edit_url cannot be null'); + } $this->container['edit_url'] = $edit_url; return $this; @@ -309,6 +388,9 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + throw new InvalidArgumentException('non-nullable expires_at cannot be null'); + } $this->container['expires_at'] = $expires_at; return $this; @@ -335,6 +417,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -343,12 +428,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -356,7 +439,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -369,13 +452,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -387,12 +468,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -401,8 +480,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -419,7 +498,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateRequest.php b/sdks/php/src/Model/TemplateCreateRequest.php index 2e9fe0901..8c5b437d8 100644 --- a/sdks/php/src/Model/TemplateCreateRequest.php +++ b/sdks/php/src/Model/TemplateCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * TemplateCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -110,6 +106,39 @@ class TemplateCreateRequest implements ModelInterface, ArrayAccess, JsonSerializ 'use_preexisting_fields' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'form_fields_per_document' => false, + 'signer_roles' => false, + 'files' => false, + 'file_urls' => false, + 'allow_reassign' => false, + 'attachments' => false, + 'cc_roles' => false, + 'client_id' => false, + 'field_options' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'merge_fields' => false, + 'message' => false, + 'metadata' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'use_preexisting_fields' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -130,6 +159,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -253,54 +326,70 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['signer_roles'] = $data['signer_roles'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_roles'] = $data['cc_roles'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['merge_fields'] = $data['merge_fields'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['use_preexisting_fields'] = $data['use_preexisting_fields'] ?? false; - } - - /** @deprecated use ::init() */ + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('signer_roles', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_roles', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('merge_fields', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('use_preexisting_fields', $data ?? [], false); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateRequest { /** @var TemplateCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -359,6 +448,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -383,6 +475,9 @@ public function getSignerRoles() */ public function setSignerRoles(array $signer_roles) { + if (is_null($signer_roles)) { + throw new InvalidArgumentException('non-nullable signer_roles cannot be null'); + } $this->container['signer_roles'] = $signer_roles; return $this; @@ -407,6 +502,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -431,6 +529,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -455,6 +556,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -479,6 +583,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -503,6 +610,9 @@ public function getCcRoles() */ public function setCcRoles(?array $cc_roles) { + if (is_null($cc_roles)) { + throw new InvalidArgumentException('non-nullable cc_roles cannot be null'); + } $this->container['cc_roles'] = $cc_roles; return $this; @@ -527,6 +637,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -551,6 +664,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -575,6 +691,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -599,6 +718,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -623,6 +745,9 @@ public function getMergeFields() */ public function setMergeFields(?array $merge_fields) { + if (is_null($merge_fields)) { + throw new InvalidArgumentException('non-nullable merge_fields cannot be null'); + } $this->container['merge_fields'] = $merge_fields; return $this; @@ -647,7 +772,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling TemplateCreateRequest., must be smaller than or equal to 5000.'); } @@ -675,6 +803,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -699,7 +831,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 200)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 200) { throw new InvalidArgumentException('invalid length for $subject when calling TemplateCreateRequest., must be smaller than or equal to 200.'); } @@ -727,6 +862,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -751,6 +889,9 @@ public function getTitle() */ public function setTitle(?string $title) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -775,6 +916,9 @@ public function getUsePreexistingFields() */ public function setUsePreexistingFields(?bool $use_preexisting_fields) { + if (is_null($use_preexisting_fields)) { + throw new InvalidArgumentException('non-nullable use_preexisting_fields cannot be null'); + } $this->container['use_preexisting_fields'] = $use_preexisting_fields; return $this; @@ -783,12 +927,10 @@ public function setUsePreexistingFields(?bool $use_preexisting_fields) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -796,7 +938,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -809,13 +951,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -827,12 +967,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -841,8 +979,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -859,7 +997,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateResponse.php b/sdks/php/src/Model/TemplateCreateResponse.php index 2d4a1f236..6f8684652 100644 --- a/sdks/php/src/Model/TemplateCreateResponse.php +++ b/sdks/php/src/Model/TemplateCreateResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateCreateResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateCreateResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TemplateCreateResponse implements ModelInterface, ArrayAccess, JsonSeriali 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template'] = $data['template'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateResponse { /** @var TemplateCreateResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TemplateCreateResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTemplate() */ public function setTemplate(?TemplateCreateResponseTemplate $template) { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateCreateResponseTemplate.php b/sdks/php/src/Model/TemplateCreateResponseTemplate.php index 1c98865dc..2a66c2c3f 100644 --- a/sdks/php/src/Model/TemplateCreateResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateResponseTemplate.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Template object with parameters: `template_id`. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateCreateResponseTemplate implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +72,22 @@ class TemplateCreateResponseTemplate implements ModelInterface, ArrayAccess, Jso 'template_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_id' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +108,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,37 +224,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_id'] = $data['template_id'] ?? null; + $this->setIfExists('template_id', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateCreateResponseTemplate { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateCreateResponseTemplate { /** @var TemplateCreateResponseTemplate $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateCreateResponseTemplate::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -208,9 +280,7 @@ public static function init(array $data): TemplateCreateResponseTemplate */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -243,6 +313,9 @@ public function getTemplateId() */ public function setTemplateId(?string $template_id) { + if (is_null($template_id)) { + throw new InvalidArgumentException('non-nullable template_id cannot be null'); + } $this->container['template_id'] = $template_id; return $this; @@ -251,12 +324,10 @@ public function setTemplateId(?string $template_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -264,7 +335,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -277,13 +348,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -295,12 +364,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -309,8 +376,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -327,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateEditResponse.php b/sdks/php/src/Model/TemplateEditResponse.php index 455533dd7..76103f6b1 100644 --- a/sdks/php/src/Model/TemplateEditResponse.php +++ b/sdks/php/src/Model/TemplateEditResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * TemplateEditResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class TemplateEditResponse implements ModelInterface, ArrayAccess, JsonSerializa 'template_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_id' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_id'] = $data['template_id'] ?? null; + $this->setIfExists('template_id', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateEditResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateEditResponse { /** @var TemplateEditResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateEditResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -206,9 +279,7 @@ public static function init(array $data): TemplateEditResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -241,6 +312,9 @@ public function getTemplateId() */ public function setTemplateId(?string $template_id) { + if (is_null($template_id)) { + throw new InvalidArgumentException('non-nullable template_id cannot be null'); + } $this->container['template_id'] = $template_id; return $this; @@ -249,12 +323,10 @@ public function setTemplateId(?string $template_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -262,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -275,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -293,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -307,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -325,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateGetResponse.php b/sdks/php/src/Model/TemplateGetResponse.php index 340a002f2..91496bb1a 100644 --- a/sdks/php/src/Model/TemplateGetResponse.php +++ b/sdks/php/src/Model/TemplateGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TemplateGetResponse implements ModelInterface, ArrayAccess, JsonSerializab 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template'] = $data['template'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('template', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateGetResponse { /** @var TemplateGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateGetResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TemplateGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getTemplate() */ public function setTemplate(?TemplateResponse $template) { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateListResponse.php b/sdks/php/src/Model/TemplateListResponse.php index 3ff89da3c..52f683e84 100644 --- a/sdks/php/src/Model/TemplateListResponse.php +++ b/sdks/php/src/Model/TemplateListResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateListResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateListResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class TemplateListResponse implements ModelInterface, ArrayAccess, JsonSerializa 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'templates' => false, + 'list_info' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['templates'] = $data['templates'] ?? null; - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('templates', $data ?? [], null); + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateListResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateListResponse { /** @var TemplateListResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateListResponse::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -219,9 +293,7 @@ public static function init(array $data): TemplateListResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +326,9 @@ public function getTemplates() */ public function setTemplates(?array $templates) { + if (is_null($templates)) { + throw new InvalidArgumentException('non-nullable templates cannot be null'); + } $this->container['templates'] = $templates; return $this; @@ -278,6 +353,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -302,6 +380,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +391,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +402,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +415,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +431,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +443,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -386,7 +461,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateRemoveUserRequest.php b/sdks/php/src/Model/TemplateRemoveUserRequest.php index 417af15ef..306df33e4 100644 --- a/sdks/php/src/Model/TemplateRemoveUserRequest.php +++ b/sdks/php/src/Model/TemplateRemoveUserRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * TemplateRemoveUserRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateRemoveUserRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -76,6 +73,23 @@ class TemplateRemoveUserRequest implements ModelInterface, ArrayAccess, JsonSeri 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -96,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateRemoveUserRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateRemoveUserRequest { /** @var TemplateRemoveUserRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateRemoveUserRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -212,9 +286,7 @@ public static function init(array $data): TemplateRemoveUserRequest */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -247,6 +319,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -271,6 +346,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -279,12 +357,10 @@ public function setEmailAddress(?string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -292,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -305,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -323,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -337,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -355,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponse.php b/sdks/php/src/Model/TemplateResponse.php index 3501301b1..7b5cb283b 100644 --- a/sdks/php/src/Model/TemplateResponse.php +++ b/sdks/php/src/Model/TemplateResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains information about the templates you and your team have created. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -104,6 +100,36 @@ class TemplateResponse implements ModelInterface, ArrayAccess, JsonSerializable 'accounts' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_id' => false, + 'title' => false, + 'message' => false, + 'updated_at' => false, + 'is_embedded' => true, + 'is_creator' => true, + 'can_edit' => true, + 'is_locked' => true, + 'metadata' => false, + 'signer_roles' => false, + 'cc_roles' => false, + 'documents' => false, + 'custom_fields' => true, + 'named_form_fields' => true, + 'accounts' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -124,6 +150,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -238,51 +308,67 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_id'] = $data['template_id'] ?? null; - $this->container['title'] = $data['title'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; - $this->container['is_embedded'] = $data['is_embedded'] ?? null; - $this->container['is_creator'] = $data['is_creator'] ?? null; - $this->container['can_edit'] = $data['can_edit'] ?? null; - $this->container['is_locked'] = $data['is_locked'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['signer_roles'] = $data['signer_roles'] ?? null; - $this->container['cc_roles'] = $data['cc_roles'] ?? null; - $this->container['documents'] = $data['documents'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['named_form_fields'] = $data['named_form_fields'] ?? null; - $this->container['accounts'] = $data['accounts'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('template_id', $data ?? [], null); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('is_embedded', $data ?? [], null); + $this->setIfExists('is_creator', $data ?? [], null); + $this->setIfExists('can_edit', $data ?? [], null); + $this->setIfExists('is_locked', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('signer_roles', $data ?? [], null); + $this->setIfExists('cc_roles', $data ?? [], null); + $this->setIfExists('documents', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('named_form_fields', $data ?? [], null); + $this->setIfExists('accounts', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponse { /** @var TemplateResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -292,9 +378,7 @@ public static function init(array $data): TemplateResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -327,6 +411,9 @@ public function getTemplateId() */ public function setTemplateId(?string $template_id) { + if (is_null($template_id)) { + throw new InvalidArgumentException('non-nullable template_id cannot be null'); + } $this->container['template_id'] = $template_id; return $this; @@ -351,6 +438,9 @@ public function getTitle() */ public function setTitle(?string $title) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } $this->container['title'] = $title; return $this; @@ -375,6 +465,9 @@ public function getMessage() */ public function setMessage(?string $message) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } $this->container['message'] = $message; return $this; @@ -399,6 +492,9 @@ public function getUpdatedAt() */ public function setUpdatedAt(?int $updated_at) { + if (is_null($updated_at)) { + throw new InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; @@ -423,6 +519,16 @@ public function getIsEmbedded() */ public function setIsEmbedded(?bool $is_embedded) { + if (is_null($is_embedded)) { + array_push($this->openAPINullablesSetToNull, 'is_embedded'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_embedded', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['is_embedded'] = $is_embedded; return $this; @@ -447,6 +553,16 @@ public function getIsCreator() */ public function setIsCreator(?bool $is_creator) { + if (is_null($is_creator)) { + array_push($this->openAPINullablesSetToNull, 'is_creator'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_creator', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['is_creator'] = $is_creator; return $this; @@ -471,6 +587,16 @@ public function getCanEdit() */ public function setCanEdit(?bool $can_edit) { + if (is_null($can_edit)) { + array_push($this->openAPINullablesSetToNull, 'can_edit'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('can_edit', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['can_edit'] = $can_edit; return $this; @@ -495,6 +621,16 @@ public function getIsLocked() */ public function setIsLocked(?bool $is_locked) { + if (is_null($is_locked)) { + array_push($this->openAPINullablesSetToNull, 'is_locked'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('is_locked', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['is_locked'] = $is_locked; return $this; @@ -519,6 +655,9 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } $this->container['metadata'] = $metadata; return $this; @@ -543,6 +682,9 @@ public function getSignerRoles() */ public function setSignerRoles(?array $signer_roles) { + if (is_null($signer_roles)) { + throw new InvalidArgumentException('non-nullable signer_roles cannot be null'); + } $this->container['signer_roles'] = $signer_roles; return $this; @@ -567,6 +709,9 @@ public function getCcRoles() */ public function setCcRoles(?array $cc_roles) { + if (is_null($cc_roles)) { + throw new InvalidArgumentException('non-nullable cc_roles cannot be null'); + } $this->container['cc_roles'] = $cc_roles; return $this; @@ -591,6 +736,9 @@ public function getDocuments() */ public function setDocuments(?array $documents) { + if (is_null($documents)) { + throw new InvalidArgumentException('non-nullable documents cannot be null'); + } $this->container['documents'] = $documents; return $this; @@ -617,6 +765,16 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + array_push($this->openAPINullablesSetToNull, 'custom_fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('custom_fields', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -643,6 +801,16 @@ public function getNamedFormFields() */ public function setNamedFormFields(?array $named_form_fields) { + if (is_null($named_form_fields)) { + array_push($this->openAPINullablesSetToNull, 'named_form_fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('named_form_fields', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['named_form_fields'] = $named_form_fields; return $this; @@ -667,6 +835,16 @@ public function getAccounts() */ public function setAccounts(?array $accounts) { + if (is_null($accounts)) { + array_push($this->openAPINullablesSetToNull, 'accounts'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('accounts', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['accounts'] = $accounts; return $this; @@ -675,12 +853,10 @@ public function setAccounts(?array $accounts) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -688,7 +864,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -701,13 +877,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -719,12 +893,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -733,8 +905,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -751,7 +923,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseAccount.php b/sdks/php/src/Model/TemplateResponseAccount.php index c20c2ee59..57845033e 100644 --- a/sdks/php/src/Model/TemplateResponseAccount.php +++ b/sdks/php/src/Model/TemplateResponseAccount.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateResponseAccount Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseAccount implements ModelInterface, ArrayAccess, JsonSerializable { @@ -85,6 +81,27 @@ class TemplateResponseAccount implements ModelInterface, ArrayAccess, JsonSerial 'quotas' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'account_id' => false, + 'email_address' => false, + 'is_locked' => false, + 'is_paid_hs' => false, + 'is_paid_hf' => false, + 'quotas' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -192,42 +253,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; - $this->container['is_locked'] = $data['is_locked'] ?? null; - $this->container['is_paid_hs'] = $data['is_paid_hs'] ?? null; - $this->container['is_paid_hf'] = $data['is_paid_hf'] ?? null; - $this->container['quotas'] = $data['quotas'] ?? null; + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); + $this->setIfExists('is_locked', $data ?? [], null); + $this->setIfExists('is_paid_hs', $data ?? [], null); + $this->setIfExists('is_paid_hf', $data ?? [], null); + $this->setIfExists('quotas', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseAccount { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseAccount { /** @var TemplateResponseAccount $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseAccount::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -237,9 +314,7 @@ public static function init(array $data): TemplateResponseAccount */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -272,6 +347,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -296,6 +374,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -320,6 +401,9 @@ public function getIsLocked() */ public function setIsLocked(?bool $is_locked) { + if (is_null($is_locked)) { + throw new InvalidArgumentException('non-nullable is_locked cannot be null'); + } $this->container['is_locked'] = $is_locked; return $this; @@ -344,6 +428,9 @@ public function getIsPaidHs() */ public function setIsPaidHs(?bool $is_paid_hs) { + if (is_null($is_paid_hs)) { + throw new InvalidArgumentException('non-nullable is_paid_hs cannot be null'); + } $this->container['is_paid_hs'] = $is_paid_hs; return $this; @@ -368,6 +455,9 @@ public function getIsPaidHf() */ public function setIsPaidHf(?bool $is_paid_hf) { + if (is_null($is_paid_hf)) { + throw new InvalidArgumentException('non-nullable is_paid_hf cannot be null'); + } $this->container['is_paid_hf'] = $is_paid_hf; return $this; @@ -392,6 +482,9 @@ public function getQuotas() */ public function setQuotas(?TemplateResponseAccountQuota $quotas) { + if (is_null($quotas)) { + throw new InvalidArgumentException('non-nullable quotas cannot be null'); + } $this->container['quotas'] = $quotas; return $this; @@ -400,12 +493,10 @@ public function setQuotas(?TemplateResponseAccountQuota $quotas) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -413,7 +504,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -426,13 +517,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -444,12 +533,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -458,8 +545,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -476,7 +563,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseAccountQuota.php b/sdks/php/src/Model/TemplateResponseAccountQuota.php index 85ef3448d..d2aa9fe4d 100644 --- a/sdks/php/src/Model/TemplateResponseAccountQuota.php +++ b/sdks/php/src/Model/TemplateResponseAccountQuota.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description An array of the designated CC roles that must be specified when sending a SignatureRequest using this Template. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseAccountQuota implements ModelInterface, ArrayAccess, JsonSerializable { @@ -82,6 +78,25 @@ class TemplateResponseAccountQuota implements ModelInterface, ArrayAccess, JsonS 'sms_verifications_left' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'templates_left' => false, + 'api_signature_requests_left' => false, + 'documents_left' => false, + 'sms_verifications_left' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -102,6 +117,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +242,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['templates_left'] = $data['templates_left'] ?? null; - $this->container['api_signature_requests_left'] = $data['api_signature_requests_left'] ?? null; - $this->container['documents_left'] = $data['documents_left'] ?? null; - $this->container['sms_verifications_left'] = $data['sms_verifications_left'] ?? null; + $this->setIfExists('templates_left', $data ?? [], null); + $this->setIfExists('api_signature_requests_left', $data ?? [], null); + $this->setIfExists('documents_left', $data ?? [], null); + $this->setIfExists('sms_verifications_left', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseAccountQuota { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseAccountQuota { /** @var TemplateResponseAccountQuota $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseAccountQuota::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,9 +301,7 @@ public static function init(array $data): TemplateResponseAccountQuota */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -261,6 +334,9 @@ public function getTemplatesLeft() */ public function setTemplatesLeft(?int $templates_left) { + if (is_null($templates_left)) { + throw new InvalidArgumentException('non-nullable templates_left cannot be null'); + } $this->container['templates_left'] = $templates_left; return $this; @@ -285,6 +361,9 @@ public function getApiSignatureRequestsLeft() */ public function setApiSignatureRequestsLeft(?int $api_signature_requests_left) { + if (is_null($api_signature_requests_left)) { + throw new InvalidArgumentException('non-nullable api_signature_requests_left cannot be null'); + } $this->container['api_signature_requests_left'] = $api_signature_requests_left; return $this; @@ -309,6 +388,9 @@ public function getDocumentsLeft() */ public function setDocumentsLeft(?int $documents_left) { + if (is_null($documents_left)) { + throw new InvalidArgumentException('non-nullable documents_left cannot be null'); + } $this->container['documents_left'] = $documents_left; return $this; @@ -333,6 +415,9 @@ public function getSmsVerificationsLeft() */ public function setSmsVerificationsLeft(?int $sms_verifications_left) { + if (is_null($sms_verifications_left)) { + throw new InvalidArgumentException('non-nullable sms_verifications_left cannot be null'); + } $this->container['sms_verifications_left'] = $sms_verifications_left; return $this; @@ -341,12 +426,10 @@ public function setSmsVerificationsLeft(?int $sms_verifications_left) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -354,7 +437,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -367,13 +450,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -385,12 +466,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -399,8 +478,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -417,7 +496,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseCCRole.php b/sdks/php/src/Model/TemplateResponseCCRole.php index 5f37a020e..3d7fd9a12 100644 --- a/sdks/php/src/Model/TemplateResponseCCRole.php +++ b/sdks/php/src/Model/TemplateResponseCCRole.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateResponseCCRole Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseCCRole implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +71,22 @@ class TemplateResponseCCRole implements ModelInterface, ArrayAccess, JsonSeriali 'name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; + $this->setIfExists('name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseCCRole { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseCCRole { /** @var TemplateResponseCCRole $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseCCRole::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -207,9 +279,7 @@ public static function init(array $data): TemplateResponseCCRole */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +312,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -250,12 +323,10 @@ public function setName(?string $name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -326,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocument.php b/sdks/php/src/Model/TemplateResponseDocument.php index d7a45b36f..d46efa660 100644 --- a/sdks/php/src/Model/TemplateResponseDocument.php +++ b/sdks/php/src/Model/TemplateResponseDocument.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateResponseDocument Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseDocument implements ModelInterface, ArrayAccess, JsonSerializable { @@ -85,6 +81,27 @@ class TemplateResponseDocument implements ModelInterface, ArrayAccess, JsonSeria 'static_fields' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'index' => false, + 'field_groups' => false, + 'form_fields' => false, + 'custom_fields' => false, + 'static_fields' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -105,6 +122,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -192,42 +253,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['index'] = $data['index'] ?? null; - $this->container['field_groups'] = $data['field_groups'] ?? null; - $this->container['form_fields'] = $data['form_fields'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['static_fields'] = $data['static_fields'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('index', $data ?? [], null); + $this->setIfExists('field_groups', $data ?? [], null); + $this->setIfExists('form_fields', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('static_fields', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocument { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocument { /** @var TemplateResponseDocument $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocument::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -237,9 +314,7 @@ public static function init(array $data): TemplateResponseDocument */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -272,6 +347,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -296,6 +374,9 @@ public function getIndex() */ public function setIndex(?int $index) { + if (is_null($index)) { + throw new InvalidArgumentException('non-nullable index cannot be null'); + } $this->container['index'] = $index; return $this; @@ -320,6 +401,9 @@ public function getFieldGroups() */ public function setFieldGroups(?array $field_groups) { + if (is_null($field_groups)) { + throw new InvalidArgumentException('non-nullable field_groups cannot be null'); + } $this->container['field_groups'] = $field_groups; return $this; @@ -344,6 +428,9 @@ public function getFormFields() */ public function setFormFields(?array $form_fields) { + if (is_null($form_fields)) { + throw new InvalidArgumentException('non-nullable form_fields cannot be null'); + } $this->container['form_fields'] = $form_fields; return $this; @@ -368,6 +455,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -392,6 +482,16 @@ public function getStaticFields() */ public function setStaticFields(?array $static_fields) { + if (is_null($static_fields)) { + array_push($this->openAPINullablesSetToNull, 'static_fields'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('static_fields', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['static_fields'] = $static_fields; return $this; @@ -400,12 +500,10 @@ public function setStaticFields(?array $static_fields) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -413,7 +511,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -426,13 +524,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -444,12 +540,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -458,8 +552,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -476,7 +570,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php index a7637f84c..498e49b7e 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description An array of Form Field objects containing the name and type of each named field. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class TemplateResponseDocumentCustomFieldBase implements ModelInterface, ArrayAccess, JsonSerializable +class TemplateResponseDocumentCustomFieldBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -94,6 +90,31 @@ abstract class TemplateResponseDocumentCustomFieldBase implements ModelInterface 'group' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'api_id' => false, + 'name' => false, + 'signer' => true, + 'x' => false, + 'y' => false, + 'width' => false, + 'height' => false, + 'required' => false, + 'group' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -114,6 +135,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -213,28 +278,28 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['signer'] = $data['signer'] ?? null; - $this->container['x'] = $data['x'] ?? null; - $this->container['y'] = $data['y'] ?? null; - $this->container['width'] = $data['width'] ?? null; - $this->container['height'] = $data['height'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('signer', $data ?? [], null); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -256,6 +321,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -268,7 +347,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -302,6 +380,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -326,6 +407,9 @@ public function getApiId() */ public function setApiId(?string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -350,6 +434,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -374,6 +461,16 @@ public function getSigner() */ public function setSigner(?string $signer) { + if (is_null($signer)) { + array_push($this->openAPINullablesSetToNull, 'signer'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signer', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signer'] = $signer; return $this; @@ -398,6 +495,9 @@ public function getX() */ public function setX(?int $x) { + if (is_null($x)) { + throw new InvalidArgumentException('non-nullable x cannot be null'); + } $this->container['x'] = $x; return $this; @@ -422,6 +522,9 @@ public function getY() */ public function setY(?int $y) { + if (is_null($y)) { + throw new InvalidArgumentException('non-nullable y cannot be null'); + } $this->container['y'] = $y; return $this; @@ -446,6 +549,9 @@ public function getWidth() */ public function setWidth(?int $width) { + if (is_null($width)) { + throw new InvalidArgumentException('non-nullable width cannot be null'); + } $this->container['width'] = $width; return $this; @@ -470,6 +576,9 @@ public function getHeight() */ public function setHeight(?int $height) { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } $this->container['height'] = $height; return $this; @@ -494,6 +603,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -518,6 +630,16 @@ public function getGroup() */ public function setGroup(?string $group) { + if (is_null($group)) { + array_push($this->openAPINullablesSetToNull, 'group'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['group'] = $group; return $this; @@ -526,12 +648,10 @@ public function setGroup(?string $group) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -539,7 +659,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -552,13 +672,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -570,12 +688,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -584,8 +700,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -602,7 +718,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php index dca0f6bfa..c59acbc03 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentCustomFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentCustomFieldCheckbox extends TemplateResponseDocumentCustomFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentCustomFieldCheckbox extends TemplateResponseDocume 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; + $this->setIfExists('type', $data ?? [], 'checkbox'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentCustomFieldCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentCustomFieldCheckbox { /** @var TemplateResponseDocumentCustomFieldCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentCustomFieldCheckbox::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php index 50a0dd42b..e4e072444 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentCustomFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentCustomFieldText extends TemplateResponseDocumentCustomFieldBase { @@ -81,6 +78,26 @@ class TemplateResponseDocumentCustomFieldText extends TemplateResponseDocumentCu 'font_family' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'avg_text_length' => false, + 'is_multiline' => false, + 'original_font_size' => false, + 'font_family' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,36 +246,52 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; - $this->container['avg_text_length'] = $data['avg_text_length'] ?? null; - $this->container['is_multiline'] = $data['is_multiline'] ?? null; - $this->container['original_font_size'] = $data['original_font_size'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; + $this->setIfExists('type', $data ?? [], 'text'); + $this->setIfExists('avg_text_length', $data ?? [], null); + $this->setIfExists('is_multiline', $data ?? [], null); + $this->setIfExists('original_font_size', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentCustomFieldText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentCustomFieldText { /** @var TemplateResponseDocumentCustomFieldText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentCustomFieldText::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +306,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -263,6 +339,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -287,6 +366,9 @@ public function getAvgTextLength() */ public function setAvgTextLength(?TemplateResponseFieldAvgTextLength $avg_text_length) { + if (is_null($avg_text_length)) { + throw new InvalidArgumentException('non-nullable avg_text_length cannot be null'); + } $this->container['avg_text_length'] = $avg_text_length; return $this; @@ -311,6 +393,9 @@ public function getIsMultiline() */ public function setIsMultiline(?bool $is_multiline) { + if (is_null($is_multiline)) { + throw new InvalidArgumentException('non-nullable is_multiline cannot be null'); + } $this->container['is_multiline'] = $is_multiline; return $this; @@ -335,6 +420,9 @@ public function getOriginalFontSize() */ public function setOriginalFontSize(?int $original_font_size) { + if (is_null($original_font_size)) { + throw new InvalidArgumentException('non-nullable original_font_size cannot be null'); + } $this->container['original_font_size'] = $original_font_size; return $this; @@ -359,6 +447,9 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $this->container['font_family'] = $font_family; return $this; @@ -367,12 +458,10 @@ public function setFontFamily(?string $font_family) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -380,7 +469,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -393,13 +482,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -411,12 +498,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -425,8 +510,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -443,7 +528,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php index 6f8b57907..c192584a9 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateResponseDocumentFieldGroup Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseDocumentFieldGroup implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TemplateResponseDocumentFieldGroup implements ModelInterface, ArrayAccess, 'rule' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'rule' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['rule'] = $data['rule'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('rule', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFieldGroup { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFieldGroup { /** @var TemplateResponseDocumentFieldGroup $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFieldGroup::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TemplateResponseDocumentFieldGroup */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -272,6 +346,9 @@ public function getRule() */ public function setRule(?TemplateResponseDocumentFieldGroupRule $rule) { + if (is_null($rule)) { + throw new InvalidArgumentException('non-nullable rule cannot be null'); + } $this->container['rule'] = $rule; return $this; @@ -280,12 +357,10 @@ public function setRule(?TemplateResponseDocumentFieldGroupRule $rule) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php index 953fd6561..e47cb2686 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description The rule used to validate checkboxes in the form field group. See [checkbox field grouping](/api/reference/constants/#checkbox-field-grouping). - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseDocumentFieldGroupRule implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class TemplateResponseDocumentFieldGroupRule implements ModelInterface, ArrayAcc 'group_label' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'requirement' => false, + 'group_label' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['requirement'] = $data['requirement'] ?? null; - $this->container['group_label'] = $data['group_label'] ?? null; + $this->setIfExists('requirement', $data ?? [], null); + $this->setIfExists('group_label', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFieldGroupRule { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFieldGroupRule { /** @var TemplateResponseDocumentFieldGroupRule $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFieldGroupRule::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): TemplateResponseDocumentFieldGroupRule */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getRequirement() */ public function setRequirement(?string $requirement) { + if (is_null($requirement)) { + throw new InvalidArgumentException('non-nullable requirement cannot be null'); + } $this->container['requirement'] = $requirement; return $this; @@ -273,6 +347,9 @@ public function getGroupLabel() */ public function setGroupLabel(?string $group_label) { + if (is_null($group_label)) { + throw new InvalidArgumentException('non-nullable group_label cannot be null'); + } $this->container['group_label'] = $group_label; return $this; @@ -281,12 +358,10 @@ public function setGroupLabel(?string $group_label) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php index 9d9cfae4e..dec9a4e81 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description An array of Form Field objects containing the name and type of each named field. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class TemplateResponseDocumentFormFieldBase implements ModelInterface, ArrayAccess, JsonSerializable +class TemplateResponseDocumentFormFieldBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -94,6 +90,31 @@ abstract class TemplateResponseDocumentFormFieldBase implements ModelInterface, 'group' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'api_id' => false, + 'name' => false, + 'signer' => false, + 'x' => false, + 'y' => false, + 'width' => false, + 'height' => false, + 'required' => false, + 'group' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -114,6 +135,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -213,28 +278,28 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['signer'] = $data['signer'] ?? null; - $this->container['x'] = $data['x'] ?? null; - $this->container['y'] = $data['y'] ?? null; - $this->container['width'] = $data['width'] ?? null; - $this->container['height'] = $data['height'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('signer', $data ?? [], null); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -274,6 +339,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -286,7 +365,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -320,6 +398,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -344,6 +425,9 @@ public function getApiId() */ public function setApiId(?string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -368,6 +452,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -392,6 +479,9 @@ public function getSigner() */ public function setSigner(?string $signer) { + if (is_null($signer)) { + throw new InvalidArgumentException('non-nullable signer cannot be null'); + } $this->container['signer'] = $signer; return $this; @@ -416,6 +506,9 @@ public function getX() */ public function setX(?int $x) { + if (is_null($x)) { + throw new InvalidArgumentException('non-nullable x cannot be null'); + } $this->container['x'] = $x; return $this; @@ -440,6 +533,9 @@ public function getY() */ public function setY(?int $y) { + if (is_null($y)) { + throw new InvalidArgumentException('non-nullable y cannot be null'); + } $this->container['y'] = $y; return $this; @@ -464,6 +560,9 @@ public function getWidth() */ public function setWidth(?int $width) { + if (is_null($width)) { + throw new InvalidArgumentException('non-nullable width cannot be null'); + } $this->container['width'] = $width; return $this; @@ -488,6 +587,9 @@ public function getHeight() */ public function setHeight(?int $height) { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } $this->container['height'] = $height; return $this; @@ -512,6 +614,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -536,6 +641,16 @@ public function getGroup() */ public function setGroup(?string $group) { + if (is_null($group)) { + array_push($this->openAPINullablesSetToNull, 'group'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['group'] = $group; return $this; @@ -544,12 +659,10 @@ public function setGroup(?string $group) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -557,7 +670,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -570,13 +683,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -588,12 +699,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -602,8 +711,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -620,7 +729,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php index 6aafd23cd..16a40a712 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldCheckbox extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldCheckbox extends TemplateResponseDocument 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; + $this->setIfExists('type', $data ?? [], 'checkbox'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldCheckbox { /** @var TemplateResponseDocumentFormFieldCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldCheckbox::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php index 0b8dcf3dd..4cb95eb88 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldDateSigned extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldDateSigned extends TemplateResponseDocume 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'date_signed'; + $this->setIfExists('type', $data ?? [], 'date_signed'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldDateSigned { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldDateSigned { /** @var TemplateResponseDocumentFormFieldDateSigned $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldDateSigned::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php index f43e89b0b..14e4b9e40 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldDropdown extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldDropdown extends TemplateResponseDocument 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'dropdown'; + $this->setIfExists('type', $data ?? [], 'dropdown'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldDropdown { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldDropdown { /** @var TemplateResponseDocumentFormFieldDropdown $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldDropdown::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php index eb4b4fb88..f1d7d4e22 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldHyperlink extends TemplateResponseDocumentFormFieldBase { @@ -81,6 +78,26 @@ class TemplateResponseDocumentFormFieldHyperlink extends TemplateResponseDocumen 'font_family' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'avg_text_length' => false, + 'is_multiline' => false, + 'original_font_size' => false, + 'font_family' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +118,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,36 +246,52 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'hyperlink'; - $this->container['avg_text_length'] = $data['avg_text_length'] ?? null; - $this->container['is_multiline'] = $data['is_multiline'] ?? null; - $this->container['original_font_size'] = $data['original_font_size'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; + $this->setIfExists('type', $data ?? [], 'hyperlink'); + $this->setIfExists('avg_text_length', $data ?? [], null); + $this->setIfExists('is_multiline', $data ?? [], null); + $this->setIfExists('original_font_size', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldHyperlink { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldHyperlink { /** @var TemplateResponseDocumentFormFieldHyperlink $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldHyperlink::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +306,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -263,6 +339,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -287,6 +366,9 @@ public function getAvgTextLength() */ public function setAvgTextLength(?TemplateResponseFieldAvgTextLength $avg_text_length) { + if (is_null($avg_text_length)) { + throw new InvalidArgumentException('non-nullable avg_text_length cannot be null'); + } $this->container['avg_text_length'] = $avg_text_length; return $this; @@ -311,6 +393,9 @@ public function getIsMultiline() */ public function setIsMultiline(?bool $is_multiline) { + if (is_null($is_multiline)) { + throw new InvalidArgumentException('non-nullable is_multiline cannot be null'); + } $this->container['is_multiline'] = $is_multiline; return $this; @@ -335,6 +420,9 @@ public function getOriginalFontSize() */ public function setOriginalFontSize(?int $original_font_size) { + if (is_null($original_font_size)) { + throw new InvalidArgumentException('non-nullable original_font_size cannot be null'); + } $this->container['original_font_size'] = $original_font_size; return $this; @@ -359,6 +447,9 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $this->container['font_family'] = $font_family; return $this; @@ -367,12 +458,10 @@ public function setFontFamily(?string $font_family) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -380,7 +469,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -393,13 +482,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -411,12 +498,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -425,8 +510,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -443,7 +528,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php index 33dee5480..f2a6680bf 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldInitials extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldInitials extends TemplateResponseDocument 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'initials'; + $this->setIfExists('type', $data ?? [], 'initials'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldInitials { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldInitials { /** @var TemplateResponseDocumentFormFieldInitials $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldInitials::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php index de530b588..481d18406 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldRadio extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldRadio extends TemplateResponseDocumentFor 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'radio'; + $this->setIfExists('type', $data ?? [], 'radio'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldRadio { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldRadio { /** @var TemplateResponseDocumentFormFieldRadio $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldRadio::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php index 7a2951213..34a8db663 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldSignature extends TemplateResponseDocumentFormFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentFormFieldSignature extends TemplateResponseDocumen 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'signature'; + $this->setIfExists('type', $data ?? [], 'signature'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldSignature { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldSignature { /** @var TemplateResponseDocumentFormFieldSignature $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldSignature::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php index a7fa915a2..04b239477 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -37,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentFormFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentFormFieldText extends TemplateResponseDocumentFormFieldBase { @@ -84,6 +80,27 @@ class TemplateResponseDocumentFormFieldText extends TemplateResponseDocumentForm 'validation_type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'avg_text_length' => false, + 'is_multiline' => false, + 'original_font_size' => false, + 'font_family' => false, + 'validation_type' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -104,6 +121,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -223,37 +284,53 @@ public function getValidationTypeAllowableValues() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; - $this->container['avg_text_length'] = $data['avg_text_length'] ?? null; - $this->container['is_multiline'] = $data['is_multiline'] ?? null; - $this->container['original_font_size'] = $data['original_font_size'] ?? null; - $this->container['font_family'] = $data['font_family'] ?? null; - $this->container['validation_type'] = $data['validation_type'] ?? null; + $this->setIfExists('type', $data ?? [], 'text'); + $this->setIfExists('avg_text_length', $data ?? [], null); + $this->setIfExists('is_multiline', $data ?? [], null); + $this->setIfExists('original_font_size', $data ?? [], null); + $this->setIfExists('font_family', $data ?? [], null); + $this->setIfExists('validation_type', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentFormFieldText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentFormFieldText { /** @var TemplateResponseDocumentFormFieldText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldText::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -310,6 +387,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -334,6 +414,9 @@ public function getAvgTextLength() */ public function setAvgTextLength(?TemplateResponseFieldAvgTextLength $avg_text_length) { + if (is_null($avg_text_length)) { + throw new InvalidArgumentException('non-nullable avg_text_length cannot be null'); + } $this->container['avg_text_length'] = $avg_text_length; return $this; @@ -358,6 +441,9 @@ public function getIsMultiline() */ public function setIsMultiline(?bool $is_multiline) { + if (is_null($is_multiline)) { + throw new InvalidArgumentException('non-nullable is_multiline cannot be null'); + } $this->container['is_multiline'] = $is_multiline; return $this; @@ -382,6 +468,9 @@ public function getOriginalFontSize() */ public function setOriginalFontSize(?int $original_font_size) { + if (is_null($original_font_size)) { + throw new InvalidArgumentException('non-nullable original_font_size cannot be null'); + } $this->container['original_font_size'] = $original_font_size; return $this; @@ -406,6 +495,9 @@ public function getFontFamily() */ public function setFontFamily(?string $font_family) { + if (is_null($font_family)) { + throw new InvalidArgumentException('non-nullable font_family cannot be null'); + } $this->container['font_family'] = $font_family; return $this; @@ -430,6 +522,16 @@ public function getValidationType() */ public function setValidationType(?string $validation_type) { + if (is_null($validation_type)) { + array_push($this->openAPINullablesSetToNull, 'validation_type'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('validation_type', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $allowedValues = $this->getValidationTypeAllowableValues(); if (!is_null($validation_type) && !in_array($validation_type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -448,12 +550,10 @@ public function setValidationType(?string $validation_type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -461,7 +561,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -474,13 +574,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -492,12 +590,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -506,8 +602,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -524,7 +620,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php index 5e52961af..c69a2e084 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,14 +38,10 @@ * * @category Class * @description An array describing static overlay fields. **NOTE:** Only available for certain subscriptions. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ -abstract class TemplateResponseDocumentStaticFieldBase implements ModelInterface, ArrayAccess, JsonSerializable +class TemplateResponseDocumentStaticFieldBase implements ModelInterface, ArrayAccess, JsonSerializable { public const DISCRIMINATOR = 'type'; @@ -94,6 +90,31 @@ abstract class TemplateResponseDocumentStaticFieldBase implements ModelInterface 'group' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'api_id' => false, + 'name' => false, + 'signer' => false, + 'x' => false, + 'y' => false, + 'width' => false, + 'height' => false, + 'required' => false, + 'group' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -114,6 +135,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -213,28 +278,28 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['api_id'] = $data['api_id'] ?? null; - $this->container['name'] = $data['name'] ?? null; - $this->container['signer'] = $data['signer'] ?? 'me_now'; - $this->container['x'] = $data['x'] ?? null; - $this->container['y'] = $data['y'] ?? null; - $this->container['width'] = $data['width'] ?? null; - $this->container['height'] = $data['height'] ?? null; - $this->container['required'] = $data['required'] ?? null; - $this->container['group'] = $data['group'] ?? null; + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('api_id', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('signer', $data ?? [], 'me_now'); + $this->setIfExists('x', $data ?? [], null); + $this->setIfExists('y', $data ?? [], null); + $this->setIfExists('width', $data ?? [], null); + $this->setIfExists('height', $data ?? [], null); + $this->setIfExists('required', $data ?? [], null); + $this->setIfExists('group', $data ?? [], null); // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; @@ -274,6 +339,20 @@ public static function discriminatorClassName(array $data): ?string return 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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. * @@ -286,7 +365,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -320,6 +398,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -344,6 +425,9 @@ public function getApiId() */ public function setApiId(?string $api_id) { + if (is_null($api_id)) { + throw new InvalidArgumentException('non-nullable api_id cannot be null'); + } $this->container['api_id'] = $api_id; return $this; @@ -368,6 +452,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -392,6 +479,9 @@ public function getSigner() */ public function setSigner(?string $signer) { + if (is_null($signer)) { + throw new InvalidArgumentException('non-nullable signer cannot be null'); + } $this->container['signer'] = $signer; return $this; @@ -416,6 +506,9 @@ public function getX() */ public function setX(?int $x) { + if (is_null($x)) { + throw new InvalidArgumentException('non-nullable x cannot be null'); + } $this->container['x'] = $x; return $this; @@ -440,6 +533,9 @@ public function getY() */ public function setY(?int $y) { + if (is_null($y)) { + throw new InvalidArgumentException('non-nullable y cannot be null'); + } $this->container['y'] = $y; return $this; @@ -464,6 +560,9 @@ public function getWidth() */ public function setWidth(?int $width) { + if (is_null($width)) { + throw new InvalidArgumentException('non-nullable width cannot be null'); + } $this->container['width'] = $width; return $this; @@ -488,6 +587,9 @@ public function getHeight() */ public function setHeight(?int $height) { + if (is_null($height)) { + throw new InvalidArgumentException('non-nullable height cannot be null'); + } $this->container['height'] = $height; return $this; @@ -512,6 +614,9 @@ public function getRequired() */ public function setRequired(?bool $required) { + if (is_null($required)) { + throw new InvalidArgumentException('non-nullable required cannot be null'); + } $this->container['required'] = $required; return $this; @@ -536,6 +641,16 @@ public function getGroup() */ public function setGroup(?string $group) { + if (is_null($group)) { + array_push($this->openAPINullablesSetToNull, 'group'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('group', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['group'] = $group; return $this; @@ -544,12 +659,10 @@ public function setGroup(?string $group) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -557,7 +670,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -570,13 +683,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -588,12 +699,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -602,8 +711,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -620,7 +729,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php index 06bc51ede..810f71cac 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldCheckbox extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldCheckbox extends TemplateResponseDocume 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'checkbox'; + $this->setIfExists('type', $data ?? [], 'checkbox'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldCheckbox { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldCheckbox { /** @var TemplateResponseDocumentStaticFieldCheckbox $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldCheckbox::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php index 42c79cd09..f2dd9b569 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldDateSigned extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldDateSigned extends TemplateResponseDocu 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'date_signed'; + $this->setIfExists('type', $data ?? [], 'date_signed'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldDateSigned { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldDateSigned { /** @var TemplateResponseDocumentStaticFieldDateSigned $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldDateSigned::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php index 299898fbf..60528410a 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldDropdown extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldDropdown extends TemplateResponseDocume 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'dropdown'; + $this->setIfExists('type', $data ?? [], 'dropdown'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldDropdown { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldDropdown { /** @var TemplateResponseDocumentStaticFieldDropdown $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldDropdown::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php index 9cb8555af..c9cc39ed4 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldHyperlink extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldHyperlink extends TemplateResponseDocum 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'hyperlink'; + $this->setIfExists('type', $data ?? [], 'hyperlink'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldHyperlink { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldHyperlink { /** @var TemplateResponseDocumentStaticFieldHyperlink $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldHyperlink::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php index df100948b..4337e9bdb 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldInitials extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldInitials extends TemplateResponseDocume 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'initials'; + $this->setIfExists('type', $data ?? [], 'initials'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldInitials { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldInitials { /** @var TemplateResponseDocumentStaticFieldInitials $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldInitials::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php index 72dfaf30b..9c0f52d2d 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldRadio extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldRadio extends TemplateResponseDocumentS 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'radio'; + $this->setIfExists('type', $data ?? [], 'radio'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldRadio { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldRadio { /** @var TemplateResponseDocumentStaticFieldRadio $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldRadio::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php index c98ba38ed..d52f314ea 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldSignature extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldSignature extends TemplateResponseDocum 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'signature'; + $this->setIfExists('type', $data ?? [], 'signature'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldSignature { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldSignature { /** @var TemplateResponseDocumentStaticFieldSignature $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldSignature::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php index 8b2bf3f23..2418051e2 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,6 +28,7 @@ namespace Dropbox\Sign\Model; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use ReturnTypeWillChange; /** @@ -36,11 +36,8 @@ * * @category Class * @description This class extends `TemplateResponseDocumentStaticFieldBase` - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateResponseDocumentStaticFieldText extends TemplateResponseDocumentStaticFieldBase { @@ -73,6 +70,22 @@ class TemplateResponseDocumentStaticFieldText extends TemplateResponseDocumentSt 'type' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -93,6 +106,50 @@ public static function openAPIFormats() return self::$openAPIFormats + parent::openAPIFormats(); } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables + parent::openAPINullables(); + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -165,32 +222,48 @@ public function getModelName() /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { parent::__construct($data); - $this->container['type'] = $data['type'] ?? 'text'; + $this->setIfExists('type', $data ?? [], 'text'); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseDocumentStaticFieldText { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseDocumentStaticFieldText { /** @var TemplateResponseDocumentStaticFieldText $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldText::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -205,7 +278,6 @@ public function listInvalidProperties() if ($this->container['type'] === null) { $invalidProperties[] = "'type' can't be null"; } - return $invalidProperties; } @@ -239,6 +311,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $this->container['type'] = $type; return $this; @@ -247,12 +322,10 @@ public function setType(string $type) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -260,7 +333,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -273,13 +346,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -291,12 +362,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -305,8 +374,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -323,7 +392,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php index 02e025d6b..f667100e0 100644 --- a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php +++ b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Average text length in this field. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseFieldAvgTextLength implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class TemplateResponseFieldAvgTextLength implements ModelInterface, ArrayAccess, 'num_chars_per_line' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'num_lines' => false, + 'num_chars_per_line' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['num_lines'] = $data['num_lines'] ?? null; - $this->container['num_chars_per_line'] = $data['num_chars_per_line'] ?? null; + $this->setIfExists('num_lines', $data ?? [], null); + $this->setIfExists('num_chars_per_line', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseFieldAvgTextLength { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseFieldAvgTextLength { /** @var TemplateResponseFieldAvgTextLength $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseFieldAvgTextLength::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): TemplateResponseFieldAvgTextLength */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getNumLines() */ public function setNumLines(?int $num_lines) { + if (is_null($num_lines)) { + throw new InvalidArgumentException('non-nullable num_lines cannot be null'); + } $this->container['num_lines'] = $num_lines; return $this; @@ -273,6 +347,9 @@ public function getNumCharsPerLine() */ public function setNumCharsPerLine(?int $num_chars_per_line) { + if (is_null($num_chars_per_line)) { + throw new InvalidArgumentException('non-nullable num_chars_per_line cannot be null'); + } $this->container['num_chars_per_line'] = $num_chars_per_line; return $this; @@ -281,12 +358,10 @@ public function setNumCharsPerLine(?int $num_chars_per_line) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -294,7 +369,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -307,13 +382,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -325,12 +398,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -339,8 +410,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -357,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateResponseSignerRole.php b/sdks/php/src/Model/TemplateResponseSignerRole.php index 1f2e9d9d4..c41a61f2e 100644 --- a/sdks/php/src/Model/TemplateResponseSignerRole.php +++ b/sdks/php/src/Model/TemplateResponseSignerRole.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateResponseSignerRole Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateResponseSignerRole implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class TemplateResponseSignerRole implements ModelInterface, ArrayAccess, JsonSer 'order' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'name' => false, + 'order' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['name'] = $data['name'] ?? null; - $this->container['order'] = $data['order'] ?? null; + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('order', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateResponseSignerRole { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateResponseSignerRole { /** @var TemplateResponseSignerRole $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateResponseSignerRole::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): TemplateResponseSignerRole */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getName() */ public function setName(?string $name) { + if (is_null($name)) { + throw new InvalidArgumentException('non-nullable name cannot be null'); + } $this->container['name'] = $name; return $this; @@ -272,6 +346,9 @@ public function getOrder() */ public function setOrder(?int $order) { + if (is_null($order)) { + throw new InvalidArgumentException('non-nullable order cannot be null'); + } $this->container['order'] = $order; return $this; @@ -280,12 +357,10 @@ public function setOrder(?int $order) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesRequest.php b/sdks/php/src/Model/TemplateUpdateFilesRequest.php index 29ec13356..28d067d89 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesRequest.php +++ b/sdks/php/src/Model/TemplateUpdateFilesRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * TemplateUpdateFilesRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class TemplateUpdateFilesRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -86,6 +82,27 @@ class TemplateUpdateFilesRequest implements ModelInterface, ArrayAccess, JsonSer 'test_mode' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'files' => false, + 'file_urls' => false, + 'message' => false, + 'subject' => false, + 'test_mode' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -106,6 +123,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -193,42 +254,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['message'] = $data['message'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateUpdateFilesRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateUpdateFilesRequest { /** @var TemplateUpdateFilesRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateUpdateFilesRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -281,6 +358,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -305,6 +385,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -329,6 +412,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -353,7 +439,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling TemplateUpdateFilesRequest., must be smaller than or equal to 5000.'); } @@ -381,7 +470,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 100)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 100) { throw new InvalidArgumentException('invalid length for $subject when calling TemplateUpdateFilesRequest., must be smaller than or equal to 100.'); } @@ -409,6 +501,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -417,12 +512,10 @@ public function setTestMode(?bool $test_mode) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -430,7 +523,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -443,13 +536,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -461,12 +552,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -475,8 +564,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -493,7 +582,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponse.php b/sdks/php/src/Model/TemplateUpdateFilesResponse.php index b634cfbb2..5537f648b 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponse.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * TemplateUpdateFilesResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateUpdateFilesResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +71,22 @@ class TemplateUpdateFilesResponse implements ModelInterface, ArrayAccess, JsonSe 'template' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +223,53 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template'] = $data['template'] ?? null; + $this->setIfExists('template', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateUpdateFilesResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateUpdateFilesResponse { /** @var TemplateUpdateFilesResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateUpdateFilesResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -207,9 +279,7 @@ public static function init(array $data): TemplateUpdateFilesResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +312,9 @@ public function getTemplate() */ public function setTemplate(?TemplateUpdateFilesResponseTemplate $template) { + if (is_null($template)) { + throw new InvalidArgumentException('non-nullable template cannot be null'); + } $this->container['template'] = $template; return $this; @@ -250,12 +323,10 @@ public function setTemplate(?TemplateUpdateFilesResponseTemplate $template) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +334,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +347,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +363,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +375,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -326,7 +393,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php index 4fb057faa..aa5cd8a9f 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description Contains template id - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class TemplateUpdateFilesResponseTemplate implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +74,23 @@ class TemplateUpdateFilesResponseTemplate implements ModelInterface, ArrayAccess 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'template_id' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -173,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['template_id'] = $data['template_id'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('template_id', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): TemplateUpdateFilesResponseTemplate { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): TemplateUpdateFilesResponseTemplate { /** @var TemplateUpdateFilesResponseTemplate $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, TemplateUpdateFilesResponseTemplate::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -214,9 +287,7 @@ public static function init(array $data): TemplateUpdateFilesResponseTemplate */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -249,6 +320,9 @@ public function getTemplateId() */ public function setTemplateId(?string $template_id) { + if (is_null($template_id)) { + throw new InvalidArgumentException('non-nullable template_id cannot be null'); + } $this->container['template_id'] = $template_id; return $this; @@ -275,6 +349,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -283,12 +360,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -296,7 +371,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -309,13 +384,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -327,12 +400,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -341,8 +412,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -359,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php index 74a0a185b..4eddfe4c0 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,9 @@ * UnclaimedDraftCreateEmbeddedRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team + * @description * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class UnclaimedDraftCreateEmbeddedRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -146,6 +143,57 @@ class UnclaimedDraftCreateEmbeddedRequest implements ModelInterface, ArrayAccess 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'requester_email_address' => false, + 'files' => false, + 'file_urls' => false, + 'allow_ccs' => false, + 'allow_decline' => false, + 'allow_reassign' => false, + 'attachments' => false, + 'cc_email_addresses' => false, + 'custom_fields' => false, + 'editor_options' => false, + 'field_options' => false, + 'force_signer_page' => false, + 'force_subject_message' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'form_fields_per_document' => false, + 'hide_text_tags' => false, + 'hold_request' => false, + 'is_for_embedded_signing' => false, + 'message' => false, + 'metadata' => false, + 'requesting_redirect_url' => false, + 'show_preview' => false, + 'show_progress_stepper' => false, + 'signers' => false, + 'signing_options' => false, + 'signing_redirect_url' => false, + 'skip_me_now' => false, + 'subject' => false, + 'test_mode' => false, + 'type' => false, + 'use_preexisting_fields' => false, + 'use_text_tags' => false, + 'populate_auto_fill_fields' => false, + 'expires_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -166,6 +214,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -359,72 +451,88 @@ public function getTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['requester_email_address'] = $data['requester_email_address'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['allow_ccs'] = $data['allow_ccs'] ?? true; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['editor_options'] = $data['editor_options'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['force_signer_page'] = $data['force_signer_page'] ?? false; - $this->container['force_subject_message'] = $data['force_subject_message'] ?? false; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['hide_text_tags'] = $data['hide_text_tags'] ?? false; - $this->container['hold_request'] = $data['hold_request'] ?? false; - $this->container['is_for_embedded_signing'] = $data['is_for_embedded_signing'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['requesting_redirect_url'] = $data['requesting_redirect_url'] ?? null; - $this->container['show_preview'] = $data['show_preview'] ?? null; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['skip_me_now'] = $data['skip_me_now'] ?? false; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['type'] = $data['type'] ?? 'request_signature'; - $this->container['use_preexisting_fields'] = $data['use_preexisting_fields'] ?? false; - $this->container['use_text_tags'] = $data['use_text_tags'] ?? false; - $this->container['populate_auto_fill_fields'] = $data['populate_auto_fill_fields'] ?? false; - $this->container['expires_at'] = $data['expires_at'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('requester_email_address', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('allow_ccs', $data ?? [], true); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('editor_options', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('force_signer_page', $data ?? [], false); + $this->setIfExists('force_subject_message', $data ?? [], false); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('hide_text_tags', $data ?? [], false); + $this->setIfExists('hold_request', $data ?? [], false); + $this->setIfExists('is_for_embedded_signing', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('requesting_redirect_url', $data ?? [], null); + $this->setIfExists('show_preview', $data ?? [], null); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('skip_me_now', $data ?? [], false); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('type', $data ?? [], 'request_signature'); + $this->setIfExists('use_preexisting_fields', $data ?? [], false); + $this->setIfExists('use_text_tags', $data ?? [], false); + $this->setIfExists('populate_auto_fill_fields', $data ?? [], false); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftCreateEmbeddedRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftCreateEmbeddedRequest { /** @var UnclaimedDraftCreateEmbeddedRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateEmbeddedRequest::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -492,6 +600,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -516,6 +627,9 @@ public function getRequesterEmailAddress() */ public function setRequesterEmailAddress(string $requester_email_address) { + if (is_null($requester_email_address)) { + throw new InvalidArgumentException('non-nullable requester_email_address cannot be null'); + } $this->container['requester_email_address'] = $requester_email_address; return $this; @@ -540,6 +654,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -564,6 +681,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -588,6 +708,9 @@ public function getAllowCcs() */ public function setAllowCcs(?bool $allow_ccs) { + if (is_null($allow_ccs)) { + throw new InvalidArgumentException('non-nullable allow_ccs cannot be null'); + } $this->container['allow_ccs'] = $allow_ccs; return $this; @@ -612,6 +735,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -636,6 +762,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -660,6 +789,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -684,6 +816,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -708,6 +843,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -732,6 +870,9 @@ public function getEditorOptions() */ public function setEditorOptions(?SubEditorOptions $editor_options) { + if (is_null($editor_options)) { + throw new InvalidArgumentException('non-nullable editor_options cannot be null'); + } $this->container['editor_options'] = $editor_options; return $this; @@ -756,6 +897,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -780,6 +924,9 @@ public function getForceSignerPage() */ public function setForceSignerPage(?bool $force_signer_page) { + if (is_null($force_signer_page)) { + throw new InvalidArgumentException('non-nullable force_signer_page cannot be null'); + } $this->container['force_signer_page'] = $force_signer_page; return $this; @@ -804,6 +951,9 @@ public function getForceSubjectMessage() */ public function setForceSubjectMessage(?bool $force_subject_message) { + if (is_null($force_subject_message)) { + throw new InvalidArgumentException('non-nullable force_subject_message cannot be null'); + } $this->container['force_subject_message'] = $force_subject_message; return $this; @@ -828,6 +978,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -852,6 +1005,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -876,6 +1032,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(?array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -900,6 +1059,9 @@ public function getHideTextTags() */ public function setHideTextTags(?bool $hide_text_tags) { + if (is_null($hide_text_tags)) { + throw new InvalidArgumentException('non-nullable hide_text_tags cannot be null'); + } $this->container['hide_text_tags'] = $hide_text_tags; return $this; @@ -924,6 +1086,9 @@ public function getHoldRequest() */ public function setHoldRequest(?bool $hold_request) { + if (is_null($hold_request)) { + throw new InvalidArgumentException('non-nullable hold_request cannot be null'); + } $this->container['hold_request'] = $hold_request; return $this; @@ -948,6 +1113,9 @@ public function getIsForEmbeddedSigning() */ public function setIsForEmbeddedSigning(?bool $is_for_embedded_signing) { + if (is_null($is_for_embedded_signing)) { + throw new InvalidArgumentException('non-nullable is_for_embedded_signing cannot be null'); + } $this->container['is_for_embedded_signing'] = $is_for_embedded_signing; return $this; @@ -972,7 +1140,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling UnclaimedDraftCreateEmbeddedRequest., must be smaller than or equal to 5000.'); } @@ -1000,6 +1171,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -1024,6 +1199,9 @@ public function getRequestingRedirectUrl() */ public function setRequestingRedirectUrl(?string $requesting_redirect_url) { + if (is_null($requesting_redirect_url)) { + throw new InvalidArgumentException('non-nullable requesting_redirect_url cannot be null'); + } $this->container['requesting_redirect_url'] = $requesting_redirect_url; return $this; @@ -1048,6 +1226,9 @@ public function getShowPreview() */ public function setShowPreview(?bool $show_preview) { + if (is_null($show_preview)) { + throw new InvalidArgumentException('non-nullable show_preview cannot be null'); + } $this->container['show_preview'] = $show_preview; return $this; @@ -1072,6 +1253,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -1096,6 +1280,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -1120,6 +1307,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -1144,6 +1334,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -1168,6 +1361,9 @@ public function getSkipMeNow() */ public function setSkipMeNow(?bool $skip_me_now) { + if (is_null($skip_me_now)) { + throw new InvalidArgumentException('non-nullable skip_me_now cannot be null'); + } $this->container['skip_me_now'] = $skip_me_now; return $this; @@ -1192,7 +1388,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 200)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 200) { throw new InvalidArgumentException('invalid length for $subject when calling UnclaimedDraftCreateEmbeddedRequest., must be smaller than or equal to 200.'); } @@ -1220,6 +1419,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -1244,8 +1446,11 @@ public function getType() */ public function setType(?string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); - if (!is_null($type) && !in_array($type, $allowedValues, true)) { + if (!in_array($type, $allowedValues, true)) { throw new InvalidArgumentException( sprintf( "Invalid value '%s' for 'type', must be one of '%s'", @@ -1278,6 +1483,9 @@ public function getUsePreexistingFields() */ public function setUsePreexistingFields(?bool $use_preexisting_fields) { + if (is_null($use_preexisting_fields)) { + throw new InvalidArgumentException('non-nullable use_preexisting_fields cannot be null'); + } $this->container['use_preexisting_fields'] = $use_preexisting_fields; return $this; @@ -1302,6 +1510,9 @@ public function getUseTextTags() */ public function setUseTextTags(?bool $use_text_tags) { + if (is_null($use_text_tags)) { + throw new InvalidArgumentException('non-nullable use_text_tags cannot be null'); + } $this->container['use_text_tags'] = $use_text_tags; return $this; @@ -1326,6 +1537,9 @@ public function getPopulateAutoFillFields() */ public function setPopulateAutoFillFields(?bool $populate_auto_fill_fields) { + if (is_null($populate_auto_fill_fields)) { + throw new InvalidArgumentException('non-nullable populate_auto_fill_fields cannot be null'); + } $this->container['populate_auto_fill_fields'] = $populate_auto_fill_fields; return $this; @@ -1350,6 +1564,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -1358,12 +1582,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1371,7 +1593,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -1384,13 +1606,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1402,12 +1622,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1416,8 +1634,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1434,7 +1652,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php index d3cffebce..19787628a 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,8 @@ * UnclaimedDraftCreateEmbeddedWithTemplateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class UnclaimedDraftCreateEmbeddedWithTemplateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -134,6 +130,51 @@ class UnclaimedDraftCreateEmbeddedWithTemplateRequest implements ModelInterface, 'allow_ccs' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'requester_email_address' => false, + 'template_ids' => false, + 'allow_decline' => false, + 'allow_reassign' => false, + 'ccs' => false, + 'custom_fields' => false, + 'editor_options' => false, + 'field_options' => false, + 'files' => false, + 'file_urls' => false, + 'force_signer_roles' => false, + 'force_subject_message' => false, + 'hold_request' => false, + 'is_for_embedded_signing' => false, + 'message' => false, + 'metadata' => false, + 'preview_only' => false, + 'requesting_redirect_url' => false, + 'show_preview' => false, + 'show_progress_stepper' => false, + 'signers' => false, + 'signing_options' => false, + 'signing_redirect_url' => false, + 'skip_me_now' => false, + 'subject' => false, + 'test_mode' => false, + 'title' => false, + 'populate_auto_fill_fields' => false, + 'allow_ccs' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -154,6 +195,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -313,66 +398,82 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['requester_email_address'] = $data['requester_email_address'] ?? null; - $this->container['template_ids'] = $data['template_ids'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['allow_reassign'] = $data['allow_reassign'] ?? false; - $this->container['ccs'] = $data['ccs'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['editor_options'] = $data['editor_options'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['force_signer_roles'] = $data['force_signer_roles'] ?? false; - $this->container['force_subject_message'] = $data['force_subject_message'] ?? false; - $this->container['hold_request'] = $data['hold_request'] ?? false; - $this->container['is_for_embedded_signing'] = $data['is_for_embedded_signing'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['preview_only'] = $data['preview_only'] ?? false; - $this->container['requesting_redirect_url'] = $data['requesting_redirect_url'] ?? null; - $this->container['show_preview'] = $data['show_preview'] ?? false; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['skip_me_now'] = $data['skip_me_now'] ?? false; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['title'] = $data['title'] ?? null; - $this->container['populate_auto_fill_fields'] = $data['populate_auto_fill_fields'] ?? false; - $this->container['allow_ccs'] = $data['allow_ccs'] ?? false; - } - - /** @deprecated use ::init() */ + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('requester_email_address', $data ?? [], null); + $this->setIfExists('template_ids', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('allow_reassign', $data ?? [], false); + $this->setIfExists('ccs', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('editor_options', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('force_signer_roles', $data ?? [], false); + $this->setIfExists('force_subject_message', $data ?? [], false); + $this->setIfExists('hold_request', $data ?? [], false); + $this->setIfExists('is_for_embedded_signing', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('preview_only', $data ?? [], false); + $this->setIfExists('requesting_redirect_url', $data ?? [], null); + $this->setIfExists('show_preview', $data ?? [], false); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('skip_me_now', $data ?? [], false); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('title', $data ?? [], null); + $this->setIfExists('populate_auto_fill_fields', $data ?? [], false); + $this->setIfExists('allow_ccs', $data ?? [], false); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftCreateEmbeddedWithTemplateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftCreateEmbeddedWithTemplateRequest { /** @var UnclaimedDraftCreateEmbeddedWithTemplateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateEmbeddedWithTemplateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -438,6 +539,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -462,6 +566,9 @@ public function getRequesterEmailAddress() */ public function setRequesterEmailAddress(string $requester_email_address) { + if (is_null($requester_email_address)) { + throw new InvalidArgumentException('non-nullable requester_email_address cannot be null'); + } $this->container['requester_email_address'] = $requester_email_address; return $this; @@ -486,6 +593,9 @@ public function getTemplateIds() */ public function setTemplateIds(array $template_ids) { + if (is_null($template_ids)) { + throw new InvalidArgumentException('non-nullable template_ids cannot be null'); + } $this->container['template_ids'] = $template_ids; return $this; @@ -510,6 +620,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -534,6 +647,9 @@ public function getAllowReassign() */ public function setAllowReassign(?bool $allow_reassign) { + if (is_null($allow_reassign)) { + throw new InvalidArgumentException('non-nullable allow_reassign cannot be null'); + } $this->container['allow_reassign'] = $allow_reassign; return $this; @@ -558,6 +674,9 @@ public function getCcs() */ public function setCcs(?array $ccs) { + if (is_null($ccs)) { + throw new InvalidArgumentException('non-nullable ccs cannot be null'); + } $this->container['ccs'] = $ccs; return $this; @@ -582,6 +701,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -606,6 +728,9 @@ public function getEditorOptions() */ public function setEditorOptions(?SubEditorOptions $editor_options) { + if (is_null($editor_options)) { + throw new InvalidArgumentException('non-nullable editor_options cannot be null'); + } $this->container['editor_options'] = $editor_options; return $this; @@ -630,6 +755,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -654,6 +782,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -678,6 +809,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -702,6 +836,9 @@ public function getForceSignerRoles() */ public function setForceSignerRoles(?bool $force_signer_roles) { + if (is_null($force_signer_roles)) { + throw new InvalidArgumentException('non-nullable force_signer_roles cannot be null'); + } $this->container['force_signer_roles'] = $force_signer_roles; return $this; @@ -726,6 +863,9 @@ public function getForceSubjectMessage() */ public function setForceSubjectMessage(?bool $force_subject_message) { + if (is_null($force_subject_message)) { + throw new InvalidArgumentException('non-nullable force_subject_message cannot be null'); + } $this->container['force_subject_message'] = $force_subject_message; return $this; @@ -750,6 +890,9 @@ public function getHoldRequest() */ public function setHoldRequest(?bool $hold_request) { + if (is_null($hold_request)) { + throw new InvalidArgumentException('non-nullable hold_request cannot be null'); + } $this->container['hold_request'] = $hold_request; return $this; @@ -774,6 +917,9 @@ public function getIsForEmbeddedSigning() */ public function setIsForEmbeddedSigning(?bool $is_for_embedded_signing) { + if (is_null($is_for_embedded_signing)) { + throw new InvalidArgumentException('non-nullable is_for_embedded_signing cannot be null'); + } $this->container['is_for_embedded_signing'] = $is_for_embedded_signing; return $this; @@ -798,7 +944,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling UnclaimedDraftCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 5000.'); } @@ -826,6 +975,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -850,6 +1003,9 @@ public function getPreviewOnly() */ public function setPreviewOnly(?bool $preview_only) { + if (is_null($preview_only)) { + throw new InvalidArgumentException('non-nullable preview_only cannot be null'); + } $this->container['preview_only'] = $preview_only; return $this; @@ -874,6 +1030,9 @@ public function getRequestingRedirectUrl() */ public function setRequestingRedirectUrl(?string $requesting_redirect_url) { + if (is_null($requesting_redirect_url)) { + throw new InvalidArgumentException('non-nullable requesting_redirect_url cannot be null'); + } $this->container['requesting_redirect_url'] = $requesting_redirect_url; return $this; @@ -898,6 +1057,9 @@ public function getShowPreview() */ public function setShowPreview(?bool $show_preview) { + if (is_null($show_preview)) { + throw new InvalidArgumentException('non-nullable show_preview cannot be null'); + } $this->container['show_preview'] = $show_preview; return $this; @@ -922,6 +1084,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -946,6 +1111,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -970,6 +1138,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -994,6 +1165,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -1018,6 +1192,9 @@ public function getSkipMeNow() */ public function setSkipMeNow(?bool $skip_me_now) { + if (is_null($skip_me_now)) { + throw new InvalidArgumentException('non-nullable skip_me_now cannot be null'); + } $this->container['skip_me_now'] = $skip_me_now; return $this; @@ -1042,7 +1219,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 255)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 255) { throw new InvalidArgumentException('invalid length for $subject when calling UnclaimedDraftCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -1070,6 +1250,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -1094,7 +1277,10 @@ public function getTitle() */ public function setTitle(?string $title) { - if (!is_null($title) && (mb_strlen($title) > 255)) { + if (is_null($title)) { + throw new InvalidArgumentException('non-nullable title cannot be null'); + } + if (mb_strlen($title) > 255) { throw new InvalidArgumentException('invalid length for $title when calling UnclaimedDraftCreateEmbeddedWithTemplateRequest., must be smaller than or equal to 255.'); } @@ -1122,6 +1308,9 @@ public function getPopulateAutoFillFields() */ public function setPopulateAutoFillFields(?bool $populate_auto_fill_fields) { + if (is_null($populate_auto_fill_fields)) { + throw new InvalidArgumentException('non-nullable populate_auto_fill_fields cannot be null'); + } $this->container['populate_auto_fill_fields'] = $populate_auto_fill_fields; return $this; @@ -1146,6 +1335,9 @@ public function getAllowCcs() */ public function setAllowCcs(?bool $allow_ccs) { + if (is_null($allow_ccs)) { + throw new InvalidArgumentException('non-nullable allow_ccs cannot be null'); + } $this->container['allow_ccs'] = $allow_ccs; return $this; @@ -1154,12 +1346,10 @@ public function setAllowCcs(?bool $allow_ccs) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1167,7 +1357,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -1180,13 +1370,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1198,12 +1386,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1212,8 +1398,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1230,7 +1416,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php index 3eaaa3840..30bba17b3 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -39,11 +38,9 @@ * UnclaimedDraftCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team + * @description * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class UnclaimedDraftCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -122,6 +119,45 @@ class UnclaimedDraftCreateRequest implements ModelInterface, ArrayAccess, JsonSe 'expires_at' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'type' => false, + 'files' => false, + 'file_urls' => false, + 'allow_decline' => false, + 'attachments' => false, + 'cc_email_addresses' => false, + 'client_id' => false, + 'custom_fields' => false, + 'field_options' => false, + 'form_field_groups' => false, + 'form_field_rules' => false, + 'form_fields_per_document' => false, + 'hide_text_tags' => false, + 'message' => false, + 'metadata' => false, + 'show_progress_stepper' => false, + 'signers' => false, + 'signing_options' => false, + 'signing_redirect_url' => false, + 'subject' => false, + 'test_mode' => false, + 'use_preexisting_fields' => false, + 'use_text_tags' => false, + 'expires_at' => true, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -142,6 +178,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -299,60 +379,76 @@ public function getTypeAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['type'] = $data['type'] ?? null; - $this->container['files'] = $data['files'] ?? null; - $this->container['file_urls'] = $data['file_urls'] ?? null; - $this->container['allow_decline'] = $data['allow_decline'] ?? false; - $this->container['attachments'] = $data['attachments'] ?? null; - $this->container['cc_email_addresses'] = $data['cc_email_addresses'] ?? null; - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['custom_fields'] = $data['custom_fields'] ?? null; - $this->container['field_options'] = $data['field_options'] ?? null; - $this->container['form_field_groups'] = $data['form_field_groups'] ?? null; - $this->container['form_field_rules'] = $data['form_field_rules'] ?? null; - $this->container['form_fields_per_document'] = $data['form_fields_per_document'] ?? null; - $this->container['hide_text_tags'] = $data['hide_text_tags'] ?? false; - $this->container['message'] = $data['message'] ?? null; - $this->container['metadata'] = $data['metadata'] ?? null; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['signers'] = $data['signers'] ?? null; - $this->container['signing_options'] = $data['signing_options'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['subject'] = $data['subject'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; - $this->container['use_preexisting_fields'] = $data['use_preexisting_fields'] ?? false; - $this->container['use_text_tags'] = $data['use_text_tags'] ?? false; - $this->container['expires_at'] = $data['expires_at'] ?? null; - } - - /** @deprecated use ::init() */ + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('files', $data ?? [], null); + $this->setIfExists('file_urls', $data ?? [], null); + $this->setIfExists('allow_decline', $data ?? [], false); + $this->setIfExists('attachments', $data ?? [], null); + $this->setIfExists('cc_email_addresses', $data ?? [], null); + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('custom_fields', $data ?? [], null); + $this->setIfExists('field_options', $data ?? [], null); + $this->setIfExists('form_field_groups', $data ?? [], null); + $this->setIfExists('form_field_rules', $data ?? [], null); + $this->setIfExists('form_fields_per_document', $data ?? [], null); + $this->setIfExists('hide_text_tags', $data ?? [], false); + $this->setIfExists('message', $data ?? [], null); + $this->setIfExists('metadata', $data ?? [], null); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('signers', $data ?? [], null); + $this->setIfExists('signing_options', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('subject', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); + $this->setIfExists('use_preexisting_fields', $data ?? [], false); + $this->setIfExists('use_text_tags', $data ?? [], false); + $this->setIfExists('expires_at', $data ?? [], null); + } + + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftCreateRequest { /** @var UnclaimedDraftCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -417,6 +513,9 @@ public function getType() */ public function setType(string $type) { + if (is_null($type)) { + throw new InvalidArgumentException('non-nullable type cannot be null'); + } $allowedValues = $this->getTypeAllowableValues(); if (!in_array($type, $allowedValues, true)) { throw new InvalidArgumentException( @@ -451,6 +550,9 @@ public function getFiles() */ public function setFiles(?array $files) { + if (is_null($files)) { + throw new InvalidArgumentException('non-nullable files cannot be null'); + } $this->container['files'] = $files; return $this; @@ -475,6 +577,9 @@ public function getFileUrls() */ public function setFileUrls(?array $file_urls) { + if (is_null($file_urls)) { + throw new InvalidArgumentException('non-nullable file_urls cannot be null'); + } $this->container['file_urls'] = $file_urls; return $this; @@ -499,6 +604,9 @@ public function getAllowDecline() */ public function setAllowDecline(?bool $allow_decline) { + if (is_null($allow_decline)) { + throw new InvalidArgumentException('non-nullable allow_decline cannot be null'); + } $this->container['allow_decline'] = $allow_decline; return $this; @@ -523,6 +631,9 @@ public function getAttachments() */ public function setAttachments(?array $attachments) { + if (is_null($attachments)) { + throw new InvalidArgumentException('non-nullable attachments cannot be null'); + } $this->container['attachments'] = $attachments; return $this; @@ -547,6 +658,9 @@ public function getCcEmailAddresses() */ public function setCcEmailAddresses(?array $cc_email_addresses) { + if (is_null($cc_email_addresses)) { + throw new InvalidArgumentException('non-nullable cc_email_addresses cannot be null'); + } $this->container['cc_email_addresses'] = $cc_email_addresses; return $this; @@ -571,6 +685,9 @@ public function getClientId() */ public function setClientId(?string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -595,6 +712,9 @@ public function getCustomFields() */ public function setCustomFields(?array $custom_fields) { + if (is_null($custom_fields)) { + throw new InvalidArgumentException('non-nullable custom_fields cannot be null'); + } $this->container['custom_fields'] = $custom_fields; return $this; @@ -619,6 +739,9 @@ public function getFieldOptions() */ public function setFieldOptions(?SubFieldOptions $field_options) { + if (is_null($field_options)) { + throw new InvalidArgumentException('non-nullable field_options cannot be null'); + } $this->container['field_options'] = $field_options; return $this; @@ -643,6 +766,9 @@ public function getFormFieldGroups() */ public function setFormFieldGroups(?array $form_field_groups) { + if (is_null($form_field_groups)) { + throw new InvalidArgumentException('non-nullable form_field_groups cannot be null'); + } $this->container['form_field_groups'] = $form_field_groups; return $this; @@ -667,6 +793,9 @@ public function getFormFieldRules() */ public function setFormFieldRules(?array $form_field_rules) { + if (is_null($form_field_rules)) { + throw new InvalidArgumentException('non-nullable form_field_rules cannot be null'); + } $this->container['form_field_rules'] = $form_field_rules; return $this; @@ -691,6 +820,9 @@ public function getFormFieldsPerDocument() */ public function setFormFieldsPerDocument(?array $form_fields_per_document) { + if (is_null($form_fields_per_document)) { + throw new InvalidArgumentException('non-nullable form_fields_per_document cannot be null'); + } $this->container['form_fields_per_document'] = $form_fields_per_document; return $this; @@ -715,6 +847,9 @@ public function getHideTextTags() */ public function setHideTextTags(?bool $hide_text_tags) { + if (is_null($hide_text_tags)) { + throw new InvalidArgumentException('non-nullable hide_text_tags cannot be null'); + } $this->container['hide_text_tags'] = $hide_text_tags; return $this; @@ -739,7 +874,10 @@ public function getMessage() */ public function setMessage(?string $message) { - if (!is_null($message) && (mb_strlen($message) > 5000)) { + if (is_null($message)) { + throw new InvalidArgumentException('non-nullable message cannot be null'); + } + if (mb_strlen($message) > 5000) { throw new InvalidArgumentException('invalid length for $message when calling UnclaimedDraftCreateRequest., must be smaller than or equal to 5000.'); } @@ -767,6 +905,10 @@ public function getMetadata() */ public function setMetadata(?array $metadata) { + if (is_null($metadata)) { + throw new InvalidArgumentException('non-nullable metadata cannot be null'); + } + $this->container['metadata'] = $metadata; return $this; @@ -791,6 +933,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -815,6 +960,9 @@ public function getSigners() */ public function setSigners(?array $signers) { + if (is_null($signers)) { + throw new InvalidArgumentException('non-nullable signers cannot be null'); + } $this->container['signers'] = $signers; return $this; @@ -839,6 +987,9 @@ public function getSigningOptions() */ public function setSigningOptions(?SubSigningOptions $signing_options) { + if (is_null($signing_options)) { + throw new InvalidArgumentException('non-nullable signing_options cannot be null'); + } $this->container['signing_options'] = $signing_options; return $this; @@ -863,6 +1014,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -887,7 +1041,10 @@ public function getSubject() */ public function setSubject(?string $subject) { - if (!is_null($subject) && (mb_strlen($subject) > 200)) { + if (is_null($subject)) { + throw new InvalidArgumentException('non-nullable subject cannot be null'); + } + if (mb_strlen($subject) > 200) { throw new InvalidArgumentException('invalid length for $subject when calling UnclaimedDraftCreateRequest., must be smaller than or equal to 200.'); } @@ -915,6 +1072,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -939,6 +1099,9 @@ public function getUsePreexistingFields() */ public function setUsePreexistingFields(?bool $use_preexisting_fields) { + if (is_null($use_preexisting_fields)) { + throw new InvalidArgumentException('non-nullable use_preexisting_fields cannot be null'); + } $this->container['use_preexisting_fields'] = $use_preexisting_fields; return $this; @@ -963,6 +1126,9 @@ public function getUseTextTags() */ public function setUseTextTags(?bool $use_text_tags) { + if (is_null($use_text_tags)) { + throw new InvalidArgumentException('non-nullable use_text_tags cannot be null'); + } $this->container['use_text_tags'] = $use_text_tags; return $this; @@ -987,6 +1153,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -995,12 +1171,10 @@ public function setExpiresAt(?int $expires_at) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -1008,7 +1182,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -1021,13 +1195,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -1039,12 +1211,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -1053,8 +1223,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -1071,7 +1241,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php index a055a5c4c..4abec45dd 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * UnclaimedDraftCreateResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class UnclaimedDraftCreateResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class UnclaimedDraftCreateResponse implements ModelInterface, ArrayAccess, JsonS 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'unclaimed_draft' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['unclaimed_draft'] = $data['unclaimed_draft'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('unclaimed_draft', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftCreateResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftCreateResponse { /** @var UnclaimedDraftCreateResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +286,7 @@ public static function init(array $data): UnclaimedDraftCreateResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +319,9 @@ public function getUnclaimedDraft() */ public function setUnclaimedDraft(?UnclaimedDraftResponse $unclaimed_draft) { + if (is_null($unclaimed_draft)) { + throw new InvalidArgumentException('non-nullable unclaimed_draft cannot be null'); + } $this->container['unclaimed_draft'] = $unclaimed_draft; return $this; @@ -272,6 +346,9 @@ public function getWarnings() */ public function setWarnings(?array $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +357,10 @@ public function setWarnings(?array $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +368,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +381,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +397,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +409,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -356,7 +427,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php index 3e15395f8..113c12845 100644 --- a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * UnclaimedDraftEditAndResendRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class UnclaimedDraftEditAndResendRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -88,6 +85,29 @@ class UnclaimedDraftEditAndResendRequest implements ModelInterface, ArrayAccess, 'test_mode' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'client_id' => false, + 'editor_options' => false, + 'is_for_embedded_signing' => false, + 'requester_email_address' => false, + 'requesting_redirect_url' => false, + 'show_progress_stepper' => false, + 'signing_redirect_url' => false, + 'test_mode' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -108,6 +128,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -201,44 +265,60 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['client_id'] = $data['client_id'] ?? null; - $this->container['editor_options'] = $data['editor_options'] ?? null; - $this->container['is_for_embedded_signing'] = $data['is_for_embedded_signing'] ?? null; - $this->container['requester_email_address'] = $data['requester_email_address'] ?? null; - $this->container['requesting_redirect_url'] = $data['requesting_redirect_url'] ?? null; - $this->container['show_progress_stepper'] = $data['show_progress_stepper'] ?? true; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? false; + $this->setIfExists('client_id', $data ?? [], null); + $this->setIfExists('editor_options', $data ?? [], null); + $this->setIfExists('is_for_embedded_signing', $data ?? [], null); + $this->setIfExists('requester_email_address', $data ?? [], null); + $this->setIfExists('requesting_redirect_url', $data ?? [], null); + $this->setIfExists('show_progress_stepper', $data ?? [], true); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], false); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftEditAndResendRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftEditAndResendRequest { /** @var UnclaimedDraftEditAndResendRequest $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftEditAndResendRequest::class, ); + } - return $obj; + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $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,7 +333,6 @@ public function listInvalidProperties() if ($this->container['client_id'] === null) { $invalidProperties[] = "'client_id' can't be null"; } - return $invalidProperties; } @@ -287,6 +366,9 @@ public function getClientId() */ public function setClientId(string $client_id) { + if (is_null($client_id)) { + throw new InvalidArgumentException('non-nullable client_id cannot be null'); + } $this->container['client_id'] = $client_id; return $this; @@ -311,6 +393,9 @@ public function getEditorOptions() */ public function setEditorOptions(?SubEditorOptions $editor_options) { + if (is_null($editor_options)) { + throw new InvalidArgumentException('non-nullable editor_options cannot be null'); + } $this->container['editor_options'] = $editor_options; return $this; @@ -335,6 +420,9 @@ public function getIsForEmbeddedSigning() */ public function setIsForEmbeddedSigning(?bool $is_for_embedded_signing) { + if (is_null($is_for_embedded_signing)) { + throw new InvalidArgumentException('non-nullable is_for_embedded_signing cannot be null'); + } $this->container['is_for_embedded_signing'] = $is_for_embedded_signing; return $this; @@ -359,6 +447,9 @@ public function getRequesterEmailAddress() */ public function setRequesterEmailAddress(?string $requester_email_address) { + if (is_null($requester_email_address)) { + throw new InvalidArgumentException('non-nullable requester_email_address cannot be null'); + } $this->container['requester_email_address'] = $requester_email_address; return $this; @@ -383,6 +474,9 @@ public function getRequestingRedirectUrl() */ public function setRequestingRedirectUrl(?string $requesting_redirect_url) { + if (is_null($requesting_redirect_url)) { + throw new InvalidArgumentException('non-nullable requesting_redirect_url cannot be null'); + } $this->container['requesting_redirect_url'] = $requesting_redirect_url; return $this; @@ -407,6 +501,9 @@ public function getShowProgressStepper() */ public function setShowProgressStepper(?bool $show_progress_stepper) { + if (is_null($show_progress_stepper)) { + throw new InvalidArgumentException('non-nullable show_progress_stepper cannot be null'); + } $this->container['show_progress_stepper'] = $show_progress_stepper; return $this; @@ -431,6 +528,9 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + throw new InvalidArgumentException('non-nullable signing_redirect_url cannot be null'); + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -455,6 +555,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -463,12 +566,10 @@ public function setTestMode(?bool $test_mode) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -476,7 +577,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -489,13 +590,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -507,12 +606,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -521,8 +618,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -539,7 +636,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/UnclaimedDraftResponse.php b/sdks/php/src/Model/UnclaimedDraftResponse.php index 8586ad99b..41e114122 100644 --- a/sdks/php/src/Model/UnclaimedDraftResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,12 +38,8 @@ * * @category Class * @description A group of documents that a user can take ownership of via the claim URL. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class UnclaimedDraftResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -86,6 +82,27 @@ class UnclaimedDraftResponse implements ModelInterface, ArrayAccess, JsonSeriali 'test_mode' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'signature_request_id' => true, + 'claim_url' => false, + 'signing_redirect_url' => true, + 'requesting_redirect_url' => true, + 'expires_at' => true, + 'test_mode' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -106,6 +123,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -193,42 +254,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['signature_request_id'] = $data['signature_request_id'] ?? null; - $this->container['claim_url'] = $data['claim_url'] ?? null; - $this->container['signing_redirect_url'] = $data['signing_redirect_url'] ?? null; - $this->container['requesting_redirect_url'] = $data['requesting_redirect_url'] ?? null; - $this->container['expires_at'] = $data['expires_at'] ?? null; - $this->container['test_mode'] = $data['test_mode'] ?? null; + $this->setIfExists('signature_request_id', $data ?? [], null); + $this->setIfExists('claim_url', $data ?? [], null); + $this->setIfExists('signing_redirect_url', $data ?? [], null); + $this->setIfExists('requesting_redirect_url', $data ?? [], null); + $this->setIfExists('expires_at', $data ?? [], null); + $this->setIfExists('test_mode', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): UnclaimedDraftResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): UnclaimedDraftResponse { /** @var UnclaimedDraftResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, UnclaimedDraftResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -238,9 +315,7 @@ public static function init(array $data): UnclaimedDraftResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -273,6 +348,16 @@ public function getSignatureRequestId() */ public function setSignatureRequestId(?string $signature_request_id) { + if (is_null($signature_request_id)) { + array_push($this->openAPINullablesSetToNull, 'signature_request_id'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signature_request_id', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signature_request_id'] = $signature_request_id; return $this; @@ -297,6 +382,9 @@ public function getClaimUrl() */ public function setClaimUrl(?string $claim_url) { + if (is_null($claim_url)) { + throw new InvalidArgumentException('non-nullable claim_url cannot be null'); + } $this->container['claim_url'] = $claim_url; return $this; @@ -321,6 +409,16 @@ public function getSigningRedirectUrl() */ public function setSigningRedirectUrl(?string $signing_redirect_url) { + if (is_null($signing_redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'signing_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('signing_redirect_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['signing_redirect_url'] = $signing_redirect_url; return $this; @@ -345,6 +443,16 @@ public function getRequestingRedirectUrl() */ public function setRequestingRedirectUrl(?string $requesting_redirect_url) { + if (is_null($requesting_redirect_url)) { + array_push($this->openAPINullablesSetToNull, 'requesting_redirect_url'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('requesting_redirect_url', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['requesting_redirect_url'] = $requesting_redirect_url; return $this; @@ -369,6 +477,16 @@ public function getExpiresAt() */ public function setExpiresAt(?int $expires_at) { + if (is_null($expires_at)) { + array_push($this->openAPINullablesSetToNull, 'expires_at'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('expires_at', $nullablesSetToNull); + if ($index !== false) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } $this->container['expires_at'] = $expires_at; return $this; @@ -393,6 +511,9 @@ public function getTestMode() */ public function setTestMode(?bool $test_mode) { + if (is_null($test_mode)) { + throw new InvalidArgumentException('non-nullable test_mode cannot be null'); + } $this->container['test_mode'] = $test_mode; return $this; @@ -401,12 +522,10 @@ public function setTestMode(?bool $test_mode) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -414,7 +533,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -427,13 +546,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -445,12 +562,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -459,8 +574,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -477,7 +592,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/Model/WarningResponse.php b/sdks/php/src/Model/WarningResponse.php index 08efacdc0..3a3bd5321 100644 --- a/sdks/php/src/Model/WarningResponse.php +++ b/sdks/php/src/Model/WarningResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -38,11 +38,8 @@ * * @category Class * @description A list of warnings. - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class WarningResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +74,23 @@ class WarningResponse implements ModelInterface, ArrayAccess, JsonSerializable 'warning_name' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'warning_msg' => false, + 'warning_name' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +111,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +230,54 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['warning_msg'] = $data['warning_msg'] ?? null; - $this->container['warning_name'] = $data['warning_name'] ?? null; + $this->setIfExists('warning_msg', $data ?? [], null); + $this->setIfExists('warning_name', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): WarningResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): WarningResponse { /** @var WarningResponse $obj */ - $obj = ObjectSerializer::deserialize( + return ObjectSerializer::deserialize( $data, WarningResponse::class, ); + } + + /** + * 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 + */ + private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -221,7 +295,6 @@ public function listInvalidProperties() if ($this->container['warning_name'] === null) { $invalidProperties[] = "'warning_name' can't be null"; } - return $invalidProperties; } @@ -255,6 +328,9 @@ public function getWarningMsg() */ public function setWarningMsg(string $warning_msg) { + if (is_null($warning_msg)) { + throw new InvalidArgumentException('non-nullable warning_msg cannot be null'); + } $this->container['warning_msg'] = $warning_msg; return $this; @@ -279,6 +355,9 @@ public function getWarningName() */ public function setWarningName(string $warning_name) { + if (is_null($warning_name)) { + throw new InvalidArgumentException('non-nullable warning_name cannot be null'); + } $this->container['warning_name'] = $warning_name; return $this; @@ -287,12 +366,10 @@ public function setWarningName(string $warning_name) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -300,7 +377,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -313,13 +390,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -331,12 +406,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -345,8 +418,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() @@ -363,7 +436,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/src/ObjectSerializer.php b/sdks/php/src/ObjectSerializer.php index 1d8fba8a2..0fce8c0d6 100644 --- a/sdks/php/src/ObjectSerializer.php +++ b/sdks/php/src/ObjectSerializer.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -29,26 +28,23 @@ namespace Dropbox\Sign; use DateTime; -use DateTimeInterface; use Dropbox\Sign\Model\ModelInterface; use Exception; -use GuzzleHttp\Psr7; -use GuzzleHttp\Utils; +use GuzzleHttp; +use GuzzleHttp\Psr7\Utils; use InvalidArgumentException; -use Psr\Http\Message; use SplFileObject; /** * ObjectSerializer Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class ObjectSerializer { /** @var string */ - private static $dateTimeFormat = DateTimeInterface::ATOM; + private static $dateTimeFormat = DateTime::ATOM; /** * Change the date format @@ -63,13 +59,13 @@ public static function setDateTimeFormat(string $format) /** * Serialize data * - * @param mixed $data the data to serialize - * @param string $type|null the OpenAPIToolsType of the data - * @param string $format|null the format of the OpenAPITools type of the data + * @param mixed $data the data to serialize + * @param string $type the OpenAPIToolsType of the data + * @param string $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ - public static function sanitizeForSerialization($data, string $type = null, string $format = null) + public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null) { if (is_scalar($data) || null === $data) { return $data; @@ -83,7 +79,6 @@ public static function sanitizeForSerialization($data, string $type = null, stri foreach ($data as $property => $value) { $data[$property] = self::sanitizeForSerialization($value); } - return $data; } @@ -93,15 +88,15 @@ public static function sanitizeForSerialization($data, string $type = null, stri $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', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $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'"); + throw new InvalidArgumentException("Invalid value for enum '{$openAPIType}', must be one of: '{$imploded}'"); } } } @@ -110,17 +105,15 @@ public static function sanitizeForSerialization($data, string $type = null, stri } } } elseif ($data instanceof SplFileObject) { - return (string) $data; + return (string)$data; } else { foreach ($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); } } - - return (object) $values; - } else { - return (string) $data; + return (object)$values; } + return (string)$data; } /** @@ -133,11 +126,10 @@ public static function sanitizeForSerialization($data, string $type = null, stri */ public static function sanitizeFilename(string $filename) { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + if (preg_match('/.*[\\/\\\\](.*)$/', $filename, $match)) { return $match[1]; - } else { - return $filename; } + return $filename; } /** @@ -170,22 +162,136 @@ public static function toPathValue(string $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 + * @return bool true if $value is empty + */ + private static function isEmptyValue(mixed $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. * - * @return string the serialized object + * @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 + */ + public static function toQueryValue( + mixed $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}" => '']; + } + 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 toQueryValue($object) + public static function convertBoolToQueryStringFormat(bool $value) { - if (is_array($object)) { - return implode(',', $object); - } else { - return self::toString($object); + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; } + + return (int)$value; } /** @@ -220,9 +326,8 @@ public static function toFormValue($value) { if ($value instanceof SplFileObject) { return $value->getRealPath(); - } else { - return self::toString($value); } + return self::toString($value); } /** @@ -231,28 +336,28 @@ 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 mixed $value the value of the parameter * * @return string the header string */ - public static function toString($value) + public static function toString(mixed $value) { if ($value instanceof DateTime) { // datetime in ISO8601 format return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { + } + if (is_bool($value)) { return $value ? 'true' : 'false'; - } else { - return $value; } + 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 + * @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 */ @@ -286,36 +391,35 @@ public static function serializeCollection(array $collection, string $style, boo /** * 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 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, string $class, array $httpHeaders = null) + public static function deserialize(mixed $data, string $class, array $httpHeaders = null) { if (null === $data) { return null; } if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data, true) : $data; + $data = is_string($data) ? json_decode($data) : $data; if (!is_array($data)) { - throw new InvalidArgumentException("Invalid array '$class'"); + throw new InvalidArgumentException("Invalid array '{$class}'"); } $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { - $values[$key] = self::deserialize($value, $subClass, null); + $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, true) : $data; + $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; @@ -326,22 +430,20 @@ public static function deserialize($data, string $class, array $httpHeaders = nu $deserialized[$key] = self::deserialize($value, $subClass, null); } } - return $deserialized; } if ($class === 'object') { settype($data, 'array'); - return $data; - } elseif ($class === 'mixed') { + } + if ($class === 'mixed') { settype($data, gettype($data)); - return $data; } - if ($class === 'DateTime') { - // Some API's return an invalid, empty string as a + 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 @@ -351,7 +453,7 @@ public static function deserialize($data, string $class, array $httpHeaders = nu try { return new DateTime($data); } catch (Exception $exception) { - // Some API's return a date-time with too high nanosecond + // 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)); @@ -362,13 +464,9 @@ public static function deserialize($data, string $class, array $httpHeaders = nu } if ($class === '\SplFileObject') { - if (is_a($data, SplFileObject::class)) { - return $data; - } + $data = Utils::streamFor($data); - $data = Psr7\Utils::streamFor($data); - - /* @var Message\StreamInterface $data */ + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name if ( @@ -390,92 +488,154 @@ public static function deserialize($data, string $class, array $httpHeaders = nu return new SplFileObject($filename, 'r'); } - /* @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + /** @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; - } - - // handles unsupported union types like "bool|int|string" - if (!class_exists($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'"); + 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 a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - - $discriminatorValue = null; - if (is_object($data)) { - $discriminatorValue = $data->{$discriminator} ?? null; - } elseif (is_array($data)) { - $discriminatorValue = $data[$discriminator] ?? null; - } + } + $data = is_string($data) ? json_decode($data) : $data; - $discrimnatorSubclassFound = false; - if (!empty($discriminator) && is_string($discriminatorValue)) { - $subclass = '\Dropbox\Sign\Model\\' . $discriminatorValue; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - $discrimnatorSubclassFound = true; - } - } + if (is_array($data)) { + $data = (object)$data; + } - if ( - !$discrimnatorSubclassFound - && !empty($discriminator) - && method_exists($class, 'discriminatorClassName') - ) { - $subclass = call_user_func( - "{$class}::discriminatorClassName", - (array) $data, - ); + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; - if (empty($subclass)) { - return null; - } + $discriminatorValue = null; + if (is_object($data)) { + $discriminatorValue = $data->{$discriminator} ?? null; + } elseif (is_array($data)) { + $discriminatorValue = $data[$discriminator] ?? null; + } + $discrimnatorSubclassFound = false; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Dropbox\Sign\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { $class = $subclass; $discrimnatorSubclassFound = true; } + } - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::openAPITypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; + if ( + !$discrimnatorSubclassFound + && !empty($discriminator) + && method_exists($class, 'discriminatorClassName') + ) { + $subclass = call_user_func( + "{$class}::discriminatorClassName", + (array)$data, + ); + + if (empty($subclass)) { + return null; + } - if (!isset($propertySetter)) { - continue; - } + $class = $subclass; + $discrimnatorSubclassFound = true; + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; - // Support object notation and array access - if (is_object($data) && isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } elseif (is_array($data) && isset($data[$instance::attributeMap()[$property]])) { - $propertyValue = $data[$instance::attributeMap()[$property]]; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->{$propertySetter}(null); } + + continue; } - return $instance; + 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) : ''; } /** * Allows a multipart/form-data request to grab data from the typed * class created by OpenAPI. */ - public static function getFormParams(Model\ModelInterface $model): array + public static function getFormParams(ModelInterface $model): array { $apiTypes = $model::openAPITypes(); $formParams = []; @@ -513,7 +673,7 @@ public static function getFormParams(Model\ModelInterface $model): array $keyCount[$key]++; - $formParams[$true_key] = Psr7\Utils::tryFopen( + $formParams[$true_key] = Utils::tryFopen( ObjectSerializer::toFormValue($file), 'rb' ); @@ -522,7 +682,7 @@ public static function getFormParams(Model\ModelInterface $model): array continue; } - $formParams[$true_key] = Psr7\Utils::tryFopen( + $formParams[$true_key] = Utils::tryFopen( ObjectSerializer::toFormValue($value), 'rb' ); @@ -532,7 +692,7 @@ public static function getFormParams(Model\ModelInterface $model): array $formParams[$true_key] = is_scalar($value) ? ObjectSerializer::toFormValue($value) - : Utils::jsonEncode( + : GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $value ) diff --git a/sdks/php/templates/.php-cs-fixer.dist.php b/sdks/php/templates/.php-cs-fixer.dist.php new file mode 100644 index 000000000..d93659d70 --- /dev/null +++ b/sdks/php/templates/.php-cs-fixer.dist.php @@ -0,0 +1,102 @@ +in(__DIR__) + ->exclude('vendor') + ->exclude('test') + ->exclude('tests') + ->exclude('bin') + ->exclude('docs') + ->exclude('examples') + ->exclude('templates') + ->exclude('test_fixtures') +; + +$config = new PhpCsFixer\Config(); +$config->setParallelConfig( + PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect() +); +return $config->setRules([ + '@PhpCsFixer' => true, + '@Symfony' => true, + '@DoctrineAnnotation' => true, + 'binary_operator_spaces' => [ + 'operators' => [ + '=>' => null, + ], + ], + 'blank_line_before_statement' => [ + 'statements' => [], + ], + 'blank_line_after_opening_tag' => false, + 'cast_spaces' => [ + 'space' => 'none', + ], + 'class_definition' => [ + 'inline_constructor_arguments' => false, + 'space_before_parenthesis' => true, + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + 'nullable_type_declaration_for_default_null_value' => false, + 'declare_parentheses' => true, + 'echo_tag_syntax' => [ + 'format' => 'short', + 'shorten_simple_statements_only' => true, + ], + 'fully_qualified_strict_types' => true, + 'global_namespace_import' => true, + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author', 'package', 'subpackage', 'version', + ], + ], + 'increment_style' => false, + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', 'function', 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + 'allow_unused_params' => true, + 'remove_inheritdoc' => true, + ], + 'phpdoc_align' => [ + 'tags' => [ + 'method', 'param', 'property', 'return', 'type', 'var', + ], + ], + 'phpdoc_line_span' => [ + 'property' => 'single', + ], + 'phpdoc_separation' => false, + 'phpdoc_summary' => false, + 'phpdoc_to_comment' => false, + 'phpdoc_to_param_type' => [ + 'scalar_types' => true, + 'union_types' => false, + ], + 'php_unit_internal_class' => false, + 'php_unit_test_class_requires_covers' => false, + 'single_line_throw' => false, + 'statement_indentation' => [ + 'stick_comment_to_next_continuous_control_statement' => false, + ], + 'visibility_required' => [ + 'elements' => ['method', 'property'], + ], + 'yoda_style' => false, +]) + ->setFinder($finder) + ->setRiskyAllowed(true) +; diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index 847a6d57f..445eaed01 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -1,7 +1,7 @@ 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 self + * @return $this */ public function setAccessToken($accessToken) { @@ -127,15 +208,39 @@ class Configuration } /** - * Sets the API key + * Sets boolean format for query string. * - * @param string $key API key or token + * @param string $booleanFormat Boolean format for query string * - * @return self + * @return $this */ - public function setUsername(string $key): self + public function setBooleanFormatForQueryString(string $booleanFormat) { - $this->username = $key; + $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; } @@ -149,12 +254,35 @@ class Configuration 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 self + * @return $this */ public function setHost($host) { @@ -177,8 +305,8 @@ class Configuration * * @param string $userAgent the user agent of the api client * - * @throws InvalidArgumentException - * @return self + * @throws \InvalidArgumentException + * @return $this */ public function setUserAgent($userAgent) { @@ -205,7 +333,7 @@ class Configuration * * @param bool $debug Debug flag * - * @return self + * @return $this */ public function setDebug($debug) { @@ -228,7 +356,7 @@ class Configuration * * @param string $debugFile Debug file * - * @return self + * @return $this */ public function setDebugFile($debugFile) { @@ -251,7 +379,7 @@ class Configuration * * @param string $tempFolderPath Temp folder path * - * @return self + * @return $this */ public function setTempFolderPath($tempFolderPath) { @@ -314,6 +442,31 @@ class Configuration 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 * @@ -353,35 +506,34 @@ class Configuration } /** - * 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"])."."); + 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 @@ -393,15 +545,15 @@ class Configuration } /** - * Set extra request options + * Returns URL based on the index and variables * - * @param array $options - * @return self + * @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 setOptions(array $options): self + public function getHostFromSettings($index, $variables = null) { - $this->options = $options; - return $this; + return self::getHostString($this->getHostSettings(), $index, $variables); } /** diff --git a/sdks/php/templates/HeaderSelector.mustache b/sdks/php/templates/HeaderSelector.mustache index 06f2a4a3f..1921b0610 100644 --- a/sdks/php/templates/HeaderSelector.mustache +++ b/sdks/php/templates/HeaderSelector.mustache @@ -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/sdks/php/templates/ModelInterface.mustache b/sdks/php/templates/ModelInterface.mustache index f37dd32ad..805db43f0 100644 --- a/sdks/php/templates/ModelInterface.mustache +++ b/sdks/php/templates/ModelInterface.mustache @@ -2,7 +2,7 @@ /** * ModelInterface * - * PHP version {{phpVersion}} + * PHP version 7.4 * * @category Class * @package {{modelPackage}} @@ -83,4 +83,20 @@ interface ModelInterface * @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/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index 636d517b1..467a8340a 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -2,7 +2,7 @@ /** * ObjectSerializer * - * PHP version {{phpVersion}} + * PHP version 7.4 * * @category Class * @package {{invokerPackage}} @@ -19,14 +19,9 @@ namespace {{invokerPackage}}; +use GuzzleHttp; +use GuzzleHttp\Psr7\Utils; use {{modelPackage}}\ModelInterface; -use Psr\Http\Message; -use DateTime; -use DateTimeInterface; -use InvalidArgumentException; -use SplFileObject; -use GuzzleHttp\Psr7; -use GuzzleHttp\Utils; /** * ObjectSerializer Class Doc Comment @@ -39,7 +34,7 @@ use GuzzleHttp\Utils; class ObjectSerializer { /** @var string */ - private static $dateTimeFormat = DateTimeInterface::ATOM; + private static $dateTimeFormat = \DateTime::ATOM; /** * Change the date format @@ -55,12 +50,12 @@ class ObjectSerializer * Serialize data * * @param mixed $data the data to serialize - * @param string $type|null the OpenAPIToolsType of the data - * @param string $format|null the format of the OpenAPITools type of the data + * @param string $type the OpenAPIToolsType of the data + * @param string $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ - public static function sanitizeForSerialization($data, string $type = null, string $format = null) + public static function sanitizeForSerialization($data, $type = null, $format = null) { if (is_scalar($data) || null === $data) { return $data; @@ -99,7 +94,7 @@ class ObjectSerializer $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } - } else if ($data instanceof SplFileObject) { + } else if ($data instanceof \SplFileObject) { return (string) $data; } else { foreach($data as $property => $value) { @@ -157,22 +152,141 @@ class ObjectSerializer } /** - * 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; } /** @@ -218,7 +332,7 @@ class ObjectSerializer * 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 mixed $value the value of the parameter * * @return string the header string */ @@ -229,7 +343,7 @@ class ObjectSerializer } elseif (is_bool($value)) { return $value ? 'true' : 'false'; } else { - return $value; + return (string) $value; } } @@ -286,7 +400,7 @@ class ObjectSerializer } if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data, true) : $data; + $data = is_string($data) ? json_decode($data) : $data; if (!is_array($data)) { throw new \InvalidArgumentException("Invalid array '$class'"); @@ -295,13 +409,13 @@ class ObjectSerializer $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { - $values[$key] = self::deserialize($value, $subClass, null); + $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, true) : $data; + $data = is_string($data) ? json_decode($data) : $data; settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; @@ -318,13 +432,13 @@ class ObjectSerializer 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 + 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 @@ -334,7 +448,7 @@ class ObjectSerializer try { return new \DateTime($data); } catch (\Exception $exception) { - // Some API's return a date-time with too high nanosecond + // 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)); @@ -345,18 +459,14 @@ class ObjectSerializer } if ($class === '\SplFileObject') { - if (is_a($data, SplFileObject::class)) { - return $data; - } - - $data = Psr7\Utils::streamFor($data); + $data = Utils::streamFor($data); - /** @var Message\StreamInterface $data */ + /** @var \Psr\Http\Message\StreamInterface $data */ // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $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]); @@ -379,11 +489,6 @@ class ObjectSerializer return $data; } - // handles unsupported union types like "bool|int|string" - if (!class_exists($class)) { - return $data; - } - if (method_exists($class, 'getAllowableEnumValues')) { if (!in_array($data, $class::getAllowableEnumValues(), true)) { @@ -393,6 +498,11 @@ class ObjectSerializer 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; @@ -404,8 +514,8 @@ class ObjectSerializer } $discrimnatorSubclassFound = false; - if (!empty($discriminator) && is_string($discriminatorValue)) { - $subclass = '\Dropbox\Sign\Model\\' . $discriminatorValue; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; if (is_subclass_of($subclass, $class)) { $class = $subclass; $discrimnatorSubclassFound = true; @@ -439,24 +549,90 @@ class ObjectSerializer continue; } - // Support object notation and array access - if (is_object($data) && isset($data->{$instance::attributeMap()[$property]})) { + 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)); - } elseif (is_array($data) && 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) : ''; + } + /** * Allows a multipart/form-data request to grab data from the typed * class created by OpenAPI. */ - public static function getFormParams(Model\ModelInterface $model): array + public static function getFormParams(ModelInterface $model): array { $apiTypes = $model::openAPITypes(); $formParams = []; @@ -494,7 +670,7 @@ class ObjectSerializer $keyCount[$key]++; - $formParams[$true_key] = Psr7\Utils::tryFopen( + $formParams[$true_key] = Utils::tryFopen( ObjectSerializer::toFormValue($file), 'rb' ); @@ -503,7 +679,7 @@ class ObjectSerializer continue; } - $formParams[$true_key] = Psr7\Utils::tryFopen( + $formParams[$true_key] = Utils::tryFopen( ObjectSerializer::toFormValue($value), 'rb' ); @@ -513,7 +689,7 @@ class ObjectSerializer $formParams[$true_key] = is_scalar($value) ? ObjectSerializer::toFormValue($value) - : Utils::jsonEncode( + : GuzzleHttp\Utils::jsonEncode( ObjectSerializer::sanitizeForSerialization( $value ) diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 15568f55d..d25fd36b9 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -1,7 +1,7 @@ [{{#consumes}} + '{{{mediaType}}}',{{/consumes}} + {{^consumes}} + 'application/json', +{{/consumes}} ],{{/operation}} + ]; /** - * @param Configuration|null $config - * @param ClientInterface|null $client - * @param HeaderSelector|null $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + * @param Configuration $config + * @param ClientInterface $client + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ public function __construct( Configuration $config = null, @@ -116,14 +116,6 @@ use {{invokerPackage}}\ObjectSerializer; return $this->config; } - /** - * @return ResponseInterface|null - */ - public function getResponse() - { - return $this->response; - } - {{#operation}} /** * Operation {{{operationId}}} @@ -142,9 +134,20 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. {{/-first}} * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} {{#-last}} * {{/-last}} @@ -152,17 +155,24 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * - * @throws \{{invokerPackage}}\ApiException on non-2xx response - * @throws InvalidArgumentException + * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} return $response;{{/returnType}} } @@ -183,9 +193,20 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. {{/-first}} * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} {{#-last}} * {{/-last}} @@ -193,23 +214,29 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * - * @throws \{{invokerPackage}}\ApiException on non-2xx response - * @throws InvalidArgumentException + * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); try { $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); - $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -240,76 +267,76 @@ use {{invokerPackage}}\ObjectSerializer; (string) $response->getBody() ); } - {{#returnType}} - $statusCode = $response->getStatusCode(); - - {{#responses}} - {{#dataType}} - {{^isWildcard}} - {{^isRange}} - if ($statusCode === {{code}}) { - if ('{{{dataType}}}' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '{{{dataType}}}', []), - $response->getStatusCode(), - $response->getHeaders() - ]; + {{#responses}}{{#dataType}}{{#isRange}} + $result = $this->handleRangeCodeResponse( + $response, + '{{code}}', + '{{{dataType}}}' + ); + if ($result) { + return $result; } - {{/isRange}} - {{/isWildcard}} - {{/dataType}} - {{/responses}} - + {{/isRange}}{{/dataType}}{{/responses}} {{#responses}} - {{#dataType}} - {{#isRange}} - $rangeCodeLeft = (int) (substr('{{code}}', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('{{code}}', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('{{{dataType}}}' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '{{{dataType}}}', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - {{/isRange}} - {{/dataType}} - {{/responses}} + {{#-first}} - {{#responses}} + switch($statusCode) { + {{/-first}} {{#dataType}} - {{#isWildcard}} - if ('{{{dataType}}}' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + if ('{{{dataType}}}' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('{{{dataType}}}' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '{{{dataType}}}', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - {{/isWildcard}} + return [ + ObjectSerializer::deserialize($content, '{{{dataType}}}', []), + $response->getStatusCode(), + $response->getHeaders() + ];{{/isRange}} {{/dataType}} + {{#-last}} + } + {{/-last}} {{/responses}} + $returnType = '{{{returnType}}}'; 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 [ @@ -324,58 +351,24 @@ use {{invokerPackage}}\ObjectSerializer; {{/returnType}} } catch (ApiException $e) { - $statusCode = $e->getCode(); - - {{#responses}} - {{#dataType}} - {{^isWildcard}} - {{^isRange}} - if ($statusCode === {{code}}) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '{{{dataType}}}', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - {{/isRange}} - {{/isWildcard}} - {{/dataType}} - {{/responses}} - - {{#responses}} + {{#responses}}{{#dataType}}{{#isRange}} + if ($this->handleRangeCodeException($e, '{{code}}', '{{{dataType}}}')) { + throw $e; + }{{/isRange}}{{/dataType}}{{/responses}} + switch ($e->getCode()) { + {{#responses}} {{#dataType}} - {{#isRange}} - $rangeCodeLeft = (int) (substr('{{code}}', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('{{code}}', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '{{{dataType}}}', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - {{/isRange}} + {{^isRange}}{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{{dataType}}}', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break;{{/isRange}} {{/dataType}} - {{/responses}} - - {{#responses}} - {{#dataType}} - {{#isWildcard}} - $rangeCode = substr('{{code}}', 1); - if ($statusCode >= (int) "{$rangeCode}00" && $statusCode <= (int) "{$rangeCode}99") { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '{{{dataType}}}', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + {{/responses}} } - {{/isWildcard}} - {{/dataType}} - {{/responses}} - throw $e; } } @@ -397,9 +390,20 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. {{/-first}} * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} {{#-last}} * {{/-last}} @@ -407,16 +411,23 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * - * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) ->then( function ($response) { return $response[0]; @@ -441,9 +452,20 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. {{/-first}} * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} {{#-last}} * {{/-last}} @@ -451,17 +473,24 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * - * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { $returnType = '{{{returnType}}}'; - $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -472,6 +501,9 @@ use {{invokerPackage}}\ObjectSerializer; $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -510,9 +542,20 @@ use {{invokerPackage}}\ObjectSerializer; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAPI spec. Use 'hostIndex' to select the host. + * if needed, use the 'variables' parameter to pass variables to the host. {{/-first}} * URL: {{{url}}} +{{#variables}} +{{#-first}} + * Variables: +{{/-first}} + * - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + * Allowed values: +{{/-first}} + * - {{{.}}}{{/enumValues}} +{{/variables}} {{#-last}} * {{/-last}} @@ -520,23 +563,32 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * - * @throws InvalidArgumentException - * @return Psr7\Request + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request {{#isDeprecated}} * @deprecated {{/isDeprecated}} */ - public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { {{#vendorExtensions.x-group-parameters}} // unbox the parameters from the associative array - {{#allParams}} +{{#allParams}} ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; - {{/allParams}} - - {{/vendorExtensions.x-group-parameters}} - {{#allParams}} +{{/allParams}}{{#servers.0}} + $hostIndex = $associative_array['hostIndex']; + $variables = array_key_exists('variables', $associative_array) ? $associative_array['variables'] : []; +{{/servers.0}} + $contentType = $associative_array['contentType'] ?? self::contentTypes['{{{operationId}}}'][0]; + {{/vendorExtensions.x-group-parameters}}{{#allParams}} {{#required}} // verify the required parameter '{{paramName}}' is set if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { @@ -581,14 +633,14 @@ use {{invokerPackage}}\ObjectSerializer; throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); } {{/minItems}} - - {{/hasValidation}} - {{/allParams}} + {{/hasValidation}}{{/allParams}} $resourcePath = '{{{path}}}'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; {{#bodyParam}} $formParams = ObjectSerializer::getFormParams( @@ -597,38 +649,17 @@ use {{invokerPackage}}\ObjectSerializer; $multipart = !empty($formParams); {{/bodyParam}} - {{^bodyParam}} - $formParams = []; - $multipart = false; - {{/bodyParam}} {{#queryParams}} // query params - {{#isExplode}} - if (${{paramName}} !== null) { - {{#style}} - if('form' === '{{style}}' && is_array(${{paramName}})) { - foreach(${{paramName}} as $key => $value) { - $queryParams[$key] = $value; - } - } - else { - $queryParams['{{baseName}}'] = ${{paramName}}; - } - {{/style}} - {{^style}} - $queryParams['{{baseName}}'] = ${{paramName}}; - {{/style}} - } - {{/isExplode}} - {{^isExplode}} - if (is_array(${{paramName}})) { - ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{style}}{{^style}}{{collectionFormat}}{{/style}}', true); - } - if (${{paramName}} !== null) { - $queryParams['{{baseName}}'] = ${{paramName}}; - } - {{/isExplode}} + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + ${{paramName}}, + '{{baseName}}', // param base name + '{{#schema}}{{openApiType}}{{/schema}}', // openApiType + '{{style}}', // style + {{#isExplode}}true{{/isExplode}}{{^isExplode}}false{{/isExplode}}, // explode + {{required}} // required + ) ?? []); {{/queryParams}} {{#headerParams}} @@ -679,22 +710,18 @@ use {{invokerPackage}}\ObjectSerializer; } {{/formParams}} - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}], - [{{#consumes}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/consumes}}] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : [{{#produces}}'{{{mediaType}}}', {{/produces}}], + $contentType, + $multipart + ); // for model (json/xml) {{#bodyParams}} if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); } else { $httpBody = ${{paramName}}; } @@ -729,18 +756,25 @@ use {{invokerPackage}}\ObjectSerializer; } {{/bodyParam}} - $httpBody = new Psr7\MultipartStream($multipartContents); - - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } {{#authMethods}} + {{#isApiKey}} + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); + if ($apiKey !== null) { + {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} + } + {{/isApiKey}} {{#isBasic}} {{#isBasicBasic}} // this endpoint requires HTTP basic authentication @@ -775,33 +809,80 @@ use {{invokerPackage}}\ObjectSerializer; ); {{#servers.0}} - $operationHosts = [{{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}}]; - if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { - throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + # Preserve the original behavior of server indexing. + if ($hostIndex === null) { + $hostIndex = $this->hostIndex; } - $operationHost = $operationHosts[$this->hostIndex]; + $hostSettings = $this->getHostSettingsFor{{operationId}}(); + + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index {$hostIndex} when selecting the host. Must be less than ".count($hostSettings)); + } + $operationHost = Configuration::getHostString($hostSettings, $hostIndex, $variables); {{/servers.0}} - $query = Psr7\Query::build($queryParams); - return new Psr7\Request( + {{^servers.0}} + $operationHost = $this->config->getHost(); + {{/servers.0}} + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( '{{httpMethod}}', - {{^servers.0}}$this->config->getHost(){{/servers.0}}{{#servers.0}}$operationHost{{/servers.0}} . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); } - {{/operation}} + {{#servers.0}} + /** + * Returns an array of host settings for Operation {{operationId}} + * + * @return array an array of host settings + */ + protected function getHostSettingsFor{{operationId}}(): array + { + return [ + {{#servers}} + [ + "url" => "{{{url}}}", + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + {{#variables}} + {{#-first}} + "variables" => [ + {{/-first}} + "{{{name}}}" => [ + "description" => "{{{description}}}{{^description}}No description provided{{/description}}", + "default_value" => "{{{defaultValue}}}", + {{#enumValues}} + {{#-first}} + "enum_values" => [ + {{/-first}} + "{{{.}}}", + {{#-last}} + ] + {{/-last}} + {{/enumValues}} + ]{{^-last}},{{/-last}} + {{#-last}} + ] + {{/-last}} + {{/variables}} + ]{{^-last}},{{/-last}} + {{/servers}} + ]; + } + {{/servers.0}} + {{/operation}} /** * Create http client option * - * @throws RuntimeException on file opening failure + * @throws \RuntimeException on file opening failure * @return array of http client options */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -811,5 +892,67 @@ use {{invokerPackage}}\ObjectSerializer; return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + $response, + string $rangeCode, + string $returnDataType, + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int) (substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int) (substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType, + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int) (substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int) (substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } {{/operations}} diff --git a/sdks/php/templates/api_test.mustache b/sdks/php/templates/api_test.mustache index dec28599c..0fc99231c 100644 --- a/sdks/php/templates/api_test.mustache +++ b/sdks/php/templates/api_test.mustache @@ -1,7 +1,7 @@ markTestIncomplete('Not implemented'); + self::markTestIncomplete('Not implemented'); } {{/operation}} } diff --git a/sdks/php/templates/composer.mustache b/sdks/php/templates/composer.mustache index 1ce9ad9c2..8e4e03bc6 100644 --- a/sdks/php/templates/composer.mustache +++ b/sdks/php/templates/composer.mustache @@ -1,6 +1,8 @@ { - "name": "dropbox/sign", - "description": "Official Dropbox Sign APIv3 PHP SDK", + {{#composerPackageName}} + "name": "{{{.}}}", + {{/composerPackageName}} + "description": "{{{appDescription}}}", "keywords": [ "openapitools", "openapi-generator", @@ -12,19 +14,13 @@ "hellosign", "dropboxsign" ], - "homepage": "https://hellosign.com", - "license": [ - "MIT" - ], + "homepage": "{{{artifactUrl}}}", + "license": "{{{licenseName}}}", "authors": [ { - "name": "Dropbox Sign", - "homepage": "https://hellosign.com", - "email": "apisupport@hellosign.com" - }, - { - "name": "OpenAPI-Generator contributors", - "homepage": "https://openapi-generator.tech" + "name": "{{{developerOrganization}}}", + "homepage": "{{{developerOrganizationUrl}}}", + "email": "{{{developerOrganizationEmail}}}" } ], "require": { @@ -37,15 +33,13 @@ }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", - "friendsofphp/php-cs-fixer": "3.4.*", + "friendsofphp/php-cs-fixer": "^3.5", "symfony/yaml": "^5.4" }, "autoload": { - "psr-4": { - "{{escapedInvokerPackage}}\\": "{{srcBasePath}}/" - } + "psr-4": { "{{{escapedInvokerPackage}}}\\" : "{{{srcBasePath}}}/" } }, "autoload-dev": { - "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + "psr-4": { "{{{escapedInvokerPackage}}}\\Test\\" : "{{{testBasePath}}}/" } } } diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache new file mode 100644 index 000000000..5a96f2f6f --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -0,0 +1,113 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use Exception; +use Http\Client\Exception\RequestException; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; + +/** + * ApiException Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class ApiException extends RequestException +{ + + /** + * The HTTP body of the server response either as Json or string. + * + * @var string|null + */ + protected $responseBody; + + /** + * The HTTP header of the server response. + * + * @var string[]|null + */ + protected $responseHeaders; + + /** + * The deserialized response object + * + * @var \stdClass|string|null + */ + protected $responseObject; + + public function __construct( + $message, + RequestInterface $request, + ResponseInterface $response = null, + Exception $previous = null + ) { + parent::__construct($message, $request, $previous); + if ($response) { + $this->responseHeaders = $response->getHeaders(); + $this->responseBody = (string) $response->getBody(); + $this->code = $response->getStatusCode(); + } + } + + /** + * 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 deseralized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deseralized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/sdks/php/templates/libraries/psr-18/DebugPlugin.mustache b/sdks/php/templates/libraries/psr-18/DebugPlugin.mustache new file mode 100644 index 000000000..cf256a130 --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/DebugPlugin.mustache @@ -0,0 +1,92 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{invokerPackage}}; + +use Http\Client\Common\Plugin; +use Http\Promise\Promise; +use Psr\Http\Client\ClientExceptionInterface; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\ResponseInterface; +use function is_resource; + +/** + * Configuration Class Doc Comment + * PHP version 7.2 + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +class DebugPlugin implements Plugin +{ + + /** + * @var resource + */ + private $output; + + /** + * DebuggingPlugin constructor. + * + * @param resource $output + */ + public function __construct($output) + { + if (!is_resource($output)) { + throw new \InvalidArgumentException('debugging resource is not valid'); + } + $this->output = $output; + } + + public function handleRequest(RequestInterface $request, callable $next, callable $first): Promise + { + return $next($request)->then( + function (ResponseInterface $response) use ($request) { + $this->logSuccess($request, $response); + + return $response; + }, + function (ClientExceptionInterface $exception) use ($request) { + $this->logError($request, $exception); + + throw $exception; + } + ); + } + + private function logSuccess(RequestInterface $request, ResponseInterface $response): void + { + $methodAndPath = $request->getMethod() . ' ' . $request->getUri()->getPath(); + $protocol = $response->getProtocolVersion(); + $responseCode = $response->getStatusCode(); + \fprintf($this->output, '<%s HTTP/%s> %s', $methodAndPath, $protocol, $responseCode); + \fwrite($this->output, "\n"); + } + + private function logError(RequestInterface $request, ClientExceptionInterface $exception): void + { + $methodAndPath = $request->getMethod() . ' ' . $request->getUri()->getPath(); + $protocol = $request->getProtocolVersion(); + $error = $exception->getMessage(); + $responseCode = $exception->getCode(); + \fprintf($this->output, '<%s HTTP/%s> %s %s', $methodAndPath, $responseCode, $error, $protocol); + \fwrite($this->output, "\n"); + } +} \ No newline at end of file diff --git a/sdks/php/templates/libraries/psr-18/README.mustache b/sdks/php/templates/libraries/psr-18/README.mustache new file mode 100644 index 000000000..40a12d592 --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/README.mustache @@ -0,0 +1,160 @@ +# {{packageName}} + +{{#appDescriptionWithNewLines}} +{{{appDescriptionWithNewLines}}} +{{/appDescriptionWithNewLines}} + +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}). +{{/infoUrl}} + +## Installation & Usage + +### Requirements + +PHP 7.2 and later. + +### Composer + +To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git" + } + ], + "require": { + "{{gitUserId}}/{{gitRepoId}}": "*@dev" + } +} +``` + +Then run `composer install` + +Your project is free to choose the http client of your choice +Please require packages that will provide http client functionality: +https://packagist.org/providers/psr/http-client-implementation +https://packagist.org/providers/php-http/async-client-implementation +https://packagist.org/providers/psr/http-factory-implementation + +As an example: + +``` +composer require guzzlehttp/guzzle php-http/guzzle7-adapter http-interop/http-factory-guzzle +``` + +### Manual Installation + +Download the files and include `autoload.php`: + +```php + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // If you want use custom http client, pass your client which implements `Psr\Http\Client\ClientInterface`. + // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface + new GuzzleHttp\Client(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{description}}}{{/description}} +{{/allParams}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} +## Models + +{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}} +{{/models}} + +## Authorization +{{^authMethods}} +All endpoints do not require authorization. +{{/authMethods}} +{{#authMethods}} +{{#last}} Authentication schemes defined for the API:{{/last}} +### {{{name}}} +{{#isApiKey}} + +- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} + +{{/isApiKey}} +{{#isBasic}} +{{#isBasicBasic}} + +- **Type**: HTTP basic authentication +{{/isBasicBasic}} +{{#isBasicBearer}} + +- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} +{{/isBasicBearer}} +{{/isBasic}} +{{#isOAuth}} + +- **Type**: `OAuth` +- **Flow**: `{{{flow}}}` +- **Authorization URL**: `{{{authorizationUrl}}}` +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} + - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} +## Tests + +To run the tests, use: + +```bash +composer install +vendor/bin/phpunit +``` + +## Author + +{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}} +{{/-last}}{{/apis}}{{/apiInfo}} +## About this package + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: `{{appVersion}}` +{{#artifactVersion}} + - Package version: `{{artifactVersion}}` +{{/artifactVersion}} +{{^hideGenerationTimestamp}} + - Build date: `{{generatedDate}}` +{{/hideGenerationTimestamp}} + - Generator version: `{{generatorVersion}}` +- Build package: `{{generatorClass}}` diff --git a/sdks/php/templates/libraries/psr-18/api.mustache b/sdks/php/templates/libraries/psr-18/api.mustache new file mode 100644 index 000000000..6138ab176 --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/api.mustache @@ -0,0 +1,773 @@ +partial_header}} +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +namespace {{apiPackage}}; + +use GuzzleHttp\Psr7\MultipartStream; +use Http\Client\Common\Plugin\ErrorPlugin; +use Http\Client\Common\Plugin\RedirectPlugin; +use Http\Client\Common\PluginClient; +use Http\Client\Common\PluginClientFactory; +use Http\Client\Exception\HttpException; +use Http\Client\HttpAsyncClient; +use Http\Discovery\HttpAsyncClientDiscovery; +use Http\Discovery\Psr17FactoryDiscovery; +use Http\Discovery\Psr18ClientDiscovery; +use Http\Message\RequestFactory; +use Http\Promise\Promise; +use {{invokerPackage}}\ApiException; +use {{invokerPackage}}\Configuration; +use {{invokerPackage}}\DebugPlugin; +use {{invokerPackage}}\HeaderSelector; +use {{invokerPackage}}\ObjectSerializer; +use Psr\Http\Client\ClientExceptionInterface; +use Psr\Http\Client\ClientInterface; +use Psr\Http\Message\RequestFactoryInterface; +use Psr\Http\Message\RequestInterface; +use Psr\Http\Message\StreamFactoryInterface; +use Psr\Http\Message\UriFactoryInterface; +use Psr\Http\Message\UriInterface; +use function sprintf; + +/** + * {{classname}} Class Doc Comment + * + * @category Class + * @package {{invokerPackage}} + * @author OpenAPI Generator team + * @link https://openapi-generator.tech + */ +{{#operations}}class {{classname}} +{ + /** + * @var PluginClient + */ + protected $httpClient; + + /** + * @var PluginClient + */ + protected $httpAsyncClient; + + /** + * @var UriFactoryInterface + */ + protected $uriFactory; + + /** + * @var Configuration + */ + protected $config; + + /** + * @var HeaderSelector + */ + protected $headerSelector; + + /** + * @var int Host index + */ + protected $hostIndex; + + /** + * @var RequestFactoryInterface + */ + protected $requestFactory; + + /** + * @var StreamFactoryInterface + */ + protected $streamFactory; + + public function __construct( + ClientInterface $httpClient = null, + Configuration $config = null, + HttpAsyncClient $httpAsyncClient = null, + UriFactoryInterface $uriFactory = null, + RequestFactoryInterface $requestFactory = null, + StreamFactoryInterface $streamFactory = null, + HeaderSelector $selector = null, + ?array $plugins = null, + $hostIndex = 0 + ) { + $this->config = $config ?? (new Configuration())->setHost('{{basePath}}'); + $this->requestFactory = $requestFactory ?? Psr17FactoryDiscovery::findRequestFactory(); + $this->streamFactory = $streamFactory ?? Psr17FactoryDiscovery::findStreamFactory(); + + $plugins = $plugins ?? [ + new RedirectPlugin(['strict' => true]), + new ErrorPlugin(), + ]; + + if ($this->config->getDebug()) { + $plugins[] = new DebugPlugin(fopen($this->config->getDebugFile(), 'ab')); + } + + $this->httpClient = (new PluginClientFactory())->createClient( + $httpClient ?? Psr18ClientDiscovery::find(), + $plugins + ); + + $this->httpAsyncClient = (new PluginClientFactory())->createClient( + $httpAsyncClient ?? HttpAsyncClientDiscovery::find(), + $plugins + ); + + $this->uriFactory = $uriFactory ?? Psr17FactoryDiscovery::findUriFactory(); + + $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}} + /** + * Operation {{{operationId}}} +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{description}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + return $response;{{/returnType}} + } + + /** + * Operation {{{operationId}}}WithHttpInfo +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) + */ + public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + try { + try { + $response = $this->httpClient->sendRequest($request); + } catch (HttpException $e) { + $response = $e->getResponse(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $response->getStatusCode(), + (string) $request->getUri() + ), + $request, + $response, + $e + ); + } catch (ClientExceptionInterface $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $request, + null, + $e + ); + } + + $statusCode = $response->getStatusCode(); + {{#returnType}} + {{#responses}} + {{#-first}} + + switch($statusCode) { + {{/-first}} + {{#dataType}} + {{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + if ('{{{dataType}}}' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '{{{dataType}}}', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/dataType}} + {{#-last}} + } + {{/-last}} + {{/responses}} + + $returnType = '{{{returnType}}}'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + + return [null, $statusCode, $response->getHeaders()]; + {{/returnType}} + + } catch (ApiException $e) { + switch ($e->getCode()) { + {{#responses}} + {{#dataType}} + {{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}} + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '{{{dataType}}}', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + {{/dataType}} + {{/responses}} + } + throw $e; + } + } + + /** + * Operation {{{operationId}}}Async + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + return $this->{{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation {{{operationId}}}AsyncWithHttpInfo + * +{{#summary}} + * {{.}} + * +{{/summary}} +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return Promise + */ + public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + $returnType = '{{{returnType}}}'; + $request = $this->{{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}); + + return $this->httpAsyncClient->sendAsyncRequest($request) + ->then( + function ($response) use ($returnType) { + {{#returnType}} + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + {{/returnType}} + {{^returnType}} + return [null, $response->getStatusCode(), $response->getHeaders()]; + {{/returnType}} + }, + function (HttpException $exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $exception->getRequest(), + $exception->getResponse(), + $exception + ); + } + ); + } + + /** + * Create request for operation '{{{operationId}}}' + * +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{description}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}} +{{/allParams}} + * + * @throws \InvalidArgumentException + * @return RequestInterface + */ + public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#vendorExtensions.x-group-parameters}} + // unbox the parameters from the associative array + {{#allParams}} + ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}; + {{/allParams}} + + {{/vendorExtensions.x-group-parameters}} + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + } + {{/maxItems}} + {{#minItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + + {{/hasValidation}} + {{/allParams}} + + $resourcePath = '{{{path}}}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = null; + $multipart = false; + + {{#queryParams}} + // query params + {{#isExplode}} + if (${{paramName}} !== null) { + {{#style}} + if('form' === '{{style}}' && is_array(${{paramName}})) { + foreach(${{paramName}} as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/style}} + {{^style}} + $queryParams['{{baseName}}'] = ${{paramName}}; + {{/style}} + } + {{/isExplode}} + {{^isExplode}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{#style}}{{style}}{{/style}}{{^style}}{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}{{/style}}', true); + } + if (${{paramName}} !== null) { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/isExplode}} + {{/queryParams}} + + {{#headerParams}} + // header params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); + } + {{/headerParams}} + + {{#pathParams}} + // path params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); + } + {{/pathParams}} + + {{#formParams}} + // form params + if (${{paramName}} !== null) { + {{#isFile}} + $multipart = true; + $formParams['{{baseName}}'] = []; + $paramFiles = is_array(${{paramName}}) ? ${{paramName}} : [${{paramName}}]; + foreach ($paramFiles as $paramFile) { + $formParams['{{baseName}}'][] = \GuzzleHttp\Psr7\try_fopen( + ObjectSerializer::toFormValue($paramFile), + 'rb' + ); + } + {{/isFile}} + {{^isFile}} + $formParams['{{baseName}}'] = ObjectSerializer::toFormValue(${{paramName}}); + {{/isFile}} + } + {{/formParams}} + + $headers = $this->headerSelector->selectHeaders( + [{{#produces}}'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}], + '{{#consumes}}{{{mediaType}}}{{/consumes}}', + $multipart + ); + + // for model (json/xml) + {{#bodyParams}} + if (isset(${{paramName}})) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = json_encode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); + } else { + $httpBody = ${{paramName}}; + } + } elseif (count($formParams) > 0) { + {{/bodyParams}} + {{^bodyParams}} + if (count($formParams) > 0) { + {{/bodyParams}} + 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 ($headers['Content-Type'] === 'application/json') { + $httpBody = json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + {{#authMethods}} + {{#isApiKey}} + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('{{keyParamName}}'); + if ($apiKey !== null) { + {{#isKeyInHeader}}$headers['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}} + } + {{/isApiKey}} + {{#isBasic}} + {{#isBasicBasic}} + // 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()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isBasicBearer}} + {{/isBasic}} + {{#isOAuth}} + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isOAuth}} + {{/authMethods}} + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + {{^servers.0}} + $operationHost = $this->config->getHost(); + {{/servers.0}} + {{#servers.0}} + $operationHosts = [{{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}}]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + {{/servers.0}} + + $uri = $this->createUri($operationHost, $resourcePath, $queryParams); + + return $this->createRequest('{{httpMethod}}', $uri, $headers, $httpBody); + } + + {{/operation}} + + /** + * @param string $method + * @param string|UriInterface $uri + * @param array $headers + * @param string|StreamInterface|null $body + * + * @return RequestInterface + */ + protected function createRequest(string $method, $uri, array $headers = [], $body = null): RequestInterface + { + if ($this->requestFactory instanceof RequestFactory) { + return $this->requestFactory->createRequest( + $method, + $uri, + $headers, + $body + ); + } + + if (is_string($body) && '' !== $body && null === $this->streamFactory) { + throw new \RuntimeException('Cannot create request: A stream factory is required to create a request with a non-empty string body.'); + } + + $request = $this->requestFactory->createRequest($method, $uri); + + foreach ($headers as $key => $value) { + $request = $request->withHeader($key, $value); + } + + if (null !== $body && '' !== $body) { + $request = $request->withBody( + is_string($body) ? $this->streamFactory->createStream($body) : $body + ); + } + + return $request; + } + + private function createUri( + string $operationHost, + string $resourcePath, + array $queryParams + ): UriInterface { + $parsedUrl = parse_url($operationHost); + + $host = $parsedUrl['host'] ?? null; + $scheme = $parsedUrl['scheme'] ?? null; + $basePath = $parsedUrl['path'] ?? null; + $port = $parsedUrl['port'] ?? null; + $user = $parsedUrl['user'] ?? null; + $password = $parsedUrl['pass'] ?? null; + + $uri = $this->uriFactory->createUri($basePath . $resourcePath) + ->withHost($host) + ->withScheme($scheme) + ->withPort($port) + ->withQuery(ObjectSerializer::buildQuery($queryParams)); + + if ($user) { + $uri = $uri->withUserInfo($user, $password); + } + + return $uri; + } +} +{{/operations}} diff --git a/sdks/php/templates/libraries/psr-18/api_doc.mustache b/sdks/php/templates/libraries/psr-18/api_doc.mustache new file mode 100644 index 000000000..3a794f7e5 --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/api_doc.mustache @@ -0,0 +1,78 @@ +# {{invokerPackage}}\{{classname}}{{#description}} + +{{description}}{{/description}} + +All URIs are relative to {{basePath}}. + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}()**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{#operations}}{{#operation}} + +## `{{{operationId}}}()` + +```php +{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{returnType}}}{{/returnType}} +``` + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example + +```php + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // If you want use custom http client, pass your client which implements `Psr\Http\Client\ClientInterface`. + // This is optional, `Psr18ClientDiscovery` will be used to find http client. For instance `GuzzleHttp\Client` implements that interface + new GuzzleHttp\Client(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{^vendorExtensions.x-group-parameters}} +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{description}}}{{/description}} +{{/allParams}} +{{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-group-parameters}} +{{#allParams}}$associate_array['{{paramName}}'] = {{{example}}}; // {{{dataType}}}{{#description}} | {{{description}}}{{/description}} +{{/allParams}} +{{/vendorExtensions.x-group-parameters}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +{{#vendorExtensions.x-group-parameters}} +Note: the input parameter is an associative array with the keys listed as the parameter name below. + +{{/vendorExtensions.x-group-parameters}} +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**](../Model/{{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + +- **Content-Type**: {{#consumes}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} +- **Accept**: {{#produces}}`{{{mediaType}}}`{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md){{/operation}}{{/operations}} diff --git a/sdks/php/templates/libraries/psr-18/composer.mustache b/sdks/php/templates/libraries/psr-18/composer.mustache new file mode 100644 index 000000000..7ef3e16b0 --- /dev/null +++ b/sdks/php/templates/libraries/psr-18/composer.mustache @@ -0,0 +1,54 @@ +{ + "name": "{{gitUserId}}/{{gitRepoId}}", + {{#artifactVersion}} + "version": "{{artifactVersion}}", + {{/artifactVersion}} + "description": "{{{appDescription}}}", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "config": { + "sort-packages": true + }, + "require": { + "php": ">=7.2", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/psr7": "^1.8 || ^2.0", + "php-http/async-client-implementation": "^1.0", + "php-http/client-common": "^2.4", + "php-http/discovery": "^1.14", + "php-http/httplug": "^2.2", + "psr/http-client-implementation": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-factory-implementation": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0", + "friendsofphp/php-cs-fixer": "^2.12", + "guzzlehttp/guzzle": "^7.0", + "php-http/guzzle7-adapter": "^1.0" + }, + "autoload": { + "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } + }, + "autoload-dev": { + "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + } +} diff --git a/sdks/php/templates/model.mustache b/sdks/php/templates/model.mustache index f0f5f1843..fe57ed7e5 100644 --- a/sdks/php/templates/model.mustache +++ b/sdks/php/templates/model.mustache @@ -4,7 +4,7 @@ /** * {{classname}} * - * PHP version {{phpVersion}} + * PHP version 7.4 * * @category Class * @package {{invokerPackage}} @@ -27,7 +27,6 @@ use \ArrayAccess; {{/parentSchema}} {{/isEnum}} use \{{invokerPackage}}\ObjectSerializer; -use ReturnTypeWillChange; /** * {{classname}} Class Doc Comment @@ -40,11 +39,8 @@ use ReturnTypeWillChange; * @author OpenAPI Generator team * @link https://openapi-generator.tech {{^isEnum}} - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess {{/isEnum}} - * {{#vendorExtensions.x-internal-class}}@internal This class should not be instantiated directly{{/vendorExtensions.x-internal-class}} */ {{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} {{/model}}{{/models}} diff --git a/sdks/php/templates/model_enum.mustache b/sdks/php/templates/model_enum.mustache index 88036f76f..77001f2e6 100644 --- a/sdks/php/templates/model_enum.mustache +++ b/sdks/php/templates/model_enum.mustache @@ -5,7 +5,7 @@ class {{classname}} */ {{#allowableValues}} {{#enumVars}} - const {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}}; + public const {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}}; {{/enumVars}} {{/allowableValues}} diff --git a/sdks/php/templates/model_generic.mustache b/sdks/php/templates/model_generic.mustache index 240156c2d..0bdea10a3 100644 --- a/sdks/php/templates/model_generic.mustache +++ b/sdks/php/templates/model_generic.mustache @@ -1,4 +1,4 @@ -{{#vendorExtensions.x-base-class}}abstract {{/vendorExtensions.x-base-class}}class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}} +class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}} { public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; @@ -31,6 +31,23 @@ {{/-last}}{{/vars}} ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + {{#vars}}'{{name}}' => {{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * 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 * @@ -51,6 +68,58 @@ return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}}; } + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables{{#parentSchema}} + parent::openAPINullables(){{/parentSchema}}; + } + + /** + * 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 @@ -127,7 +196,7 @@ {{#isEnum}} {{#allowableValues}} {{#enumVars}} - const {{enumName}}_{{{name}}} = {{{value}}}; + public const {{enumName}}_{{{name}}} = {{{value}}}; {{/enumVars}} {{/allowableValues}} {{/isEnum}} @@ -154,7 +223,7 @@ /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; {{/parentSchema}} @@ -162,7 +231,7 @@ /** * Constructor * - * @param array|null $data Associated array of property values + * @param mixed[] $data Associated array of property values * initializing the model */ public function __construct(array $data = null) @@ -172,7 +241,7 @@ {{/parentSchema}} {{#vars}} - $this->container['{{name}}'] = $data['{{name}}'] ?? {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; + $this->setIfExists('{{name}}', $data ?? [], {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}); {{/vars}} {{#discriminator}} @@ -218,6 +287,23 @@ } {{/discriminator}} + /** + * 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. @@ -316,7 +402,7 @@ /** * Gets {{name}} * - * @return {{#vendorExtensions.x-int-or-string}}int|string{{/vendorExtensions.x-int-or-string}}{{^vendorExtensions.x-int-or-string}}{{{dataType}}}{{/vendorExtensions.x-int-or-string}}{{^required}}|null{{/required}} + * @return {{{dataType}}}{{^required}}|null{{/required}} {{#deprecated}} * @deprecated {{/deprecated}} @@ -329,7 +415,7 @@ /** * Sets {{name}} * - * @param {{#vendorExtensions.x-int-or-string}}int|string{{/vendorExtensions.x-int-or-string}}{{^vendorExtensions.x-int-or-string}}{{{dataType}}}{{/vendorExtensions.x-int-or-string}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}} + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}} * * @return self {{#deprecated}} @@ -338,10 +424,27 @@ */ public function {{setter}}(${{name}}) { + {{#isNullable}} + if (is_null(${{name}})) { + array_push($this->openAPINullablesSetToNull, '{{name}}'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('{{name}}', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + {{/isNullable}} + {{^isNullable}} + if (is_null(${{name}})) { + throw new \InvalidArgumentException('non-nullable {{name}} cannot be null'); + } + {{/isNullable}} {{#isEnum}} $allowedValues = $this->{{getter}}AllowableValues(); {{^isContainer}} - if ({{^required}}!is_null(${{name}}) && {{/required}}!in_array(${{{name}}}, $allowedValues, true)) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}!in_array(${{{name}}}, $allowedValues, true)) { throw new \InvalidArgumentException( sprintf( "Invalid value '%s' for '{{name}}', must be one of '%s'", @@ -352,7 +455,7 @@ } {{/isContainer}} {{#isContainer}} - if ({{^required}}!is_null(${{name}}) && {{/required}}array_diff(${{{name}}}, $allowedValues)) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}array_diff(${{{name}}}, $allowedValues)) { throw new \InvalidArgumentException( sprintf( "Invalid value for '{{name}}', must be one of '%s'", @@ -364,35 +467,35 @@ {{/isEnum}} {{#hasValidation}} {{#maxLength}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) > {{maxLength}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) > {{maxLength}})) { throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); }{{/maxLength}} {{#minLength}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) < {{minLength}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(mb_strlen(${{name}}) < {{minLength}})) { throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); } {{/minLength}} {{#maximum}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); } {{/maximum}} {{#minimum}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); } {{/minimum}} {{#pattern}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) { - throw new \InvalidArgumentException("invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(!preg_match("{{{pattern}}}", ObjectSerializer::toString(${{name}})))) { + throw new \InvalidArgumentException("invalid value for \${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); } {{/pattern}} {{#maxItems}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) > {{maxItems}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) > {{maxItems}})) { throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); }{{/maxItems}} {{#minItems}} - if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) < {{minItems}})) { + if ({{#isNullable}}!is_null(${{name}}) && {{/isNullable}}(count(${{name}}) < {{minItems}})) { throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); } {{/minItems}} @@ -405,12 +508,12 @@ /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset + * @param integer $offset Offset * * @return boolean */ - #[ReturnTypeWillChange] - public function offsetExists($offset) + #[\ReturnTypeWillChange] + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -418,11 +521,11 @@ /** * Gets offset. * - * @param mixed $offset Offset + * @param integer $offset Offset * * @return mixed|null */ - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->container[$offset] ?? null; @@ -431,13 +534,13 @@ /** * Sets value based on offset. * - * @param mixed $offset Offset + * @param int|null $offset Offset * @param mixed $value Value to be set * * @return void */ - #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -449,12 +552,12 @@ /** * Unsets offset. * - * @param mixed $offset Offset + * @param integer $offset Offset * * @return void */ - #[ReturnTypeWillChange] - public function offsetUnset($offset) + #[\ReturnTypeWillChange] + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -463,10 +566,10 @@ * 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 scalar|object|array|null Returns data which can be serialized by json_encode(), which is a value + * @return mixed Returns data which can be serialized by json_encode(), which is a value * of any type other than a resource. */ - #[ReturnTypeWillChange] + #[\ReturnTypeWillChange] public function jsonSerialize() { return ObjectSerializer::sanitizeForSerialization($this); @@ -481,7 +584,7 @@ { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_UNESCAPED_SLASHES + JSON_PRETTY_PRINT ); } diff --git a/sdks/php/templates/model_test.mustache b/sdks/php/templates/model_test.mustache index c1b70a6fb..f1c46499b 100644 --- a/sdks/php/templates/model_test.mustache +++ b/sdks/php/templates/model_test.mustache @@ -4,7 +4,7 @@ /** * {{classname}}Test * - * PHP version {{phpVersion}} + * PHP version 7.4 * * @category Class * @package {{invokerPackage}} @@ -69,17 +69,17 @@ class {{classname}}Test extends TestCase public function test{{classname}}() { // TODO: implement - $this->markTestIncomplete('Not implemented'); + self::markTestIncomplete('Not implemented'); } {{#vars}} /** * Test attribute "{{name}}" */ - public function testProperty{{nameInCamelCase}}() + public function testProperty{{nameInPascalCase}}() { // TODO: implement - $this->markTestIncomplete('Not implemented'); + self::markTestIncomplete('Not implemented'); } {{/vars}} } diff --git a/sdks/php/templates/partial_header.mustache b/sdks/php/templates/partial_header.mustache index ef3530aae..bc1b11e29 100644 --- a/sdks/php/templates/partial_header.mustache +++ b/sdks/php/templates/partial_header.mustache @@ -14,5 +14,5 @@ * Contact: {{{.}}} {{/infoEmail}} * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: {{{generatorVersion}}} + * Generator version: {{{generatorVersion}}} */ diff --git a/sdks/php/templates/phpunit.xml.mustache b/sdks/php/templates/phpunit.xml.mustache index b72fb7c6e..735a746ca 100644 --- a/sdks/php/templates/phpunit.xml.mustache +++ b/sdks/php/templates/phpunit.xml.mustache @@ -2,8 +2,8 @@ - {{apiSrcPath}} - {{modelSrcPath}} + {{#lambda.forwardslash}}{{apiSrcPath}}{{/lambda.forwardslash}} + {{#lambda.forwardslash}}{{modelSrcPath}}{{/lambda.forwardslash}} From 1698abed728dc53a39b2432a5b03d4f1635e6d79 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 14:04:48 -0500 Subject: [PATCH 02/19] Add ::getResponse() --- sdks/php/run-build | 2 -- sdks/php/templates/api.mustache | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/sdks/php/run-build b/sdks/php/run-build index 78c15b701..bfc018aa2 100755 --- a/sdks/php/run-build +++ b/sdks/php/run-build @@ -16,8 +16,6 @@ docker run --rm \ -t "/local/templates" \ -o "/local/" -rm -rf "${DIR}/.openapi-generator" - printf "\nInstalling composer dependencies ...\n" mkdir -p "${DIR}/vendor" bash "${DIR}/bin/php" composer install diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index d25fd36b9..5ab07824a 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -70,6 +70,11 @@ use {{invokerPackage}}\ObjectSerializer; {{/consumes}} ],{{/operation}} ]; + /** + * @var ResponseInterface|null + */ + protected $response; + /** * @param Configuration $config * @param ClientInterface $client @@ -116,6 +121,14 @@ use {{invokerPackage}}\ObjectSerializer; return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + {{#operation}} /** * Operation {{{operationId}}} @@ -237,6 +250,7 @@ use {{invokerPackage}}\ObjectSerializer; $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", From b25cdc358b464f3c5ed7c576c2d2dc0aeff90c3e Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 15:29:54 -0500 Subject: [PATCH 03/19] Further fixing --- sdks/php/.php-cs-fixer.dist.php | 3 ++ sdks/php/bin/php-8 | 20 ++++++++++ sdks/php/run-build | 4 +- sdks/php/src/Api/AccountApi.php | 22 +++++++++-- sdks/php/src/Api/ApiAppApi.php | 23 +++++++++-- sdks/php/src/Api/BulkSendJobApi.php | 20 ++++++++-- sdks/php/src/Api/EmbeddedApi.php | 20 ++++++++-- sdks/php/src/Api/OAuthApi.php | 20 ++++++++-- sdks/php/src/Api/ReportApi.php | 19 ++++++++-- sdks/php/src/Api/SignatureRequestApi.php | 34 +++++++++++++++-- sdks/php/src/Api/TeamApi.php | 28 ++++++++++++-- sdks/php/src/Api/TemplateApi.php | 29 ++++++++++++-- sdks/php/src/Api/UnclaimedDraftApi.php | 22 +++++++++-- sdks/php/src/ApiException.php | 4 +- sdks/php/src/Model/AccountCreateRequest.php | 8 ++-- sdks/php/src/Model/AccountCreateResponse.php | 8 ++-- sdks/php/src/Model/AccountGetResponse.php | 8 ++-- sdks/php/src/Model/AccountResponse.php | 8 ++-- sdks/php/src/Model/AccountResponseQuotas.php | 8 ++-- sdks/php/src/Model/AccountResponseUsage.php | 8 ++-- sdks/php/src/Model/AccountUpdateRequest.php | 8 ++-- sdks/php/src/Model/AccountVerifyRequest.php | 8 ++-- sdks/php/src/Model/AccountVerifyResponse.php | 8 ++-- .../Model/AccountVerifyResponseAccount.php | 8 ++-- sdks/php/src/Model/ApiAppCreateRequest.php | 8 ++-- sdks/php/src/Model/ApiAppGetResponse.php | 8 ++-- sdks/php/src/Model/ApiAppListResponse.php | 8 ++-- sdks/php/src/Model/ApiAppResponse.php | 8 ++-- sdks/php/src/Model/ApiAppResponseOAuth.php | 8 ++-- sdks/php/src/Model/ApiAppResponseOptions.php | 8 ++-- .../src/Model/ApiAppResponseOwnerAccount.php | 8 ++-- .../ApiAppResponseWhiteLabelingOptions.php | 8 ++-- sdks/php/src/Model/ApiAppUpdateRequest.php | 8 ++-- sdks/php/src/Model/BulkSendJobGetResponse.php | 8 ++-- ...ulkSendJobGetResponseSignatureRequests.php | 8 ++-- .../php/src/Model/BulkSendJobListResponse.php | 8 ++-- sdks/php/src/Model/BulkSendJobResponse.php | 8 ++-- .../php/src/Model/BulkSendJobSendResponse.php | 8 ++-- sdks/php/src/Model/EmbeddedEditUrlRequest.php | 8 ++-- .../php/src/Model/EmbeddedEditUrlResponse.php | 8 ++-- .../Model/EmbeddedEditUrlResponseEmbedded.php | 8 ++-- .../php/src/Model/EmbeddedSignUrlResponse.php | 8 ++-- .../Model/EmbeddedSignUrlResponseEmbedded.php | 8 ++-- sdks/php/src/Model/ErrorResponse.php | 8 ++-- sdks/php/src/Model/ErrorResponseError.php | 8 ++-- sdks/php/src/Model/EventCallbackRequest.php | 8 ++-- .../src/Model/EventCallbackRequestEvent.php | 8 ++-- .../EventCallbackRequestEventMetadata.php | 8 ++-- sdks/php/src/Model/FileResponse.php | 8 ++-- sdks/php/src/Model/FileResponseDataUri.php | 8 ++-- sdks/php/src/Model/ListInfoResponse.php | 8 ++-- .../src/Model/OAuthTokenGenerateRequest.php | 8 ++-- .../src/Model/OAuthTokenRefreshRequest.php | 8 ++-- sdks/php/src/Model/OAuthTokenResponse.php | 8 ++-- sdks/php/src/Model/ReportCreateRequest.php | 8 ++-- sdks/php/src/Model/ReportCreateResponse.php | 8 ++-- sdks/php/src/Model/ReportResponse.php | 8 ++-- ...tBulkCreateEmbeddedWithTemplateRequest.php | 8 ++-- ...tureRequestBulkSendWithTemplateRequest.php | 8 ++-- .../SignatureRequestCreateEmbeddedRequest.php | 8 ++-- ...questCreateEmbeddedWithTemplateRequest.php | 8 ++-- .../src/Model/SignatureRequestGetResponse.php | 8 ++-- .../Model/SignatureRequestListResponse.php | 8 ++-- .../Model/SignatureRequestRemindRequest.php | 8 ++-- .../src/Model/SignatureRequestResponse.php | 8 ++-- .../SignatureRequestResponseAttachment.php | 8 ++-- ...ignatureRequestResponseCustomFieldBase.php | 6 ++- ...tureRequestResponseCustomFieldCheckbox.php | 8 ++-- ...ignatureRequestResponseCustomFieldText.php | 8 ++-- .../SignatureRequestResponseDataBase.php | 6 ++- ...natureRequestResponseDataValueCheckbox.php | 8 ++-- ...eRequestResponseDataValueCheckboxMerge.php | 8 ++-- ...tureRequestResponseDataValueDateSigned.php | 8 ++-- ...natureRequestResponseDataValueDropdown.php | 8 ++-- ...natureRequestResponseDataValueInitials.php | 8 ++-- ...SignatureRequestResponseDataValueRadio.php | 8 ++-- ...atureRequestResponseDataValueSignature.php | 8 ++-- .../SignatureRequestResponseDataValueText.php | 8 ++-- ...atureRequestResponseDataValueTextMerge.php | 8 ++-- .../SignatureRequestResponseSignatures.php | 8 ++-- .../src/Model/SignatureRequestSendRequest.php | 8 ++-- ...ignatureRequestSendWithTemplateRequest.php | 8 ++-- .../Model/SignatureRequestUpdateRequest.php | 8 ++-- sdks/php/src/Model/SubAttachment.php | 8 ++-- sdks/php/src/Model/SubBulkSignerList.php | 8 ++-- .../Model/SubBulkSignerListCustomField.php | 8 ++-- sdks/php/src/Model/SubCC.php | 8 ++-- sdks/php/src/Model/SubCustomField.php | 8 ++-- sdks/php/src/Model/SubEditorOptions.php | 8 ++-- sdks/php/src/Model/SubFieldOptions.php | 8 ++-- sdks/php/src/Model/SubFormFieldGroup.php | 8 ++-- sdks/php/src/Model/SubFormFieldRule.php | 8 ++-- sdks/php/src/Model/SubFormFieldRuleAction.php | 8 ++-- .../php/src/Model/SubFormFieldRuleTrigger.php | 8 ++-- .../Model/SubFormFieldsPerDocumentBase.php | 6 ++- .../SubFormFieldsPerDocumentCheckbox.php | 8 ++-- .../SubFormFieldsPerDocumentCheckboxMerge.php | 8 ++-- .../SubFormFieldsPerDocumentDateSigned.php | 8 ++-- .../SubFormFieldsPerDocumentDropdown.php | 8 ++-- .../SubFormFieldsPerDocumentHyperlink.php | 8 ++-- .../SubFormFieldsPerDocumentInitials.php | 8 ++-- .../Model/SubFormFieldsPerDocumentRadio.php | 8 ++-- .../SubFormFieldsPerDocumentSignature.php | 8 ++-- .../Model/SubFormFieldsPerDocumentText.php | 8 ++-- .../SubFormFieldsPerDocumentTextMerge.php | 8 ++-- sdks/php/src/Model/SubMergeField.php | 8 ++-- sdks/php/src/Model/SubOAuth.php | 8 ++-- sdks/php/src/Model/SubOptions.php | 8 ++-- .../SubSignatureRequestGroupedSigners.php | 8 ++-- .../src/Model/SubSignatureRequestSigner.php | 8 ++-- .../SubSignatureRequestTemplateSigner.php | 8 ++-- sdks/php/src/Model/SubSigningOptions.php | 8 ++-- sdks/php/src/Model/SubTeamResponse.php | 8 ++-- sdks/php/src/Model/SubTemplateRole.php | 8 ++-- .../php/src/Model/SubUnclaimedDraftSigner.php | 8 ++-- .../Model/SubUnclaimedDraftTemplateSigner.php | 8 ++-- .../php/src/Model/SubWhiteLabelingOptions.php | 8 ++-- sdks/php/src/Model/TeamAddMemberRequest.php | 8 ++-- sdks/php/src/Model/TeamCreateRequest.php | 8 ++-- sdks/php/src/Model/TeamGetInfoResponse.php | 8 ++-- sdks/php/src/Model/TeamGetResponse.php | 8 ++-- sdks/php/src/Model/TeamInfoResponse.php | 8 ++-- sdks/php/src/Model/TeamInviteResponse.php | 8 ++-- sdks/php/src/Model/TeamInvitesResponse.php | 8 ++-- sdks/php/src/Model/TeamMemberResponse.php | 8 ++-- sdks/php/src/Model/TeamMembersResponse.php | 8 ++-- sdks/php/src/Model/TeamParentResponse.php | 8 ++-- .../php/src/Model/TeamRemoveMemberRequest.php | 8 ++-- sdks/php/src/Model/TeamResponse.php | 8 ++-- sdks/php/src/Model/TeamSubTeamsResponse.php | 8 ++-- sdks/php/src/Model/TeamUpdateRequest.php | 8 ++-- sdks/php/src/Model/TemplateAddUserRequest.php | 8 ++-- .../TemplateCreateEmbeddedDraftRequest.php | 8 ++-- .../TemplateCreateEmbeddedDraftResponse.php | 8 ++-- ...ateCreateEmbeddedDraftResponseTemplate.php | 8 ++-- sdks/php/src/Model/TemplateCreateRequest.php | 8 ++-- sdks/php/src/Model/TemplateCreateResponse.php | 8 ++-- .../Model/TemplateCreateResponseTemplate.php | 8 ++-- sdks/php/src/Model/TemplateEditResponse.php | 8 ++-- sdks/php/src/Model/TemplateGetResponse.php | 8 ++-- sdks/php/src/Model/TemplateListResponse.php | 8 ++-- .../src/Model/TemplateRemoveUserRequest.php | 8 ++-- sdks/php/src/Model/TemplateResponse.php | 8 ++-- .../php/src/Model/TemplateResponseAccount.php | 8 ++-- .../Model/TemplateResponseAccountQuota.php | 8 ++-- sdks/php/src/Model/TemplateResponseCCRole.php | 8 ++-- .../src/Model/TemplateResponseDocument.php | 8 ++-- ...emplateResponseDocumentCustomFieldBase.php | 6 ++- ...ateResponseDocumentCustomFieldCheckbox.php | 8 ++-- ...emplateResponseDocumentCustomFieldText.php | 8 ++-- .../TemplateResponseDocumentFieldGroup.php | 8 ++-- ...TemplateResponseDocumentFieldGroupRule.php | 8 ++-- .../TemplateResponseDocumentFormFieldBase.php | 6 ++- ...plateResponseDocumentFormFieldCheckbox.php | 8 ++-- ...ateResponseDocumentFormFieldDateSigned.php | 8 ++-- ...plateResponseDocumentFormFieldDropdown.php | 8 ++-- ...lateResponseDocumentFormFieldHyperlink.php | 8 ++-- ...plateResponseDocumentFormFieldInitials.php | 8 ++-- ...TemplateResponseDocumentFormFieldRadio.php | 8 ++-- ...lateResponseDocumentFormFieldSignature.php | 8 ++-- .../TemplateResponseDocumentFormFieldText.php | 8 ++-- ...emplateResponseDocumentStaticFieldBase.php | 6 ++- ...ateResponseDocumentStaticFieldCheckbox.php | 8 ++-- ...eResponseDocumentStaticFieldDateSigned.php | 8 ++-- ...ateResponseDocumentStaticFieldDropdown.php | 8 ++-- ...teResponseDocumentStaticFieldHyperlink.php | 8 ++-- ...ateResponseDocumentStaticFieldInitials.php | 8 ++-- ...mplateResponseDocumentStaticFieldRadio.php | 8 ++-- ...teResponseDocumentStaticFieldSignature.php | 8 ++-- ...emplateResponseDocumentStaticFieldText.php | 8 ++-- .../TemplateResponseFieldAvgTextLength.php | 8 ++-- .../src/Model/TemplateResponseSignerRole.php | 8 ++-- .../src/Model/TemplateUpdateFilesRequest.php | 8 ++-- .../src/Model/TemplateUpdateFilesResponse.php | 8 ++-- .../TemplateUpdateFilesResponseTemplate.php | 8 ++-- .../UnclaimedDraftCreateEmbeddedRequest.php | 8 ++-- ...DraftCreateEmbeddedWithTemplateRequest.php | 8 ++-- .../src/Model/UnclaimedDraftCreateRequest.php | 8 ++-- .../Model/UnclaimedDraftCreateResponse.php | 8 ++-- .../UnclaimedDraftEditAndResendRequest.php | 8 ++-- sdks/php/src/Model/UnclaimedDraftResponse.php | 8 ++-- sdks/php/src/Model/WarningResponse.php | 8 ++-- sdks/php/src/ObjectSerializer.php | 38 ++++++++++--------- sdks/php/templates/.php-cs-fixer.dist.php | 3 ++ sdks/php/templates/ApiException.mustache | 2 +- sdks/php/templates/ObjectSerializer.mustache | 10 ++--- sdks/php/templates/api.mustache | 7 ++-- .../libraries/psr-18/ApiException.mustache | 2 +- sdks/php/templates/model_generic.mustache | 6 +-- 189 files changed, 1105 insertions(+), 563 deletions(-) create mode 100755 sdks/php/bin/php-8 diff --git a/sdks/php/.php-cs-fixer.dist.php b/sdks/php/.php-cs-fixer.dist.php index d93659d70..a8ff32efd 100644 --- a/sdks/php/.php-cs-fixer.dist.php +++ b/sdks/php/.php-cs-fixer.dist.php @@ -96,6 +96,9 @@ 'elements' => ['method', 'property'], ], 'yoda_style' => false, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + ], ]) ->setFinder($finder) ->setRiskyAllowed(true) diff --git a/sdks/php/bin/php-8 b/sdks/php/bin/php-8 new file mode 100755 index 000000000..c4a5bb062 --- /dev/null +++ b/sdks/php/bin/php-8 @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# Warning: You should run this from rootless Docker (or Podman, or other) + +set -e + +DIR=$(cd `dirname $0` && pwd) +ROOT_DIR="${DIR}/.." +WORKING_DIR="/app/php" + +docker run --rm \ + -v "${ROOT_DIR}:${WORKING_DIR}" \ + -v "dropbox-sign-sdk-composer-cache:/.composer" \ + -w "${WORKING_DIR}" \ + -u root:root \ + -e PHP.display_errors=1 \ + -e PHP.error_reporting=-1 \ + jtreminio/php:8.1 "$@" + + exit 0 diff --git a/sdks/php/run-build b/sdks/php/run-build index bfc018aa2..b847c81f4 100755 --- a/sdks/php/run-build +++ b/sdks/php/run-build @@ -22,10 +22,10 @@ bash "${DIR}/bin/php" composer install printf "\n" printf "Adding examples to Docs ...\n" -bash "${DIR}/bin/php" ./bin/generate-examples.php +bash "${DIR}/bin/php-8" ./bin/generate-examples.php printf "Running php-cs-fixer ...\n" -bash "${DIR}/bin/php" ./vendor/bin/php-cs-fixer fix --verbose +bash "${DIR}/bin/php-8" ./vendor/bin/php-cs-fixer fix --verbose printf "Replacing strings ...\n" docker run --rm \ diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 541bf3bac..a24fb2488 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -80,6 +81,9 @@ class AccountApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -123,6 +127,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation accountCreate * @@ -161,6 +173,7 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -499,6 +512,7 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -833,6 +847,7 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1169,6 +1184,7 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1490,9 +1506,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -1524,7 +1540,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index f387a8f38..a3e0da033 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -85,6 +86,9 @@ class ApiAppApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -128,6 +132,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation apiAppCreate * @@ -166,6 +178,7 @@ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_crea $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -500,6 +513,7 @@ public function apiAppDeleteWithHttpInfo(string $client_id, string $contentType $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -742,6 +756,7 @@ public function apiAppGetWithHttpInfo(string $client_id, string $contentType = s $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1072,6 +1087,7 @@ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20, strin $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1408,6 +1424,7 @@ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRe $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1748,9 +1765,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -1782,7 +1799,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 8b9a49056..99b84d2ad 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -74,6 +75,9 @@ class BulkSendJobApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -117,6 +121,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation bulkSendJobGet * @@ -159,6 +171,7 @@ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -514,6 +527,7 @@ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -833,9 +847,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -867,7 +881,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 87a001311..4c7d54247 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -74,6 +75,9 @@ class EmbeddedApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -117,6 +121,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation embeddedEditUrl * @@ -157,6 +169,7 @@ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedE $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -512,6 +525,7 @@ public function embeddedSignUrlWithHttpInfo(string $signature_id, string $conten $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -825,9 +839,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -859,7 +873,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 5a34bd087..88c48943f 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -74,6 +75,9 @@ class OAuthApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -117,6 +121,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation oauthTokenGenerate * @@ -167,6 +179,7 @@ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -537,6 +550,7 @@ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -880,9 +894,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -914,7 +928,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 904c6dd92..a5a99844c 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -71,6 +72,9 @@ class ReportApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -114,6 +118,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation reportCreate * @@ -152,6 +164,7 @@ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_creat $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -469,9 +482,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -503,7 +516,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index 3b1357caa..0c6c4ae65 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; use SplFileObject; @@ -123,6 +124,9 @@ class SignatureRequestApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -166,6 +170,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation signatureRequestBulkCreateEmbeddedWithTemplate * @@ -204,6 +216,7 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -536,6 +549,7 @@ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\Signature $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -870,6 +884,7 @@ public function signatureRequestCancelWithHttpInfo(string $signature_request_id, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1112,6 +1127,7 @@ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureReques $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1448,6 +1464,7 @@ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\Sig $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1786,6 +1803,7 @@ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2127,6 +2145,7 @@ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_req $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2457,6 +2476,7 @@ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_req $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2798,6 +2818,7 @@ public function signatureRequestGetWithHttpInfo(string $signature_request_id, st $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3132,6 +3153,7 @@ public function signatureRequestListWithHttpInfo(string $account_id = null, int $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3490,6 +3512,7 @@ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_reques $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3820,6 +3843,7 @@ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -4173,6 +4197,7 @@ public function signatureRequestRemoveWithHttpInfo(string $signature_request_id, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -4411,6 +4436,7 @@ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendReque $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -4747,6 +4773,7 @@ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -5085,6 +5112,7 @@ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -5425,9 +5453,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -5459,7 +5487,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 8b0df3450..77aadc4a8 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -98,6 +99,9 @@ class TeamApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -141,6 +145,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation teamAddMember * @@ -181,6 +193,7 @@ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_m $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -530,6 +543,7 @@ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_requ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -862,6 +876,7 @@ public function teamDeleteWithHttpInfo(string $contentType = self::contentTypes[ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1083,6 +1098,7 @@ public function teamGetWithHttpInfo(string $contentType = self::contentTypes['te $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1392,6 +1408,7 @@ public function teamInfoWithHttpInfo(string $team_id = null, string $contentType $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1714,6 +1731,7 @@ public function teamInvitesWithHttpInfo(string $email_address = null, string $co $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2040,6 +2058,7 @@ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $pag $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2400,6 +2419,7 @@ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2740,6 +2760,7 @@ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $pa $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3100,6 +3121,7 @@ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_requ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3421,9 +3443,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -3455,7 +3477,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index e3e716a77..6ac5266a0 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; use SplFileObject; @@ -105,6 +106,9 @@ class TemplateApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -148,6 +152,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation templateAddUser * @@ -188,6 +200,7 @@ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateA $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -543,6 +556,7 @@ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -879,6 +893,7 @@ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbe $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1213,6 +1228,7 @@ public function templateDeleteWithHttpInfo(string $template_id, string $contentT $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1457,6 +1473,7 @@ public function templateFilesWithHttpInfo(string $template_id, string $file_type $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1798,6 +1815,7 @@ public function templateFilesAsDataUriWithHttpInfo(string $template_id, string $ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2128,6 +2146,7 @@ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $for $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2469,6 +2488,7 @@ public function templateGetWithHttpInfo(string $template_id, string $contentType $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -2803,6 +2823,7 @@ public function templateListWithHttpInfo(string $account_id = null, int $page = $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3170,6 +3191,7 @@ public function templateRemoveUserWithHttpInfo(string $template_id, Model\Templa $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3527,6 +3549,7 @@ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\Templ $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -3867,9 +3890,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -3901,7 +3924,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index ce65936ed..b7337c038 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -40,6 +40,7 @@ use GuzzleHttp\RequestOptions; use InvalidArgumentException; use JsonException; +use Psr\Http\Message\ResponseInterface; use RuntimeException; /** @@ -83,6 +84,9 @@ class UnclaimedDraftApi ], ]; + /** @var ResponseInterface|null */ + protected $response; + /** * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec */ @@ -126,6 +130,14 @@ public function getConfig() return $this->config; } + /** + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + /** * Operation unclaimedDraftCreate * @@ -164,6 +176,7 @@ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateReque $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -500,6 +513,7 @@ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCre $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -836,6 +850,7 @@ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\Uncla $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1174,6 +1189,7 @@ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_reques $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); + $this->response = $response; } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -1514,9 +1530,9 @@ protected function createHttpClientOption() * @return object|array|null */ private function handleRangeCodeResponse( - mixed $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); @@ -1548,7 +1564,7 @@ private function handleRangeCodeResponse( private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/src/ApiException.php b/sdks/php/src/ApiException.php index 42f035f1e..a79ff7157 100644 --- a/sdks/php/src/ApiException.php +++ b/sdks/php/src/ApiException.php @@ -96,9 +96,9 @@ public function getResponseBody() /** * Sets the deserialized response object (during deserialization) * - * @param mixed $obj Deserialized response object + * @param string|int|object|array|mixed $obj Deserialized response object */ - public function setResponseObject(mixed $obj) + public function setResponseObject($obj) { $this->responseObject = $obj; } diff --git a/sdks/php/src/Model/AccountCreateRequest.php b/sdks/php/src/Model/AccountCreateRequest.php index d756597a3..963dc14ab 100644 --- a/sdks/php/src/Model/AccountCreateRequest.php +++ b/sdks/php/src/Model/AccountCreateRequest.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): AccountCreateRequest */ public static function init(array $data): AccountCreateRequest { - /** @var AccountCreateRequest $obj */ + /** @var AccountCreateRequest */ return ObjectSerializer::deserialize( $data, AccountCreateRequest::class, @@ -283,8 +283,10 @@ public static function init(array $data): AccountCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -500,7 +502,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountCreateResponse.php b/sdks/php/src/Model/AccountCreateResponse.php index 1eb26a157..8b4949a0a 100644 --- a/sdks/php/src/Model/AccountCreateResponse.php +++ b/sdks/php/src/Model/AccountCreateResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): AccountCreateResponse */ public static function init(array $data): AccountCreateResponse { - /** @var AccountCreateResponse $obj */ + /** @var AccountCreateResponse */ return ObjectSerializer::deserialize( $data, AccountCreateResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): AccountCreateResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountGetResponse.php b/sdks/php/src/Model/AccountGetResponse.php index 5923246b4..4dfff2638 100644 --- a/sdks/php/src/Model/AccountGetResponse.php +++ b/sdks/php/src/Model/AccountGetResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): AccountGetResponse */ public static function init(array $data): AccountGetResponse { - /** @var AccountGetResponse $obj */ + /** @var AccountGetResponse */ return ObjectSerializer::deserialize( $data, AccountGetResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): AccountGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountResponse.php b/sdks/php/src/Model/AccountResponse.php index 436f640bd..9ada4fa7e 100644 --- a/sdks/php/src/Model/AccountResponse.php +++ b/sdks/php/src/Model/AccountResponse.php @@ -321,7 +321,7 @@ public static function fromArray(array $data): AccountResponse */ public static function init(array $data): AccountResponse { - /** @var AccountResponse $obj */ + /** @var AccountResponse */ return ObjectSerializer::deserialize( $data, AccountResponse::class, @@ -332,8 +332,10 @@ public static function init(array $data): AccountResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -761,7 +763,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountResponseQuotas.php b/sdks/php/src/Model/AccountResponseQuotas.php index d723541ce..53d691406 100644 --- a/sdks/php/src/Model/AccountResponseQuotas.php +++ b/sdks/php/src/Model/AccountResponseQuotas.php @@ -286,7 +286,7 @@ public static function fromArray(array $data): AccountResponseQuotas */ public static function init(array $data): AccountResponseQuotas { - /** @var AccountResponseQuotas $obj */ + /** @var AccountResponseQuotas */ return ObjectSerializer::deserialize( $data, AccountResponseQuotas::class, @@ -297,8 +297,10 @@ public static function init(array $data): AccountResponseQuotas * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -605,7 +607,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountResponseUsage.php b/sdks/php/src/Model/AccountResponseUsage.php index d59ee3ce3..082817de4 100644 --- a/sdks/php/src/Model/AccountResponseUsage.php +++ b/sdks/php/src/Model/AccountResponseUsage.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): AccountResponseUsage */ public static function init(array $data): AccountResponseUsage { - /** @var AccountResponseUsage $obj */ + /** @var AccountResponseUsage */ return ObjectSerializer::deserialize( $data, AccountResponseUsage::class, @@ -262,8 +262,10 @@ public static function init(array $data): AccountResponseUsage * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -400,7 +402,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountUpdateRequest.php b/sdks/php/src/Model/AccountUpdateRequest.php index 9860e9268..89ca192dd 100644 --- a/sdks/php/src/Model/AccountUpdateRequest.php +++ b/sdks/php/src/Model/AccountUpdateRequest.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): AccountUpdateRequest */ public static function init(array $data): AccountUpdateRequest { - /** @var AccountUpdateRequest $obj */ + /** @var AccountUpdateRequest */ return ObjectSerializer::deserialize( $data, AccountUpdateRequest::class, @@ -276,8 +276,10 @@ public static function init(array $data): AccountUpdateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -468,7 +470,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountVerifyRequest.php b/sdks/php/src/Model/AccountVerifyRequest.php index a7c83be5c..bf5addf20 100644 --- a/sdks/php/src/Model/AccountVerifyRequest.php +++ b/sdks/php/src/Model/AccountVerifyRequest.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): AccountVerifyRequest */ public static function init(array $data): AccountVerifyRequest { - /** @var AccountVerifyRequest $obj */ + /** @var AccountVerifyRequest */ return ObjectSerializer::deserialize( $data, AccountVerifyRequest::class, @@ -262,8 +262,10 @@ public static function init(array $data): AccountVerifyRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -398,7 +400,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountVerifyResponse.php b/sdks/php/src/Model/AccountVerifyResponse.php index 8d58413b2..ec83786d3 100644 --- a/sdks/php/src/Model/AccountVerifyResponse.php +++ b/sdks/php/src/Model/AccountVerifyResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): AccountVerifyResponse */ public static function init(array $data): AccountVerifyResponse { - /** @var AccountVerifyResponse $obj */ + /** @var AccountVerifyResponse */ return ObjectSerializer::deserialize( $data, AccountVerifyResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): AccountVerifyResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/AccountVerifyResponseAccount.php b/sdks/php/src/Model/AccountVerifyResponseAccount.php index 0dafa1045..3a400dc6a 100644 --- a/sdks/php/src/Model/AccountVerifyResponseAccount.php +++ b/sdks/php/src/Model/AccountVerifyResponseAccount.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): AccountVerifyResponseAccount */ public static function init(array $data): AccountVerifyResponseAccount { - /** @var AccountVerifyResponseAccount $obj */ + /** @var AccountVerifyResponseAccount */ return ObjectSerializer::deserialize( $data, AccountVerifyResponseAccount::class, @@ -262,8 +262,10 @@ public static function init(array $data): AccountVerifyResponseAccount * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppCreateRequest.php b/sdks/php/src/Model/ApiAppCreateRequest.php index 3b9626847..b6cb69f5d 100644 --- a/sdks/php/src/Model/ApiAppCreateRequest.php +++ b/sdks/php/src/Model/ApiAppCreateRequest.php @@ -294,7 +294,7 @@ public static function fromArray(array $data): ApiAppCreateRequest */ public static function init(array $data): ApiAppCreateRequest { - /** @var ApiAppCreateRequest $obj */ + /** @var ApiAppCreateRequest */ return ObjectSerializer::deserialize( $data, ApiAppCreateRequest::class, @@ -305,8 +305,10 @@ public static function init(array $data): ApiAppCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -621,7 +623,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppGetResponse.php b/sdks/php/src/Model/ApiAppGetResponse.php index 03cb956ef..4a8da0e31 100644 --- a/sdks/php/src/Model/ApiAppGetResponse.php +++ b/sdks/php/src/Model/ApiAppGetResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): ApiAppGetResponse */ public static function init(array $data): ApiAppGetResponse { - /** @var ApiAppGetResponse $obj */ + /** @var ApiAppGetResponse */ return ObjectSerializer::deserialize( $data, ApiAppGetResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): ApiAppGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppListResponse.php b/sdks/php/src/Model/ApiAppListResponse.php index b99df032d..2248124e7 100644 --- a/sdks/php/src/Model/ApiAppListResponse.php +++ b/sdks/php/src/Model/ApiAppListResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): ApiAppListResponse */ public static function init(array $data): ApiAppListResponse { - /** @var ApiAppListResponse $obj */ + /** @var ApiAppListResponse */ return ObjectSerializer::deserialize( $data, ApiAppListResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): ApiAppListResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppResponse.php b/sdks/php/src/Model/ApiAppResponse.php index 8ecab40f6..02dae90f3 100644 --- a/sdks/php/src/Model/ApiAppResponse.php +++ b/sdks/php/src/Model/ApiAppResponse.php @@ -315,7 +315,7 @@ public static function fromArray(array $data): ApiAppResponse */ public static function init(array $data): ApiAppResponse { - /** @var ApiAppResponse $obj */ + /** @var ApiAppResponse */ return ObjectSerializer::deserialize( $data, ApiAppResponse::class, @@ -326,8 +326,10 @@ public static function init(array $data): ApiAppResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -728,7 +730,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppResponseOAuth.php b/sdks/php/src/Model/ApiAppResponseOAuth.php index 6823b6326..16bc5bb70 100644 --- a/sdks/php/src/Model/ApiAppResponseOAuth.php +++ b/sdks/php/src/Model/ApiAppResponseOAuth.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): ApiAppResponseOAuth */ public static function init(array $data): ApiAppResponseOAuth { - /** @var ApiAppResponseOAuth $obj */ + /** @var ApiAppResponseOAuth */ return ObjectSerializer::deserialize( $data, ApiAppResponseOAuth::class, @@ -284,8 +284,10 @@ public static function init(array $data): ApiAppResponseOAuth * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -496,7 +498,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppResponseOptions.php b/sdks/php/src/Model/ApiAppResponseOptions.php index 9eccb73f1..746771962 100644 --- a/sdks/php/src/Model/ApiAppResponseOptions.php +++ b/sdks/php/src/Model/ApiAppResponseOptions.php @@ -252,7 +252,7 @@ public static function fromArray(array $data): ApiAppResponseOptions */ public static function init(array $data): ApiAppResponseOptions { - /** @var ApiAppResponseOptions $obj */ + /** @var ApiAppResponseOptions */ return ObjectSerializer::deserialize( $data, ApiAppResponseOptions::class, @@ -263,8 +263,10 @@ public static function init(array $data): ApiAppResponseOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -394,7 +396,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php index 4dc4218c6..5bd18a67e 100644 --- a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php +++ b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): ApiAppResponseOwnerAccount */ public static function init(array $data): ApiAppResponseOwnerAccount { - /** @var ApiAppResponseOwnerAccount $obj */ + /** @var ApiAppResponseOwnerAccount */ return ObjectSerializer::deserialize( $data, ApiAppResponseOwnerAccount::class, @@ -270,8 +270,10 @@ public static function init(array $data): ApiAppResponseOwnerAccount * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php index 1577389cd..1a7a2a313 100644 --- a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php +++ b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php @@ -343,7 +343,7 @@ public static function fromArray(array $data): ApiAppResponseWhiteLabelingOption */ public static function init(array $data): ApiAppResponseWhiteLabelingOptions { - /** @var ApiAppResponseWhiteLabelingOptions $obj */ + /** @var ApiAppResponseWhiteLabelingOptions */ return ObjectSerializer::deserialize( $data, ApiAppResponseWhiteLabelingOptions::class, @@ -354,8 +354,10 @@ public static function init(array $data): ApiAppResponseWhiteLabelingOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -836,7 +838,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ApiAppUpdateRequest.php b/sdks/php/src/Model/ApiAppUpdateRequest.php index 92c0de25d..49b018abe 100644 --- a/sdks/php/src/Model/ApiAppUpdateRequest.php +++ b/sdks/php/src/Model/ApiAppUpdateRequest.php @@ -294,7 +294,7 @@ public static function fromArray(array $data): ApiAppUpdateRequest */ public static function init(array $data): ApiAppUpdateRequest { - /** @var ApiAppUpdateRequest $obj */ + /** @var ApiAppUpdateRequest */ return ObjectSerializer::deserialize( $data, ApiAppUpdateRequest::class, @@ -305,8 +305,10 @@ public static function init(array $data): ApiAppUpdateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -608,7 +610,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/BulkSendJobGetResponse.php b/sdks/php/src/Model/BulkSendJobGetResponse.php index da7241056..b8980437e 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponse.php +++ b/sdks/php/src/Model/BulkSendJobGetResponse.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): BulkSendJobGetResponse */ public static function init(array $data): BulkSendJobGetResponse { - /** @var BulkSendJobGetResponse $obj */ + /** @var BulkSendJobGetResponse */ return ObjectSerializer::deserialize( $data, BulkSendJobGetResponse::class, @@ -283,8 +283,10 @@ public static function init(array $data): BulkSendJobGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -495,7 +497,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php index 4349ced0f..90a73986a 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php +++ b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php @@ -419,7 +419,7 @@ public static function fromArray(array $data): BulkSendJobGetResponseSignatureRe */ public static function init(array $data): BulkSendJobGetResponseSignatureRequests { - /** @var BulkSendJobGetResponseSignatureRequests $obj */ + /** @var BulkSendJobGetResponseSignatureRequests */ return ObjectSerializer::deserialize( $data, BulkSendJobGetResponseSignatureRequests::class, @@ -430,8 +430,10 @@ public static function init(array $data): BulkSendJobGetResponseSignatureRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1279,7 +1281,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/BulkSendJobListResponse.php b/sdks/php/src/Model/BulkSendJobListResponse.php index eaca6d2b9..ded0433c9 100644 --- a/sdks/php/src/Model/BulkSendJobListResponse.php +++ b/sdks/php/src/Model/BulkSendJobListResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): BulkSendJobListResponse */ public static function init(array $data): BulkSendJobListResponse { - /** @var BulkSendJobListResponse $obj */ + /** @var BulkSendJobListResponse */ return ObjectSerializer::deserialize( $data, BulkSendJobListResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): BulkSendJobListResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/BulkSendJobResponse.php b/sdks/php/src/Model/BulkSendJobResponse.php index 91f641cb3..ac97f768c 100644 --- a/sdks/php/src/Model/BulkSendJobResponse.php +++ b/sdks/php/src/Model/BulkSendJobResponse.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): BulkSendJobResponse */ public static function init(array $data): BulkSendJobResponse { - /** @var BulkSendJobResponse $obj */ + /** @var BulkSendJobResponse */ return ObjectSerializer::deserialize( $data, BulkSendJobResponse::class, @@ -284,8 +284,10 @@ public static function init(array $data): BulkSendJobResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -503,7 +505,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/BulkSendJobSendResponse.php b/sdks/php/src/Model/BulkSendJobSendResponse.php index 2f247bb77..6fb19e166 100644 --- a/sdks/php/src/Model/BulkSendJobSendResponse.php +++ b/sdks/php/src/Model/BulkSendJobSendResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): BulkSendJobSendResponse */ public static function init(array $data): BulkSendJobSendResponse { - /** @var BulkSendJobSendResponse $obj */ + /** @var BulkSendJobSendResponse */ return ObjectSerializer::deserialize( $data, BulkSendJobSendResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): BulkSendJobSendResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlRequest.php b/sdks/php/src/Model/EmbeddedEditUrlRequest.php index 17ba3ba6e..dd7390180 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlRequest.php +++ b/sdks/php/src/Model/EmbeddedEditUrlRequest.php @@ -314,7 +314,7 @@ public static function fromArray(array $data): EmbeddedEditUrlRequest */ public static function init(array $data): EmbeddedEditUrlRequest { - /** @var EmbeddedEditUrlRequest $obj */ + /** @var EmbeddedEditUrlRequest */ return ObjectSerializer::deserialize( $data, EmbeddedEditUrlRequest::class, @@ -325,8 +325,10 @@ public static function init(array $data): EmbeddedEditUrlRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -699,7 +701,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponse.php b/sdks/php/src/Model/EmbeddedEditUrlResponse.php index 049524722..83fa0ef6c 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): EmbeddedEditUrlResponse */ public static function init(array $data): EmbeddedEditUrlResponse { - /** @var EmbeddedEditUrlResponse $obj */ + /** @var EmbeddedEditUrlResponse */ return ObjectSerializer::deserialize( $data, EmbeddedEditUrlResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): EmbeddedEditUrlResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php index e8167c00c..7a48b3e2c 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): EmbeddedEditUrlResponseEmbedded */ public static function init(array $data): EmbeddedEditUrlResponseEmbedded { - /** @var EmbeddedEditUrlResponseEmbedded $obj */ + /** @var EmbeddedEditUrlResponseEmbedded */ return ObjectSerializer::deserialize( $data, EmbeddedEditUrlResponseEmbedded::class, @@ -270,8 +270,10 @@ public static function init(array $data): EmbeddedEditUrlResponseEmbedded * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponse.php b/sdks/php/src/Model/EmbeddedSignUrlResponse.php index 137d58749..6c3d3ced2 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): EmbeddedSignUrlResponse */ public static function init(array $data): EmbeddedSignUrlResponse { - /** @var EmbeddedSignUrlResponse $obj */ + /** @var EmbeddedSignUrlResponse */ return ObjectSerializer::deserialize( $data, EmbeddedSignUrlResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): EmbeddedSignUrlResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php index 7a6629889..61fcc34a6 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): EmbeddedSignUrlResponseEmbedded */ public static function init(array $data): EmbeddedSignUrlResponseEmbedded { - /** @var EmbeddedSignUrlResponseEmbedded $obj */ + /** @var EmbeddedSignUrlResponseEmbedded */ return ObjectSerializer::deserialize( $data, EmbeddedSignUrlResponseEmbedded::class, @@ -270,8 +270,10 @@ public static function init(array $data): EmbeddedSignUrlResponseEmbedded * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ErrorResponse.php b/sdks/php/src/Model/ErrorResponse.php index 620b51c2b..dc237734a 100644 --- a/sdks/php/src/Model/ErrorResponse.php +++ b/sdks/php/src/Model/ErrorResponse.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): ErrorResponse */ public static function init(array $data): ErrorResponse { - /** @var ErrorResponse $obj */ + /** @var ErrorResponse */ return ObjectSerializer::deserialize( $data, ErrorResponse::class, @@ -262,8 +262,10 @@ public static function init(array $data): ErrorResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -398,7 +400,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ErrorResponseError.php b/sdks/php/src/Model/ErrorResponseError.php index c14e875d4..5369be9e1 100644 --- a/sdks/php/src/Model/ErrorResponseError.php +++ b/sdks/php/src/Model/ErrorResponseError.php @@ -266,7 +266,7 @@ public static function fromArray(array $data): ErrorResponseError */ public static function init(array $data): ErrorResponseError { - /** @var ErrorResponseError $obj */ + /** @var ErrorResponseError */ return ObjectSerializer::deserialize( $data, ErrorResponseError::class, @@ -277,8 +277,10 @@ public static function init(array $data): ErrorResponseError * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -470,7 +472,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EventCallbackRequest.php b/sdks/php/src/Model/EventCallbackRequest.php index 4e7155152..8ac782108 100644 --- a/sdks/php/src/Model/EventCallbackRequest.php +++ b/sdks/php/src/Model/EventCallbackRequest.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): EventCallbackRequest */ public static function init(array $data): EventCallbackRequest { - /** @var EventCallbackRequest $obj */ + /** @var EventCallbackRequest */ return ObjectSerializer::deserialize( $data, EventCallbackRequest::class, @@ -283,8 +283,10 @@ public static function init(array $data): EventCallbackRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -500,7 +502,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EventCallbackRequestEvent.php b/sdks/php/src/Model/EventCallbackRequestEvent.php index f980761cc..98a139fe1 100644 --- a/sdks/php/src/Model/EventCallbackRequestEvent.php +++ b/sdks/php/src/Model/EventCallbackRequestEvent.php @@ -331,7 +331,7 @@ public static function fromArray(array $data): EventCallbackRequestEvent */ public static function init(array $data): EventCallbackRequestEvent { - /** @var EventCallbackRequestEvent $obj */ + /** @var EventCallbackRequestEvent */ return ObjectSerializer::deserialize( $data, EventCallbackRequestEvent::class, @@ -342,8 +342,10 @@ public static function init(array $data): EventCallbackRequestEvent * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -584,7 +586,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php index d95efdd0a..fa8fad9dd 100644 --- a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php +++ b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): EventCallbackRequestEventMetadata */ public static function init(array $data): EventCallbackRequestEventMetadata { - /** @var EventCallbackRequestEventMetadata $obj */ + /** @var EventCallbackRequestEventMetadata */ return ObjectSerializer::deserialize( $data, EventCallbackRequestEventMetadata::class, @@ -283,8 +283,10 @@ public static function init(array $data): EventCallbackRequestEventMetadata * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -523,7 +525,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/FileResponse.php b/sdks/php/src/Model/FileResponse.php index 670289fe1..5ca196ad5 100644 --- a/sdks/php/src/Model/FileResponse.php +++ b/sdks/php/src/Model/FileResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): FileResponse */ public static function init(array $data): FileResponse { - /** @var FileResponse $obj */ + /** @var FileResponse */ return ObjectSerializer::deserialize( $data, FileResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): FileResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/FileResponseDataUri.php b/sdks/php/src/Model/FileResponseDataUri.php index 581641db0..bec55727c 100644 --- a/sdks/php/src/Model/FileResponseDataUri.php +++ b/sdks/php/src/Model/FileResponseDataUri.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): FileResponseDataUri */ public static function init(array $data): FileResponseDataUri { - /** @var FileResponseDataUri $obj */ + /** @var FileResponseDataUri */ return ObjectSerializer::deserialize( $data, FileResponseDataUri::class, @@ -262,8 +262,10 @@ public static function init(array $data): FileResponseDataUri * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ListInfoResponse.php b/sdks/php/src/Model/ListInfoResponse.php index 4c3595b65..e4450d9b8 100644 --- a/sdks/php/src/Model/ListInfoResponse.php +++ b/sdks/php/src/Model/ListInfoResponse.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): ListInfoResponse */ public static function init(array $data): ListInfoResponse { - /** @var ListInfoResponse $obj */ + /** @var ListInfoResponse */ return ObjectSerializer::deserialize( $data, ListInfoResponse::class, @@ -284,8 +284,10 @@ public static function init(array $data): ListInfoResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -503,7 +505,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/OAuthTokenGenerateRequest.php b/sdks/php/src/Model/OAuthTokenGenerateRequest.php index f6ade509a..c86d81af5 100644 --- a/sdks/php/src/Model/OAuthTokenGenerateRequest.php +++ b/sdks/php/src/Model/OAuthTokenGenerateRequest.php @@ -279,7 +279,7 @@ public static function fromArray(array $data): OAuthTokenGenerateRequest */ public static function init(array $data): OAuthTokenGenerateRequest { - /** @var OAuthTokenGenerateRequest $obj */ + /** @var OAuthTokenGenerateRequest */ return ObjectSerializer::deserialize( $data, OAuthTokenGenerateRequest::class, @@ -290,8 +290,10 @@ public static function init(array $data): OAuthTokenGenerateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -546,7 +548,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/OAuthTokenRefreshRequest.php b/sdks/php/src/Model/OAuthTokenRefreshRequest.php index 3b4b3dc58..2bfc2b5c9 100644 --- a/sdks/php/src/Model/OAuthTokenRefreshRequest.php +++ b/sdks/php/src/Model/OAuthTokenRefreshRequest.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): OAuthTokenRefreshRequest */ public static function init(array $data): OAuthTokenRefreshRequest { - /** @var OAuthTokenRefreshRequest $obj */ + /** @var OAuthTokenRefreshRequest */ return ObjectSerializer::deserialize( $data, OAuthTokenRefreshRequest::class, @@ -269,8 +269,10 @@ public static function init(array $data): OAuthTokenRefreshRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -435,7 +437,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/OAuthTokenResponse.php b/sdks/php/src/Model/OAuthTokenResponse.php index 41c06bbf8..bfb18ab17 100644 --- a/sdks/php/src/Model/OAuthTokenResponse.php +++ b/sdks/php/src/Model/OAuthTokenResponse.php @@ -279,7 +279,7 @@ public static function fromArray(array $data): OAuthTokenResponse */ public static function init(array $data): OAuthTokenResponse { - /** @var OAuthTokenResponse $obj */ + /** @var OAuthTokenResponse */ return ObjectSerializer::deserialize( $data, OAuthTokenResponse::class, @@ -290,8 +290,10 @@ public static function init(array $data): OAuthTokenResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -536,7 +538,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ReportCreateRequest.php b/sdks/php/src/Model/ReportCreateRequest.php index 32417157c..b85af6da5 100644 --- a/sdks/php/src/Model/ReportCreateRequest.php +++ b/sdks/php/src/Model/ReportCreateRequest.php @@ -281,7 +281,7 @@ public static function fromArray(array $data): ReportCreateRequest */ public static function init(array $data): ReportCreateRequest { - /** @var ReportCreateRequest $obj */ + /** @var ReportCreateRequest */ return ObjectSerializer::deserialize( $data, ReportCreateRequest::class, @@ -292,8 +292,10 @@ public static function init(array $data): ReportCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -512,7 +514,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ReportCreateResponse.php b/sdks/php/src/Model/ReportCreateResponse.php index ff3d3493d..e94106e89 100644 --- a/sdks/php/src/Model/ReportCreateResponse.php +++ b/sdks/php/src/Model/ReportCreateResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): ReportCreateResponse */ public static function init(array $data): ReportCreateResponse { - /** @var ReportCreateResponse $obj */ + /** @var ReportCreateResponse */ return ObjectSerializer::deserialize( $data, ReportCreateResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): ReportCreateResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/ReportResponse.php b/sdks/php/src/Model/ReportResponse.php index ae63216ec..e55a2c6bb 100644 --- a/sdks/php/src/Model/ReportResponse.php +++ b/sdks/php/src/Model/ReportResponse.php @@ -289,7 +289,7 @@ public static function fromArray(array $data): ReportResponse */ public static function init(array $data): ReportResponse { - /** @var ReportResponse $obj */ + /** @var ReportResponse */ return ObjectSerializer::deserialize( $data, ReportResponse::class, @@ -300,8 +300,10 @@ public static function init(array $data): ReportResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -521,7 +523,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php index ea27ccecb..c3361f55e 100644 --- a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php @@ -336,7 +336,7 @@ public static function fromArray(array $data): SignatureRequestBulkCreateEmbedde */ public static function init(array $data): SignatureRequestBulkCreateEmbeddedWithTemplateRequest { - /** @var SignatureRequestBulkCreateEmbeddedWithTemplateRequest $obj */ + /** @var SignatureRequestBulkCreateEmbeddedWithTemplateRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestBulkCreateEmbeddedWithTemplateRequest::class, @@ -347,8 +347,10 @@ public static function init(array $data): SignatureRequestBulkCreateEmbeddedWith * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -835,7 +837,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php index 6a45f46b3..6562e291a 100644 --- a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php @@ -336,7 +336,7 @@ public static function fromArray(array $data): SignatureRequestBulkSendWithTempl */ public static function init(array $data): SignatureRequestBulkSendWithTemplateRequest { - /** @var SignatureRequestBulkSendWithTemplateRequest $obj */ + /** @var SignatureRequestBulkSendWithTemplateRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestBulkSendWithTemplateRequest::class, @@ -347,8 +347,10 @@ public static function init(array $data): SignatureRequestBulkSendWithTemplateRe * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -832,7 +834,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php index ff864d832..d425901a2 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php @@ -413,7 +413,7 @@ public static function fromArray(array $data): SignatureRequestCreateEmbeddedReq */ public static function init(array $data): SignatureRequestCreateEmbeddedRequest { - /** @var SignatureRequestCreateEmbeddedRequest $obj */ + /** @var SignatureRequestCreateEmbeddedRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestCreateEmbeddedRequest::class, @@ -424,8 +424,10 @@ public static function init(array $data): SignatureRequestCreateEmbeddedRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1213,7 +1215,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php index d65263ff8..e0ddf3951 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php @@ -350,7 +350,7 @@ public static function fromArray(array $data): SignatureRequestCreateEmbeddedWit */ public static function init(array $data): SignatureRequestCreateEmbeddedWithTemplateRequest { - /** @var SignatureRequestCreateEmbeddedWithTemplateRequest $obj */ + /** @var SignatureRequestCreateEmbeddedWithTemplateRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestCreateEmbeddedWithTemplateRequest::class, @@ -361,8 +361,10 @@ public static function init(array $data): SignatureRequestCreateEmbeddedWithTemp * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -906,7 +908,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestGetResponse.php b/sdks/php/src/Model/SignatureRequestGetResponse.php index 135ab3346..4d23105d6 100644 --- a/sdks/php/src/Model/SignatureRequestGetResponse.php +++ b/sdks/php/src/Model/SignatureRequestGetResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SignatureRequestGetResponse */ public static function init(array $data): SignatureRequestGetResponse { - /** @var SignatureRequestGetResponse $obj */ + /** @var SignatureRequestGetResponse */ return ObjectSerializer::deserialize( $data, SignatureRequestGetResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): SignatureRequestGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestListResponse.php b/sdks/php/src/Model/SignatureRequestListResponse.php index b7f8236b5..dd6d7bf23 100644 --- a/sdks/php/src/Model/SignatureRequestListResponse.php +++ b/sdks/php/src/Model/SignatureRequestListResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): SignatureRequestListResponse */ public static function init(array $data): SignatureRequestListResponse { - /** @var SignatureRequestListResponse $obj */ + /** @var SignatureRequestListResponse */ return ObjectSerializer::deserialize( $data, SignatureRequestListResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): SignatureRequestListResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestRemindRequest.php b/sdks/php/src/Model/SignatureRequestRemindRequest.php index 6e8b2787b..98bd0b2ca 100644 --- a/sdks/php/src/Model/SignatureRequestRemindRequest.php +++ b/sdks/php/src/Model/SignatureRequestRemindRequest.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SignatureRequestRemindRequest */ public static function init(array $data): SignatureRequestRemindRequest { - /** @var SignatureRequestRemindRequest $obj */ + /** @var SignatureRequestRemindRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestRemindRequest::class, @@ -269,8 +269,10 @@ public static function init(array $data): SignatureRequestRemindRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -432,7 +434,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponse.php b/sdks/php/src/Model/SignatureRequestResponse.php index d54e61196..4b93915f2 100644 --- a/sdks/php/src/Model/SignatureRequestResponse.php +++ b/sdks/php/src/Model/SignatureRequestResponse.php @@ -420,7 +420,7 @@ public static function fromArray(array $data): SignatureRequestResponse */ public static function init(array $data): SignatureRequestResponse { - /** @var SignatureRequestResponse $obj */ + /** @var SignatureRequestResponse */ return ObjectSerializer::deserialize( $data, SignatureRequestResponse::class, @@ -431,8 +431,10 @@ public static function init(array $data): SignatureRequestResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1287,7 +1289,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseAttachment.php b/sdks/php/src/Model/SignatureRequestResponseAttachment.php index 7ad2e9cc3..38905a0ac 100644 --- a/sdks/php/src/Model/SignatureRequestResponseAttachment.php +++ b/sdks/php/src/Model/SignatureRequestResponseAttachment.php @@ -287,7 +287,7 @@ public static function fromArray(array $data): SignatureRequestResponseAttachmen */ public static function init(array $data): SignatureRequestResponseAttachment { - /** @var SignatureRequestResponseAttachment $obj */ + /** @var SignatureRequestResponseAttachment */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseAttachment::class, @@ -298,8 +298,10 @@ public static function init(array $data): SignatureRequestResponseAttachment * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -592,7 +594,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php index 059c123eb..e6a1a591d 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php @@ -290,8 +290,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -537,7 +539,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php index 322d68985..6604e50a6 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php @@ -252,7 +252,7 @@ public static function fromArray(array $data): SignatureRequestResponseCustomFie */ public static function init(array $data): SignatureRequestResponseCustomFieldCheckbox { - /** @var SignatureRequestResponseCustomFieldCheckbox $obj */ + /** @var SignatureRequestResponseCustomFieldCheckbox */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseCustomFieldCheckbox::class, @@ -263,8 +263,10 @@ public static function init(array $data): SignatureRequestResponseCustomFieldChe * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -426,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php index e16a7bed3..25a9241c5 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php @@ -252,7 +252,7 @@ public static function fromArray(array $data): SignatureRequestResponseCustomFie */ public static function init(array $data): SignatureRequestResponseCustomFieldText { - /** @var SignatureRequestResponseCustomFieldText $obj */ + /** @var SignatureRequestResponseCustomFieldText */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseCustomFieldText::class, @@ -263,8 +263,10 @@ public static function init(array $data): SignatureRequestResponseCustomFieldTex * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -426,7 +428,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataBase.php b/sdks/php/src/Model/SignatureRequestResponseDataBase.php index 88f24c47a..dc7148806 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataBase.php @@ -311,8 +311,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -550,7 +552,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php index 91de390b6..709c91641 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueCheckbox { - /** @var SignatureRequestResponseDataValueCheckbox $obj */ + /** @var SignatureRequestResponseDataValueCheckbox */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueCheckbox::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueCheck * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php index 8b735d836..6198d1a69 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueCheckboxMerge { - /** @var SignatureRequestResponseDataValueCheckboxMerge $obj */ + /** @var SignatureRequestResponseDataValueCheckboxMerge */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueCheckboxMerge::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueCheck * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php index fa4935362..a58276347 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueDateSigned { - /** @var SignatureRequestResponseDataValueDateSigned $obj */ + /** @var SignatureRequestResponseDataValueDateSigned */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueDateSigned::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueDateS * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php index ea40c2f7f..ad38b0223 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueDropdown { - /** @var SignatureRequestResponseDataValueDropdown $obj */ + /** @var SignatureRequestResponseDataValueDropdown */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueDropdown::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueDropd * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php index 375b78317..91d4910a6 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueInitials { - /** @var SignatureRequestResponseDataValueInitials $obj */ + /** @var SignatureRequestResponseDataValueInitials */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueInitials::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueIniti * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php index 379952458..22132dfb4 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueRadio { - /** @var SignatureRequestResponseDataValueRadio $obj */ + /** @var SignatureRequestResponseDataValueRadio */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueRadio::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueRadio * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php index b63e32de3..66f78c0f1 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueSignature { - /** @var SignatureRequestResponseDataValueSignature $obj */ + /** @var SignatureRequestResponseDataValueSignature */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueSignature::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueSigna * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php index b5e7d429f..875e60509 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueText { - /** @var SignatureRequestResponseDataValueText $obj */ + /** @var SignatureRequestResponseDataValueText */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueText::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueText * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php index d8a14b627..10b88fddc 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): SignatureRequestResponseDataValue */ public static function init(array $data): SignatureRequestResponseDataValueTextMerge { - /** @var SignatureRequestResponseDataValueTextMerge $obj */ + /** @var SignatureRequestResponseDataValueTextMerge */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseDataValueTextMerge::class, @@ -262,8 +262,10 @@ public static function init(array $data): SignatureRequestResponseDataValueTextM * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -420,7 +422,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestResponseSignatures.php b/sdks/php/src/Model/SignatureRequestResponseSignatures.php index 6f0d6406d..8adf50aa3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseSignatures.php +++ b/sdks/php/src/Model/SignatureRequestResponseSignatures.php @@ -378,7 +378,7 @@ public static function fromArray(array $data): SignatureRequestResponseSignature */ public static function init(array $data): SignatureRequestResponseSignatures { - /** @var SignatureRequestResponseSignatures $obj */ + /** @var SignatureRequestResponseSignatures */ return ObjectSerializer::deserialize( $data, SignatureRequestResponseSignatures::class, @@ -389,8 +389,10 @@ public static function init(array $data): SignatureRequestResponseSignatures * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1111,7 +1113,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestSendRequest.php b/sdks/php/src/Model/SignatureRequestSendRequest.php index a8c369353..ea778e1a9 100644 --- a/sdks/php/src/Model/SignatureRequestSendRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendRequest.php @@ -427,7 +427,7 @@ public static function fromArray(array $data): SignatureRequestSendRequest */ public static function init(array $data): SignatureRequestSendRequest { - /** @var SignatureRequestSendRequest $obj */ + /** @var SignatureRequestSendRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestSendRequest::class, @@ -438,8 +438,10 @@ public static function init(array $data): SignatureRequestSendRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1280,7 +1282,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php index 89df4633e..2ae0e131e 100644 --- a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php @@ -365,7 +365,7 @@ public static function fromArray(array $data): SignatureRequestSendWithTemplateR */ public static function init(array $data): SignatureRequestSendWithTemplateRequest { - /** @var SignatureRequestSendWithTemplateRequest $obj */ + /** @var SignatureRequestSendWithTemplateRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestSendWithTemplateRequest::class, @@ -376,8 +376,10 @@ public static function init(array $data): SignatureRequestSendWithTemplateReques * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -974,7 +976,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SignatureRequestUpdateRequest.php b/sdks/php/src/Model/SignatureRequestUpdateRequest.php index 7299d0927..c2949d267 100644 --- a/sdks/php/src/Model/SignatureRequestUpdateRequest.php +++ b/sdks/php/src/Model/SignatureRequestUpdateRequest.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): SignatureRequestUpdateRequest */ public static function init(array $data): SignatureRequestUpdateRequest { - /** @var SignatureRequestUpdateRequest $obj */ + /** @var SignatureRequestUpdateRequest */ return ObjectSerializer::deserialize( $data, SignatureRequestUpdateRequest::class, @@ -283,8 +283,10 @@ public static function init(array $data): SignatureRequestUpdateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -507,7 +509,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubAttachment.php b/sdks/php/src/Model/SubAttachment.php index cfc9204cf..2c83fb29b 100644 --- a/sdks/php/src/Model/SubAttachment.php +++ b/sdks/php/src/Model/SubAttachment.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): SubAttachment */ public static function init(array $data): SubAttachment { - /** @var SubAttachment $obj */ + /** @var SubAttachment */ return ObjectSerializer::deserialize( $data, SubAttachment::class, @@ -283,8 +283,10 @@ public static function init(array $data): SubAttachment * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -503,7 +505,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubBulkSignerList.php b/sdks/php/src/Model/SubBulkSignerList.php index 52401ab0f..077ad47e2 100644 --- a/sdks/php/src/Model/SubBulkSignerList.php +++ b/sdks/php/src/Model/SubBulkSignerList.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SubBulkSignerList */ public static function init(array $data): SubBulkSignerList { - /** @var SubBulkSignerList $obj */ + /** @var SubBulkSignerList */ return ObjectSerializer::deserialize( $data, SubBulkSignerList::class, @@ -269,8 +269,10 @@ public static function init(array $data): SubBulkSignerList * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubBulkSignerListCustomField.php b/sdks/php/src/Model/SubBulkSignerListCustomField.php index c22f8b9aa..0bae39d8f 100644 --- a/sdks/php/src/Model/SubBulkSignerListCustomField.php +++ b/sdks/php/src/Model/SubBulkSignerListCustomField.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SubBulkSignerListCustomField */ public static function init(array $data): SubBulkSignerListCustomField { - /** @var SubBulkSignerListCustomField $obj */ + /** @var SubBulkSignerListCustomField */ return ObjectSerializer::deserialize( $data, SubBulkSignerListCustomField::class, @@ -269,8 +269,10 @@ public static function init(array $data): SubBulkSignerListCustomField * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -435,7 +437,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubCC.php b/sdks/php/src/Model/SubCC.php index 1e2977b34..815b3c8b8 100644 --- a/sdks/php/src/Model/SubCC.php +++ b/sdks/php/src/Model/SubCC.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SubCC */ public static function init(array $data): SubCC { - /** @var SubCC $obj */ + /** @var SubCC */ return ObjectSerializer::deserialize( $data, SubCC::class, @@ -269,8 +269,10 @@ public static function init(array $data): SubCC * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -435,7 +437,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubCustomField.php b/sdks/php/src/Model/SubCustomField.php index 909e60355..700759829 100644 --- a/sdks/php/src/Model/SubCustomField.php +++ b/sdks/php/src/Model/SubCustomField.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): SubCustomField */ public static function init(array $data): SubCustomField { - /** @var SubCustomField $obj */ + /** @var SubCustomField */ return ObjectSerializer::deserialize( $data, SubCustomField::class, @@ -284,8 +284,10 @@ public static function init(array $data): SubCustomField * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -501,7 +503,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubEditorOptions.php b/sdks/php/src/Model/SubEditorOptions.php index a9d9bf736..2f13e3a69 100644 --- a/sdks/php/src/Model/SubEditorOptions.php +++ b/sdks/php/src/Model/SubEditorOptions.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): SubEditorOptions */ public static function init(array $data): SubEditorOptions { - /** @var SubEditorOptions $obj */ + /** @var SubEditorOptions */ return ObjectSerializer::deserialize( $data, SubEditorOptions::class, @@ -270,8 +270,10 @@ public static function init(array $data): SubEditorOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFieldOptions.php b/sdks/php/src/Model/SubFieldOptions.php index bc3a856d3..0c5ae402f 100644 --- a/sdks/php/src/Model/SubFieldOptions.php +++ b/sdks/php/src/Model/SubFieldOptions.php @@ -276,7 +276,7 @@ public static function fromArray(array $data): SubFieldOptions */ public static function init(array $data): SubFieldOptions { - /** @var SubFieldOptions $obj */ + /** @var SubFieldOptions */ return ObjectSerializer::deserialize( $data, SubFieldOptions::class, @@ -287,8 +287,10 @@ public static function init(array $data): SubFieldOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -442,7 +444,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldGroup.php b/sdks/php/src/Model/SubFormFieldGroup.php index eea7c2a96..0908ddc29 100644 --- a/sdks/php/src/Model/SubFormFieldGroup.php +++ b/sdks/php/src/Model/SubFormFieldGroup.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): SubFormFieldGroup */ public static function init(array $data): SubFormFieldGroup { - /** @var SubFormFieldGroup $obj */ + /** @var SubFormFieldGroup */ return ObjectSerializer::deserialize( $data, SubFormFieldGroup::class, @@ -276,8 +276,10 @@ public static function init(array $data): SubFormFieldGroup * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -472,7 +474,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldRule.php b/sdks/php/src/Model/SubFormFieldRule.php index 4726be3f9..ff307d183 100644 --- a/sdks/php/src/Model/SubFormFieldRule.php +++ b/sdks/php/src/Model/SubFormFieldRule.php @@ -272,7 +272,7 @@ public static function fromArray(array $data): SubFormFieldRule */ public static function init(array $data): SubFormFieldRule { - /** @var SubFormFieldRule $obj */ + /** @var SubFormFieldRule */ return ObjectSerializer::deserialize( $data, SubFormFieldRule::class, @@ -283,8 +283,10 @@ public static function init(array $data): SubFormFieldRule * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -532,7 +534,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldRuleAction.php b/sdks/php/src/Model/SubFormFieldRuleAction.php index 0c19592b8..b7fc62de8 100644 --- a/sdks/php/src/Model/SubFormFieldRuleAction.php +++ b/sdks/php/src/Model/SubFormFieldRuleAction.php @@ -288,7 +288,7 @@ public static function fromArray(array $data): SubFormFieldRuleAction */ public static function init(array $data): SubFormFieldRuleAction { - /** @var SubFormFieldRuleAction $obj */ + /** @var SubFormFieldRuleAction */ return ObjectSerializer::deserialize( $data, SubFormFieldRuleAction::class, @@ -299,8 +299,10 @@ public static function init(array $data): SubFormFieldRuleAction * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -538,7 +540,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldRuleTrigger.php b/sdks/php/src/Model/SubFormFieldRuleTrigger.php index 1d38083cb..2b0423131 100644 --- a/sdks/php/src/Model/SubFormFieldRuleTrigger.php +++ b/sdks/php/src/Model/SubFormFieldRuleTrigger.php @@ -294,7 +294,7 @@ public static function fromArray(array $data): SubFormFieldRuleTrigger */ public static function init(array $data): SubFormFieldRuleTrigger { - /** @var SubFormFieldRuleTrigger $obj */ + /** @var SubFormFieldRuleTrigger */ return ObjectSerializer::deserialize( $data, SubFormFieldRuleTrigger::class, @@ -305,8 +305,10 @@ public static function init(array $data): SubFormFieldRuleTrigger * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -544,7 +546,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php index a7193e75e..188d08c9e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php @@ -356,8 +356,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -793,7 +795,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php index 46ff7d15d..05be82299 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentCheckbox */ public static function init(array $data): SubFormFieldsPerDocumentCheckbox { - /** @var SubFormFieldsPerDocumentCheckbox $obj */ + /** @var SubFormFieldsPerDocumentCheckbox */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentCheckbox::class, @@ -270,8 +270,10 @@ public static function init(array $data): SubFormFieldsPerDocumentCheckbox * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -463,7 +465,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php index a168d5b8b..95fd01315 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentCheckboxM */ public static function init(array $data): SubFormFieldsPerDocumentCheckboxMerge { - /** @var SubFormFieldsPerDocumentCheckboxMerge $obj */ + /** @var SubFormFieldsPerDocumentCheckboxMerge */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentCheckboxMerge::class, @@ -256,8 +256,10 @@ public static function init(array $data): SubFormFieldsPerDocumentCheckboxMerge * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php index 373ebfad5..fb0cd9657 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php @@ -303,7 +303,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentDateSigne */ public static function init(array $data): SubFormFieldsPerDocumentDateSigned { - /** @var SubFormFieldsPerDocumentDateSigned $obj */ + /** @var SubFormFieldsPerDocumentDateSigned */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentDateSigned::class, @@ -314,8 +314,10 @@ public static function init(array $data): SubFormFieldsPerDocumentDateSigned * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -523,7 +525,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php index 5231c34d7..2c45c24c1 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php @@ -317,7 +317,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentDropdown */ public static function init(array $data): SubFormFieldsPerDocumentDropdown { - /** @var SubFormFieldsPerDocumentDropdown $obj */ + /** @var SubFormFieldsPerDocumentDropdown */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentDropdown::class, @@ -328,8 +328,10 @@ public static function init(array $data): SubFormFieldsPerDocumentDropdown * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -602,7 +604,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php index f5d0dc4e7..cdbc7f56f 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php @@ -317,7 +317,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentHyperlink */ public static function init(array $data): SubFormFieldsPerDocumentHyperlink { - /** @var SubFormFieldsPerDocumentHyperlink $obj */ + /** @var SubFormFieldsPerDocumentHyperlink */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentHyperlink::class, @@ -328,8 +328,10 @@ public static function init(array $data): SubFormFieldsPerDocumentHyperlink * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -597,7 +599,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php index a0888674b..ba8959d13 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentInitials */ public static function init(array $data): SubFormFieldsPerDocumentInitials { - /** @var SubFormFieldsPerDocumentInitials $obj */ + /** @var SubFormFieldsPerDocumentInitials */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentInitials::class, @@ -256,8 +256,10 @@ public static function init(array $data): SubFormFieldsPerDocumentInitials * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php index 153ef7681..6c1fb48cb 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentRadio */ public static function init(array $data): SubFormFieldsPerDocumentRadio { - /** @var SubFormFieldsPerDocumentRadio $obj */ + /** @var SubFormFieldsPerDocumentRadio */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentRadio::class, @@ -270,8 +270,10 @@ public static function init(array $data): SubFormFieldsPerDocumentRadio * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -466,7 +468,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php index c839a224c..80b901554 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentSignature */ public static function init(array $data): SubFormFieldsPerDocumentSignature { - /** @var SubFormFieldsPerDocumentSignature $obj */ + /** @var SubFormFieldsPerDocumentSignature */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentSignature::class, @@ -256,8 +256,10 @@ public static function init(array $data): SubFormFieldsPerDocumentSignature * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php index b460cd63e..423225d55 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php @@ -390,7 +390,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentText */ public static function init(array $data): SubFormFieldsPerDocumentText { - /** @var SubFormFieldsPerDocumentText $obj */ + /** @var SubFormFieldsPerDocumentText */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentText::class, @@ -401,8 +401,10 @@ public static function init(array $data): SubFormFieldsPerDocumentText * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -845,7 +847,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php index 9a426e845..286d979b2 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php @@ -303,7 +303,7 @@ public static function fromArray(array $data): SubFormFieldsPerDocumentTextMerge */ public static function init(array $data): SubFormFieldsPerDocumentTextMerge { - /** @var SubFormFieldsPerDocumentTextMerge $obj */ + /** @var SubFormFieldsPerDocumentTextMerge */ return ObjectSerializer::deserialize( $data, SubFormFieldsPerDocumentTextMerge::class, @@ -314,8 +314,10 @@ public static function init(array $data): SubFormFieldsPerDocumentTextMerge * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -523,7 +525,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubMergeField.php b/sdks/php/src/Model/SubMergeField.php index 162a22763..c558a42de 100644 --- a/sdks/php/src/Model/SubMergeField.php +++ b/sdks/php/src/Model/SubMergeField.php @@ -274,7 +274,7 @@ public static function fromArray(array $data): SubMergeField */ public static function init(array $data): SubMergeField { - /** @var SubMergeField $obj */ + /** @var SubMergeField */ return ObjectSerializer::deserialize( $data, SubMergeField::class, @@ -285,8 +285,10 @@ public static function init(array $data): SubMergeField * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -470,7 +472,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubOAuth.php b/sdks/php/src/Model/SubOAuth.php index a47eccb0b..fdc6c455f 100644 --- a/sdks/php/src/Model/SubOAuth.php +++ b/sdks/php/src/Model/SubOAuth.php @@ -287,7 +287,7 @@ public static function fromArray(array $data): SubOAuth */ public static function init(array $data): SubOAuth { - /** @var SubOAuth $obj */ + /** @var SubOAuth */ return ObjectSerializer::deserialize( $data, SubOAuth::class, @@ -298,8 +298,10 @@ public static function init(array $data): SubOAuth * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -465,7 +467,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubOptions.php b/sdks/php/src/Model/SubOptions.php index e5343174e..287cf8583 100644 --- a/sdks/php/src/Model/SubOptions.php +++ b/sdks/php/src/Model/SubOptions.php @@ -252,7 +252,7 @@ public static function fromArray(array $data): SubOptions */ public static function init(array $data): SubOptions { - /** @var SubOptions $obj */ + /** @var SubOptions */ return ObjectSerializer::deserialize( $data, SubOptions::class, @@ -263,8 +263,10 @@ public static function init(array $data): SubOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -394,7 +396,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php index 9ac5753f7..459c1265d 100644 --- a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php +++ b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): SubSignatureRequestGroupedSigners */ public static function init(array $data): SubSignatureRequestGroupedSigners { - /** @var SubSignatureRequestGroupedSigners $obj */ + /** @var SubSignatureRequestGroupedSigners */ return ObjectSerializer::deserialize( $data, SubSignatureRequestGroupedSigners::class, @@ -276,8 +276,10 @@ public static function init(array $data): SubSignatureRequestGroupedSigners * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -476,7 +478,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubSignatureRequestSigner.php b/sdks/php/src/Model/SubSignatureRequestSigner.php index 22f3a8f3d..b9669b176 100644 --- a/sdks/php/src/Model/SubSignatureRequestSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestSigner.php @@ -302,7 +302,7 @@ public static function fromArray(array $data): SubSignatureRequestSigner */ public static function init(array $data): SubSignatureRequestSigner { - /** @var SubSignatureRequestSigner $obj */ + /** @var SubSignatureRequestSigner */ return ObjectSerializer::deserialize( $data, SubSignatureRequestSigner::class, @@ -313,8 +313,10 @@ public static function init(array $data): SubSignatureRequestSigner * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -628,7 +630,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php index 664e84af7..59e219bc6 100644 --- a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php @@ -302,7 +302,7 @@ public static function fromArray(array $data): SubSignatureRequestTemplateSigner */ public static function init(array $data): SubSignatureRequestTemplateSigner { - /** @var SubSignatureRequestTemplateSigner $obj */ + /** @var SubSignatureRequestTemplateSigner */ return ObjectSerializer::deserialize( $data, SubSignatureRequestTemplateSigner::class, @@ -313,8 +313,10 @@ public static function init(array $data): SubSignatureRequestTemplateSigner * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -624,7 +626,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubSigningOptions.php b/sdks/php/src/Model/SubSigningOptions.php index d8547cdb7..794711f70 100644 --- a/sdks/php/src/Model/SubSigningOptions.php +++ b/sdks/php/src/Model/SubSigningOptions.php @@ -300,7 +300,7 @@ public static function fromArray(array $data): SubSigningOptions */ public static function init(array $data): SubSigningOptions { - /** @var SubSigningOptions $obj */ + /** @var SubSigningOptions */ return ObjectSerializer::deserialize( $data, SubSigningOptions::class, @@ -311,8 +311,10 @@ public static function init(array $data): SubSigningOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -574,7 +576,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubTeamResponse.php b/sdks/php/src/Model/SubTeamResponse.php index 2a5aa4822..a148754d5 100644 --- a/sdks/php/src/Model/SubTeamResponse.php +++ b/sdks/php/src/Model/SubTeamResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SubTeamResponse */ public static function init(array $data): SubTeamResponse { - /** @var SubTeamResponse $obj */ + /** @var SubTeamResponse */ return ObjectSerializer::deserialize( $data, SubTeamResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): SubTeamResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubTemplateRole.php b/sdks/php/src/Model/SubTemplateRole.php index b5bab34f9..8d7e101b9 100644 --- a/sdks/php/src/Model/SubTemplateRole.php +++ b/sdks/php/src/Model/SubTemplateRole.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): SubTemplateRole */ public static function init(array $data): SubTemplateRole { - /** @var SubTemplateRole $obj */ + /** @var SubTemplateRole */ return ObjectSerializer::deserialize( $data, SubTemplateRole::class, @@ -269,8 +269,10 @@ public static function init(array $data): SubTemplateRole * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -434,7 +436,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubUnclaimedDraftSigner.php b/sdks/php/src/Model/SubUnclaimedDraftSigner.php index ecb101c45..bf5480977 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftSigner.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): SubUnclaimedDraftSigner */ public static function init(array $data): SubUnclaimedDraftSigner { - /** @var SubUnclaimedDraftSigner $obj */ + /** @var SubUnclaimedDraftSigner */ return ObjectSerializer::deserialize( $data, SubUnclaimedDraftSigner::class, @@ -276,8 +276,10 @@ public static function init(array $data): SubUnclaimedDraftSigner * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -476,7 +478,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php index f5ce064ac..88f7bccad 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): SubUnclaimedDraftTemplateSigner */ public static function init(array $data): SubUnclaimedDraftTemplateSigner { - /** @var SubUnclaimedDraftTemplateSigner $obj */ + /** @var SubUnclaimedDraftTemplateSigner */ return ObjectSerializer::deserialize( $data, SubUnclaimedDraftTemplateSigner::class, @@ -276,8 +276,10 @@ public static function init(array $data): SubUnclaimedDraftTemplateSigner * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -472,7 +474,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/SubWhiteLabelingOptions.php b/sdks/php/src/Model/SubWhiteLabelingOptions.php index 2487bbfd0..99c4d59af 100644 --- a/sdks/php/src/Model/SubWhiteLabelingOptions.php +++ b/sdks/php/src/Model/SubWhiteLabelingOptions.php @@ -366,7 +366,7 @@ public static function fromArray(array $data): SubWhiteLabelingOptions */ public static function init(array $data): SubWhiteLabelingOptions { - /** @var SubWhiteLabelingOptions $obj */ + /** @var SubWhiteLabelingOptions */ return ObjectSerializer::deserialize( $data, SubWhiteLabelingOptions::class, @@ -377,8 +377,10 @@ public static function init(array $data): SubWhiteLabelingOptions * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -907,7 +909,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamAddMemberRequest.php b/sdks/php/src/Model/TeamAddMemberRequest.php index ccbeb33de..4da7c73dc 100644 --- a/sdks/php/src/Model/TeamAddMemberRequest.php +++ b/sdks/php/src/Model/TeamAddMemberRequest.php @@ -285,7 +285,7 @@ public static function fromArray(array $data): TeamAddMemberRequest */ public static function init(array $data): TeamAddMemberRequest { - /** @var TeamAddMemberRequest $obj */ + /** @var TeamAddMemberRequest */ return ObjectSerializer::deserialize( $data, TeamAddMemberRequest::class, @@ -296,8 +296,10 @@ public static function init(array $data): TeamAddMemberRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -502,7 +504,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamCreateRequest.php b/sdks/php/src/Model/TeamCreateRequest.php index c5b13041c..04c2da1f9 100644 --- a/sdks/php/src/Model/TeamCreateRequest.php +++ b/sdks/php/src/Model/TeamCreateRequest.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): TeamCreateRequest */ public static function init(array $data): TeamCreateRequest { - /** @var TeamCreateRequest $obj */ + /** @var TeamCreateRequest */ return ObjectSerializer::deserialize( $data, TeamCreateRequest::class, @@ -262,8 +262,10 @@ public static function init(array $data): TeamCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamGetInfoResponse.php b/sdks/php/src/Model/TeamGetInfoResponse.php index 3a8cef425..fda26c9d9 100644 --- a/sdks/php/src/Model/TeamGetInfoResponse.php +++ b/sdks/php/src/Model/TeamGetInfoResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TeamGetInfoResponse */ public static function init(array $data): TeamGetInfoResponse { - /** @var TeamGetInfoResponse $obj */ + /** @var TeamGetInfoResponse */ return ObjectSerializer::deserialize( $data, TeamGetInfoResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TeamGetInfoResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamGetResponse.php b/sdks/php/src/Model/TeamGetResponse.php index 23e6d47f3..93fdb09c6 100644 --- a/sdks/php/src/Model/TeamGetResponse.php +++ b/sdks/php/src/Model/TeamGetResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TeamGetResponse */ public static function init(array $data): TeamGetResponse { - /** @var TeamGetResponse $obj */ + /** @var TeamGetResponse */ return ObjectSerializer::deserialize( $data, TeamGetResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TeamGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamInfoResponse.php b/sdks/php/src/Model/TeamInfoResponse.php index f17965833..d2d6be014 100644 --- a/sdks/php/src/Model/TeamInfoResponse.php +++ b/sdks/php/src/Model/TeamInfoResponse.php @@ -279,7 +279,7 @@ public static function fromArray(array $data): TeamInfoResponse */ public static function init(array $data): TeamInfoResponse { - /** @var TeamInfoResponse $obj */ + /** @var TeamInfoResponse */ return ObjectSerializer::deserialize( $data, TeamInfoResponse::class, @@ -290,8 +290,10 @@ public static function init(array $data): TeamInfoResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -536,7 +538,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamInviteResponse.php b/sdks/php/src/Model/TeamInviteResponse.php index 61ae10e80..ce2a2f94e 100644 --- a/sdks/php/src/Model/TeamInviteResponse.php +++ b/sdks/php/src/Model/TeamInviteResponse.php @@ -286,7 +286,7 @@ public static function fromArray(array $data): TeamInviteResponse */ public static function init(array $data): TeamInviteResponse { - /** @var TeamInviteResponse $obj */ + /** @var TeamInviteResponse */ return ObjectSerializer::deserialize( $data, TeamInviteResponse::class, @@ -297,8 +297,10 @@ public static function init(array $data): TeamInviteResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -563,7 +565,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamInvitesResponse.php b/sdks/php/src/Model/TeamInvitesResponse.php index 79d213fc4..ff6978705 100644 --- a/sdks/php/src/Model/TeamInvitesResponse.php +++ b/sdks/php/src/Model/TeamInvitesResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TeamInvitesResponse */ public static function init(array $data): TeamInvitesResponse { - /** @var TeamInvitesResponse $obj */ + /** @var TeamInvitesResponse */ return ObjectSerializer::deserialize( $data, TeamInvitesResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TeamInvitesResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamMemberResponse.php b/sdks/php/src/Model/TeamMemberResponse.php index 394f3c397..54881ccac 100644 --- a/sdks/php/src/Model/TeamMemberResponse.php +++ b/sdks/php/src/Model/TeamMemberResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): TeamMemberResponse */ public static function init(array $data): TeamMemberResponse { - /** @var TeamMemberResponse $obj */ + /** @var TeamMemberResponse */ return ObjectSerializer::deserialize( $data, TeamMemberResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): TeamMemberResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamMembersResponse.php b/sdks/php/src/Model/TeamMembersResponse.php index 02def6040..0d58fe4ee 100644 --- a/sdks/php/src/Model/TeamMembersResponse.php +++ b/sdks/php/src/Model/TeamMembersResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): TeamMembersResponse */ public static function init(array $data): TeamMembersResponse { - /** @var TeamMembersResponse $obj */ + /** @var TeamMembersResponse */ return ObjectSerializer::deserialize( $data, TeamMembersResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): TeamMembersResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamParentResponse.php b/sdks/php/src/Model/TeamParentResponse.php index 08f085d35..cd6065d87 100644 --- a/sdks/php/src/Model/TeamParentResponse.php +++ b/sdks/php/src/Model/TeamParentResponse.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): TeamParentResponse */ public static function init(array $data): TeamParentResponse { - /** @var TeamParentResponse $obj */ + /** @var TeamParentResponse */ return ObjectSerializer::deserialize( $data, TeamParentResponse::class, @@ -270,8 +270,10 @@ public static function init(array $data): TeamParentResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamRemoveMemberRequest.php b/sdks/php/src/Model/TeamRemoveMemberRequest.php index 723cde1d1..1487c285a 100644 --- a/sdks/php/src/Model/TeamRemoveMemberRequest.php +++ b/sdks/php/src/Model/TeamRemoveMemberRequest.php @@ -299,7 +299,7 @@ public static function fromArray(array $data): TeamRemoveMemberRequest */ public static function init(array $data): TeamRemoveMemberRequest { - /** @var TeamRemoveMemberRequest $obj */ + /** @var TeamRemoveMemberRequest */ return ObjectSerializer::deserialize( $data, TeamRemoveMemberRequest::class, @@ -310,8 +310,10 @@ public static function init(array $data): TeamRemoveMemberRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -570,7 +572,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamResponse.php b/sdks/php/src/Model/TeamResponse.php index 89f6b4488..8786ec19e 100644 --- a/sdks/php/src/Model/TeamResponse.php +++ b/sdks/php/src/Model/TeamResponse.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): TeamResponse */ public static function init(array $data): TeamResponse { - /** @var TeamResponse $obj */ + /** @var TeamResponse */ return ObjectSerializer::deserialize( $data, TeamResponse::class, @@ -284,8 +284,10 @@ public static function init(array $data): TeamResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -496,7 +498,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamSubTeamsResponse.php b/sdks/php/src/Model/TeamSubTeamsResponse.php index e4a357ef3..a819daf4b 100644 --- a/sdks/php/src/Model/TeamSubTeamsResponse.php +++ b/sdks/php/src/Model/TeamSubTeamsResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): TeamSubTeamsResponse */ public static function init(array $data): TeamSubTeamsResponse { - /** @var TeamSubTeamsResponse $obj */ + /** @var TeamSubTeamsResponse */ return ObjectSerializer::deserialize( $data, TeamSubTeamsResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): TeamSubTeamsResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TeamUpdateRequest.php b/sdks/php/src/Model/TeamUpdateRequest.php index 1cdb41939..5b95c140b 100644 --- a/sdks/php/src/Model/TeamUpdateRequest.php +++ b/sdks/php/src/Model/TeamUpdateRequest.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): TeamUpdateRequest */ public static function init(array $data): TeamUpdateRequest { - /** @var TeamUpdateRequest $obj */ + /** @var TeamUpdateRequest */ return ObjectSerializer::deserialize( $data, TeamUpdateRequest::class, @@ -262,8 +262,10 @@ public static function init(array $data): TeamUpdateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateAddUserRequest.php b/sdks/php/src/Model/TemplateAddUserRequest.php index eb696a8b1..177278524 100644 --- a/sdks/php/src/Model/TemplateAddUserRequest.php +++ b/sdks/php/src/Model/TemplateAddUserRequest.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): TemplateAddUserRequest */ public static function init(array $data): TemplateAddUserRequest { - /** @var TemplateAddUserRequest $obj */ + /** @var TemplateAddUserRequest */ return ObjectSerializer::deserialize( $data, TemplateAddUserRequest::class, @@ -276,8 +276,10 @@ public static function init(array $data): TemplateAddUserRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php index cfb6d0ca1..8ef1c9040 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php @@ -420,7 +420,7 @@ public static function fromArray(array $data): TemplateCreateEmbeddedDraftReques */ public static function init(array $data): TemplateCreateEmbeddedDraftRequest { - /** @var TemplateCreateEmbeddedDraftRequest $obj */ + /** @var TemplateCreateEmbeddedDraftRequest */ return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftRequest::class, @@ -431,8 +431,10 @@ public static function init(array $data): TemplateCreateEmbeddedDraftRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1232,7 +1234,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php index 1270cf16a..83188f99a 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateCreateEmbeddedDraftRespon */ public static function init(array $data): TemplateCreateEmbeddedDraftResponse { - /** @var TemplateCreateEmbeddedDraftResponse $obj */ + /** @var TemplateCreateEmbeddedDraftResponse */ return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateCreateEmbeddedDraftResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php index 0090f4192..dc954905b 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): TemplateCreateEmbeddedDraftRespon */ public static function init(array $data): TemplateCreateEmbeddedDraftResponseTemplate { - /** @var TemplateCreateEmbeddedDraftResponseTemplate $obj */ + /** @var TemplateCreateEmbeddedDraftResponseTemplate */ return ObjectSerializer::deserialize( $data, TemplateCreateEmbeddedDraftResponseTemplate::class, @@ -284,8 +284,10 @@ public static function init(array $data): TemplateCreateEmbeddedDraftResponseTem * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -498,7 +500,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateRequest.php b/sdks/php/src/Model/TemplateCreateRequest.php index 8c5b437d8..1bcea792f 100644 --- a/sdks/php/src/Model/TemplateCreateRequest.php +++ b/sdks/php/src/Model/TemplateCreateRequest.php @@ -371,7 +371,7 @@ public static function fromArray(array $data): TemplateCreateRequest */ public static function init(array $data): TemplateCreateRequest { - /** @var TemplateCreateRequest $obj */ + /** @var TemplateCreateRequest */ return ObjectSerializer::deserialize( $data, TemplateCreateRequest::class, @@ -382,8 +382,10 @@ public static function init(array $data): TemplateCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -997,7 +999,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateResponse.php b/sdks/php/src/Model/TemplateCreateResponse.php index 6f8684652..d71c6f5bd 100644 --- a/sdks/php/src/Model/TemplateCreateResponse.php +++ b/sdks/php/src/Model/TemplateCreateResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateCreateResponse */ public static function init(array $data): TemplateCreateResponse { - /** @var TemplateCreateResponse $obj */ + /** @var TemplateCreateResponse */ return ObjectSerializer::deserialize( $data, TemplateCreateResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateCreateResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateCreateResponseTemplate.php b/sdks/php/src/Model/TemplateCreateResponseTemplate.php index 2a66c2c3f..87668708d 100644 --- a/sdks/php/src/Model/TemplateCreateResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateResponseTemplate.php @@ -252,7 +252,7 @@ public static function fromArray(array $data): TemplateCreateResponseTemplate */ public static function init(array $data): TemplateCreateResponseTemplate { - /** @var TemplateCreateResponseTemplate $obj */ + /** @var TemplateCreateResponseTemplate */ return ObjectSerializer::deserialize( $data, TemplateCreateResponseTemplate::class, @@ -263,8 +263,10 @@ public static function init(array $data): TemplateCreateResponseTemplate * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -394,7 +396,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateEditResponse.php b/sdks/php/src/Model/TemplateEditResponse.php index 76103f6b1..a4581fcea 100644 --- a/sdks/php/src/Model/TemplateEditResponse.php +++ b/sdks/php/src/Model/TemplateEditResponse.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): TemplateEditResponse */ public static function init(array $data): TemplateEditResponse { - /** @var TemplateEditResponse $obj */ + /** @var TemplateEditResponse */ return ObjectSerializer::deserialize( $data, TemplateEditResponse::class, @@ -262,8 +262,10 @@ public static function init(array $data): TemplateEditResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateGetResponse.php b/sdks/php/src/Model/TemplateGetResponse.php index 91496bb1a..4e8648c6b 100644 --- a/sdks/php/src/Model/TemplateGetResponse.php +++ b/sdks/php/src/Model/TemplateGetResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateGetResponse */ public static function init(array $data): TemplateGetResponse { - /** @var TemplateGetResponse $obj */ + /** @var TemplateGetResponse */ return ObjectSerializer::deserialize( $data, TemplateGetResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateGetResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateListResponse.php b/sdks/php/src/Model/TemplateListResponse.php index 52f683e84..5f7d1227f 100644 --- a/sdks/php/src/Model/TemplateListResponse.php +++ b/sdks/php/src/Model/TemplateListResponse.php @@ -265,7 +265,7 @@ public static function fromArray(array $data): TemplateListResponse */ public static function init(array $data): TemplateListResponse { - /** @var TemplateListResponse $obj */ + /** @var TemplateListResponse */ return ObjectSerializer::deserialize( $data, TemplateListResponse::class, @@ -276,8 +276,10 @@ public static function init(array $data): TemplateListResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -461,7 +463,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateRemoveUserRequest.php b/sdks/php/src/Model/TemplateRemoveUserRequest.php index 306df33e4..b743a937e 100644 --- a/sdks/php/src/Model/TemplateRemoveUserRequest.php +++ b/sdks/php/src/Model/TemplateRemoveUserRequest.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateRemoveUserRequest */ public static function init(array $data): TemplateRemoveUserRequest { - /** @var TemplateRemoveUserRequest $obj */ + /** @var TemplateRemoveUserRequest */ return ObjectSerializer::deserialize( $data, TemplateRemoveUserRequest::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateRemoveUserRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponse.php b/sdks/php/src/Model/TemplateResponse.php index 7b5cb283b..97cfad906 100644 --- a/sdks/php/src/Model/TemplateResponse.php +++ b/sdks/php/src/Model/TemplateResponse.php @@ -350,7 +350,7 @@ public static function fromArray(array $data): TemplateResponse */ public static function init(array $data): TemplateResponse { - /** @var TemplateResponse $obj */ + /** @var TemplateResponse */ return ObjectSerializer::deserialize( $data, TemplateResponse::class, @@ -361,8 +361,10 @@ public static function init(array $data): TemplateResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -923,7 +925,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseAccount.php b/sdks/php/src/Model/TemplateResponseAccount.php index 57845033e..76b0ed512 100644 --- a/sdks/php/src/Model/TemplateResponseAccount.php +++ b/sdks/php/src/Model/TemplateResponseAccount.php @@ -286,7 +286,7 @@ public static function fromArray(array $data): TemplateResponseAccount */ public static function init(array $data): TemplateResponseAccount { - /** @var TemplateResponseAccount $obj */ + /** @var TemplateResponseAccount */ return ObjectSerializer::deserialize( $data, TemplateResponseAccount::class, @@ -297,8 +297,10 @@ public static function init(array $data): TemplateResponseAccount * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -563,7 +565,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseAccountQuota.php b/sdks/php/src/Model/TemplateResponseAccountQuota.php index d2aa9fe4d..a8ab59d42 100644 --- a/sdks/php/src/Model/TemplateResponseAccountQuota.php +++ b/sdks/php/src/Model/TemplateResponseAccountQuota.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): TemplateResponseAccountQuota */ public static function init(array $data): TemplateResponseAccountQuota { - /** @var TemplateResponseAccountQuota $obj */ + /** @var TemplateResponseAccountQuota */ return ObjectSerializer::deserialize( $data, TemplateResponseAccountQuota::class, @@ -284,8 +284,10 @@ public static function init(array $data): TemplateResponseAccountQuota * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -496,7 +498,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseCCRole.php b/sdks/php/src/Model/TemplateResponseCCRole.php index 3d7fd9a12..72d1972ce 100644 --- a/sdks/php/src/Model/TemplateResponseCCRole.php +++ b/sdks/php/src/Model/TemplateResponseCCRole.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): TemplateResponseCCRole */ public static function init(array $data): TemplateResponseCCRole { - /** @var TemplateResponseCCRole $obj */ + /** @var TemplateResponseCCRole */ return ObjectSerializer::deserialize( $data, TemplateResponseCCRole::class, @@ -262,8 +262,10 @@ public static function init(array $data): TemplateResponseCCRole * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocument.php b/sdks/php/src/Model/TemplateResponseDocument.php index d46efa660..36399a6c3 100644 --- a/sdks/php/src/Model/TemplateResponseDocument.php +++ b/sdks/php/src/Model/TemplateResponseDocument.php @@ -286,7 +286,7 @@ public static function fromArray(array $data): TemplateResponseDocument */ public static function init(array $data): TemplateResponseDocument { - /** @var TemplateResponseDocument $obj */ + /** @var TemplateResponseDocument */ return ObjectSerializer::deserialize( $data, TemplateResponseDocument::class, @@ -297,8 +297,10 @@ public static function init(array $data): TemplateResponseDocument * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -570,7 +572,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php index 498e49b7e..8603877ad 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php @@ -325,8 +325,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -718,7 +720,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php index c59acbc03..2f28fd529 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentCustomFie */ public static function init(array $data): TemplateResponseDocumentCustomFieldCheckbox { - /** @var TemplateResponseDocumentCustomFieldCheckbox $obj */ + /** @var TemplateResponseDocumentCustomFieldCheckbox */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentCustomFieldCheckbox::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentCustomFieldChe * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php index e4e072444..dabdff75d 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): TemplateResponseDocumentCustomFie */ public static function init(array $data): TemplateResponseDocumentCustomFieldText { - /** @var TemplateResponseDocumentCustomFieldText $obj */ + /** @var TemplateResponseDocumentCustomFieldText */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentCustomFieldText::class, @@ -284,8 +284,10 @@ public static function init(array $data): TemplateResponseDocumentCustomFieldTex * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -528,7 +530,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php index c192584a9..3b4cc2cb6 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFieldGrou */ public static function init(array $data): TemplateResponseDocumentFieldGroup { - /** @var TemplateResponseDocumentFieldGroup $obj */ + /** @var TemplateResponseDocumentFieldGroup */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFieldGroup::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateResponseDocumentFieldGroup * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php index e47cb2686..5b17831da 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFieldGrou */ public static function init(array $data): TemplateResponseDocumentFieldGroupRule { - /** @var TemplateResponseDocumentFieldGroupRule $obj */ + /** @var TemplateResponseDocumentFieldGroupRule */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFieldGroupRule::class, @@ -270,8 +270,10 @@ public static function init(array $data): TemplateResponseDocumentFieldGroupRule * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php index dec9a4e81..bf0347fba 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php @@ -343,8 +343,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -729,7 +731,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php index 16a40a712..73f1c5702 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldCheckbox { - /** @var TemplateResponseDocumentFormFieldCheckbox $obj */ + /** @var TemplateResponseDocumentFormFieldCheckbox */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldCheckbox::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldCheck * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php index 4cb95eb88..c510920d8 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldDateSigned { - /** @var TemplateResponseDocumentFormFieldDateSigned $obj */ + /** @var TemplateResponseDocumentFormFieldDateSigned */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldDateSigned::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldDateS * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php index 14e4b9e40..0a7f9a0e4 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldDropdown { - /** @var TemplateResponseDocumentFormFieldDropdown $obj */ + /** @var TemplateResponseDocumentFormFieldDropdown */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldDropdown::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldDropd * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php index f1d7d4e22..0010b6d31 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php @@ -273,7 +273,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldHyperlink { - /** @var TemplateResponseDocumentFormFieldHyperlink $obj */ + /** @var TemplateResponseDocumentFormFieldHyperlink */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldHyperlink::class, @@ -284,8 +284,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldHyper * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -528,7 +530,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php index f2a6680bf..4abd8d1f3 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldInitials { - /** @var TemplateResponseDocumentFormFieldInitials $obj */ + /** @var TemplateResponseDocumentFormFieldInitials */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldInitials::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldIniti * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php index 481d18406..194b7fc4c 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldRadio { - /** @var TemplateResponseDocumentFormFieldRadio $obj */ + /** @var TemplateResponseDocumentFormFieldRadio */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldRadio::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldRadio * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php index 34a8db663..3e71160d4 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldSignature { - /** @var TemplateResponseDocumentFormFieldSignature $obj */ + /** @var TemplateResponseDocumentFormFieldSignature */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldSignature::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldSigna * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php index 04b239477..3456e9629 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php @@ -312,7 +312,7 @@ public static function fromArray(array $data): TemplateResponseDocumentFormField */ public static function init(array $data): TemplateResponseDocumentFormFieldText { - /** @var TemplateResponseDocumentFormFieldText $obj */ + /** @var TemplateResponseDocumentFormFieldText */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentFormFieldText::class, @@ -323,8 +323,10 @@ public static function init(array $data): TemplateResponseDocumentFormFieldText * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -620,7 +622,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php index c69a2e084..8ed3e1084 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php @@ -343,8 +343,10 @@ public static function discriminatorClassName(array $data): ?string * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -729,7 +731,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php index 810f71cac..7313a48b6 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldCheckbox { - /** @var TemplateResponseDocumentStaticFieldCheckbox $obj */ + /** @var TemplateResponseDocumentStaticFieldCheckbox */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldCheckbox::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldChe * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php index f2dd9b569..33425da25 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldDateSigned { - /** @var TemplateResponseDocumentStaticFieldDateSigned $obj */ + /** @var TemplateResponseDocumentStaticFieldDateSigned */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldDateSigned::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldDat * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php index 60528410a..ff490a0f2 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldDropdown { - /** @var TemplateResponseDocumentStaticFieldDropdown $obj */ + /** @var TemplateResponseDocumentStaticFieldDropdown */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldDropdown::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldDro * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php index c9cc39ed4..5b87dab16 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldHyperlink { - /** @var TemplateResponseDocumentStaticFieldHyperlink $obj */ + /** @var TemplateResponseDocumentStaticFieldHyperlink */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldHyperlink::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldHyp * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php index 4337e9bdb..198f8b8fe 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldInitials { - /** @var TemplateResponseDocumentStaticFieldInitials $obj */ + /** @var TemplateResponseDocumentStaticFieldInitials */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldInitials::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldIni * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php index 9c0f52d2d..197758d3f 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldRadio { - /** @var TemplateResponseDocumentStaticFieldRadio $obj */ + /** @var TemplateResponseDocumentStaticFieldRadio */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldRadio::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldRad * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php index d52f314ea..adaba8500 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldSignature { - /** @var TemplateResponseDocumentStaticFieldSignature $obj */ + /** @var TemplateResponseDocumentStaticFieldSignature */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldSignature::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldSig * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php index 2418051e2..00344871b 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php @@ -245,7 +245,7 @@ public static function fromArray(array $data): TemplateResponseDocumentStaticFie */ public static function init(array $data): TemplateResponseDocumentStaticFieldText { - /** @var TemplateResponseDocumentStaticFieldText $obj */ + /** @var TemplateResponseDocumentStaticFieldText */ return ObjectSerializer::deserialize( $data, TemplateResponseDocumentStaticFieldText::class, @@ -256,8 +256,10 @@ public static function init(array $data): TemplateResponseDocumentStaticFieldTex * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -392,7 +394,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php index f667100e0..b045fbca3 100644 --- a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php +++ b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): TemplateResponseFieldAvgTextLengt */ public static function init(array $data): TemplateResponseFieldAvgTextLength { - /** @var TemplateResponseFieldAvgTextLength $obj */ + /** @var TemplateResponseFieldAvgTextLength */ return ObjectSerializer::deserialize( $data, TemplateResponseFieldAvgTextLength::class, @@ -270,8 +270,10 @@ public static function init(array $data): TemplateResponseFieldAvgTextLength * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -428,7 +430,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateResponseSignerRole.php b/sdks/php/src/Model/TemplateResponseSignerRole.php index c41a61f2e..624ee537d 100644 --- a/sdks/php/src/Model/TemplateResponseSignerRole.php +++ b/sdks/php/src/Model/TemplateResponseSignerRole.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): TemplateResponseSignerRole */ public static function init(array $data): TemplateResponseSignerRole { - /** @var TemplateResponseSignerRole $obj */ + /** @var TemplateResponseSignerRole */ return ObjectSerializer::deserialize( $data, TemplateResponseSignerRole::class, @@ -269,8 +269,10 @@ public static function init(array $data): TemplateResponseSignerRole * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesRequest.php b/sdks/php/src/Model/TemplateUpdateFilesRequest.php index 28d067d89..b2cd0e019 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesRequest.php +++ b/sdks/php/src/Model/TemplateUpdateFilesRequest.php @@ -287,7 +287,7 @@ public static function fromArray(array $data): TemplateUpdateFilesRequest */ public static function init(array $data): TemplateUpdateFilesRequest { - /** @var TemplateUpdateFilesRequest $obj */ + /** @var TemplateUpdateFilesRequest */ return ObjectSerializer::deserialize( $data, TemplateUpdateFilesRequest::class, @@ -298,8 +298,10 @@ public static function init(array $data): TemplateUpdateFilesRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -582,7 +584,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponse.php b/sdks/php/src/Model/TemplateUpdateFilesResponse.php index 5537f648b..9ecd376a6 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponse.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponse.php @@ -251,7 +251,7 @@ public static function fromArray(array $data): TemplateUpdateFilesResponse */ public static function init(array $data): TemplateUpdateFilesResponse { - /** @var TemplateUpdateFilesResponse $obj */ + /** @var TemplateUpdateFilesResponse */ return ObjectSerializer::deserialize( $data, TemplateUpdateFilesResponse::class, @@ -262,8 +262,10 @@ public static function init(array $data): TemplateUpdateFilesResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -393,7 +395,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php index aa5cd8a9f..f04835421 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): TemplateUpdateFilesResponseTempla */ public static function init(array $data): TemplateUpdateFilesResponseTemplate { - /** @var TemplateUpdateFilesResponseTemplate $obj */ + /** @var TemplateUpdateFilesResponseTemplate */ return ObjectSerializer::deserialize( $data, TemplateUpdateFilesResponseTemplate::class, @@ -270,8 +270,10 @@ public static function init(array $data): TemplateUpdateFilesResponseTemplate * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -430,7 +432,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php index 4eddfe4c0..efaa111ac 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php @@ -514,7 +514,7 @@ public static function fromArray(array $data): UnclaimedDraftCreateEmbeddedReque */ public static function init(array $data): UnclaimedDraftCreateEmbeddedRequest { - /** @var UnclaimedDraftCreateEmbeddedRequest $obj */ + /** @var UnclaimedDraftCreateEmbeddedRequest */ return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateEmbeddedRequest::class, @@ -525,8 +525,10 @@ public static function init(array $data): UnclaimedDraftCreateEmbeddedRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1652,7 +1654,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php index 19787628a..e502d966c 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php @@ -455,7 +455,7 @@ public static function fromArray(array $data): UnclaimedDraftCreateEmbeddedWithT */ public static function init(array $data): UnclaimedDraftCreateEmbeddedWithTemplateRequest { - /** @var UnclaimedDraftCreateEmbeddedWithTemplateRequest $obj */ + /** @var UnclaimedDraftCreateEmbeddedWithTemplateRequest */ return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateEmbeddedWithTemplateRequest::class, @@ -466,8 +466,10 @@ public static function init(array $data): UnclaimedDraftCreateEmbeddedWithTempla * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1416,7 +1418,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php index 30bba17b3..ffa90ca39 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php @@ -430,7 +430,7 @@ public static function fromArray(array $data): UnclaimedDraftCreateRequest */ public static function init(array $data): UnclaimedDraftCreateRequest { - /** @var UnclaimedDraftCreateRequest $obj */ + /** @var UnclaimedDraftCreateRequest */ return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateRequest::class, @@ -441,8 +441,10 @@ public static function init(array $data): UnclaimedDraftCreateRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -1241,7 +1243,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php index 4abec45dd..6f5df04cf 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php @@ -258,7 +258,7 @@ public static function fromArray(array $data): UnclaimedDraftCreateResponse */ public static function init(array $data): UnclaimedDraftCreateResponse { - /** @var UnclaimedDraftCreateResponse $obj */ + /** @var UnclaimedDraftCreateResponse */ return ObjectSerializer::deserialize( $data, UnclaimedDraftCreateResponse::class, @@ -269,8 +269,10 @@ public static function init(array $data): UnclaimedDraftCreateResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -427,7 +429,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php index 113c12845..441229f0d 100644 --- a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php @@ -300,7 +300,7 @@ public static function fromArray(array $data): UnclaimedDraftEditAndResendReques */ public static function init(array $data): UnclaimedDraftEditAndResendRequest { - /** @var UnclaimedDraftEditAndResendRequest $obj */ + /** @var UnclaimedDraftEditAndResendRequest */ return ObjectSerializer::deserialize( $data, UnclaimedDraftEditAndResendRequest::class, @@ -311,8 +311,10 @@ public static function init(array $data): UnclaimedDraftEditAndResendRequest * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -636,7 +638,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/UnclaimedDraftResponse.php b/sdks/php/src/Model/UnclaimedDraftResponse.php index 41e114122..66869e5cf 100644 --- a/sdks/php/src/Model/UnclaimedDraftResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftResponse.php @@ -287,7 +287,7 @@ public static function fromArray(array $data): UnclaimedDraftResponse */ public static function init(array $data): UnclaimedDraftResponse { - /** @var UnclaimedDraftResponse $obj */ + /** @var UnclaimedDraftResponse */ return ObjectSerializer::deserialize( $data, UnclaimedDraftResponse::class, @@ -298,8 +298,10 @@ public static function init(array $data): UnclaimedDraftResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -592,7 +594,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/Model/WarningResponse.php b/sdks/php/src/Model/WarningResponse.php index 3a3bd5321..51acff4f4 100644 --- a/sdks/php/src/Model/WarningResponse.php +++ b/sdks/php/src/Model/WarningResponse.php @@ -259,7 +259,7 @@ public static function fromArray(array $data): WarningResponse */ public static function init(array $data): WarningResponse { - /** @var WarningResponse $obj */ + /** @var WarningResponse */ return ObjectSerializer::deserialize( $data, WarningResponse::class, @@ -270,8 +270,10 @@ public static function init(array $data): WarningResponse * 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|int|object|array|mixed $defaultValue */ - private function setIfExists(string $variableName, array $fields, mixed $defaultValue): void + 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; @@ -436,7 +438,7 @@ public function __toString() { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/src/ObjectSerializer.php b/sdks/php/src/ObjectSerializer.php index 0fce8c0d6..4642f9c92 100644 --- a/sdks/php/src/ObjectSerializer.php +++ b/sdks/php/src/ObjectSerializer.php @@ -59,13 +59,13 @@ public static function setDateTimeFormat(string $format) /** * Serialize data * - * @param mixed $data the data to serialize - * @param string $type the OpenAPIToolsType of the data - * @param string $format the format of the OpenAPITools type of the data + * @param string|int|object|array|mixed $data the data to serialize + * @param string $type the OpenAPIToolsType of the data + * @param string $format the format of the OpenAPITools type of the data * * @return scalar|object|array|null serialized form of $data */ - public static function sanitizeForSerialization(mixed $data, string $type = null, string $format = null) + public static function sanitizeForSerialization($data, string $type = null, string $format = null) { if (is_scalar($data) || null === $data) { return $data; @@ -164,9 +164,11 @@ public static function toPathValue(string $value) /** * Checks if a value is empty, based on its OpenAPI type. * + * @param string|int|object|array|mixed $value + * * @return bool true if $value is empty */ - private static function isEmptyValue(mixed $value, string $openApiType): bool + private static function isEmptyValue($value, string $openApiType): bool { // If empty() returns false, it is not empty regardless of its type. if (!empty($value)) { @@ -205,15 +207,15 @@ private static function isEmptyValue(mixed $value, string $openApiType): bool * 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 + * @param string|int|object|array|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 */ public static function toQueryValue( - mixed $value, + $value, string $paramName, string $openApiType = 'string', string $style = 'form', @@ -336,11 +338,11 @@ 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 mixed $value the value of the parameter + * @param string|int|object|array|mixed $value the value of the parameter * * @return string the header string */ - public static function toString(mixed $value) + public static function toString($value) { if ($value instanceof DateTime) { // datetime in ISO8601 format return $value->format(self::$dateTimeFormat); @@ -391,13 +393,13 @@ public static function serializeCollection(array $collection, string $style, boo /** * 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 + * @param string|int|object|array|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(mixed $data, string $class, array $httpHeaders = null) + public static function deserialize($data, string $class, array $httpHeaders = null) { if (null === $data) { return null; diff --git a/sdks/php/templates/.php-cs-fixer.dist.php b/sdks/php/templates/.php-cs-fixer.dist.php index d93659d70..a8ff32efd 100644 --- a/sdks/php/templates/.php-cs-fixer.dist.php +++ b/sdks/php/templates/.php-cs-fixer.dist.php @@ -96,6 +96,9 @@ 'elements' => ['method', 'property'], ], 'yoda_style' => false, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + ], ]) ->setFinder($finder) ->setRiskyAllowed(true) diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index 445eaed01..6aefc4408 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -89,7 +89,7 @@ class ApiException extends Exception /** * Sets the deserialized response object (during deserialization) * - * @param mixed $obj Deserialized response object + * @param string|int|object|array|mixed $obj Deserialized response object * * @return void */ diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index 467a8340a..cc7a940f4 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -49,7 +49,7 @@ class ObjectSerializer /** * Serialize data * - * @param mixed $data the data to serialize + * @param string|int|object|array|mixed $data the data to serialize * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data * @@ -154,7 +154,7 @@ class ObjectSerializer /** * Checks if a value is empty, based on its OpenAPI type. * - * @param mixed $value + * @param string|int|object|array|mixed $value * @param string $openApiType * * @return bool true if $value is empty @@ -198,7 +198,7 @@ class ObjectSerializer * 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|int|object|array|mixed $value Parameter value * @param string $paramName Parameter name * @param string $openApiType OpenAPIType eg. array or object * @param string $style Parameter serialization style @@ -332,7 +332,7 @@ class ObjectSerializer * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * - * @param mixed $value the value of the parameter + * @param string|int|object|array|mixed $value the value of the parameter * * @return string the header string */ @@ -387,7 +387,7 @@ class ObjectSerializer /** * Deserialize a JSON string into an object * - * @param mixed $data object or primitive to be deserialized + * @param string|int|object|array|mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers * diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 5ab07824a..c9d1b2f8e 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -25,6 +25,7 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; +use Psr\Http\Message\ResponseInterface; use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; @@ -911,9 +912,9 @@ use {{invokerPackage}}\ObjectSerializer; * @return object|array|null */ private function handleRangeCodeResponse( - $response, + ResponseInterface $response, string $rangeCode, - string $returnDataType, + string $returnDataType ) { $statusCode = $response->getStatusCode(); $rangeCodeLeft = (int) (substr($rangeCode, 0, 1) . '00'); @@ -945,7 +946,7 @@ use {{invokerPackage}}\ObjectSerializer; private function handleRangeCodeException( ApiException $e, string $rangeCode, - string $exceptionDataType, + string $exceptionDataType ): bool { $statusCode = $e->getCode(); $rangeCodeLeft = (int) (substr($rangeCode, 0, 1) . '00'); diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache index 5a96f2f6f..83f35c109 100644 --- a/sdks/php/templates/libraries/psr-18/ApiException.mustache +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -92,7 +92,7 @@ class ApiException extends RequestException /** * Sets the deseralized response object (during deserialization) * - * @param mixed $obj Deserialized response object + * @param string|int|object|array|mixed $obj Deserialized response object * * @return void */ diff --git a/sdks/php/templates/model_generic.mustache b/sdks/php/templates/model_generic.mustache index 0bdea10a3..431810e2a 100644 --- a/sdks/php/templates/model_generic.mustache +++ b/sdks/php/templates/model_generic.mustache @@ -260,7 +260,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par /** Attempt to instantiate and hydrate a new instance of this class */ public static function init(array $data): {{classname}} { - /** @var {{classname}} $obj */ + /** @var {{classname}} */ $obj = ObjectSerializer::deserialize( $data, {{classname}}::class, @@ -294,7 +294,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @param string $variableName * @param array $fields - * @param mixed $defaultValue + * @param string|int|object|array|mixed $defaultValue */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { @@ -584,7 +584,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par { return json_encode( ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT + JSON_UNESCAPED_SLASHES ); } From e420b27842196d9a24dfd4521751df87378f53c0 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 15:52:45 -0500 Subject: [PATCH 04/19] Further cleanup --- sdks/php/src/Api/AccountApi.php | 36 ++++-- sdks/php/src/Api/ApiAppApi.php | 53 +++++--- sdks/php/src/Api/BulkSendJobApi.php | 22 ++-- sdks/php/src/Api/EmbeddedApi.php | 18 ++- sdks/php/src/Api/OAuthApi.php | 22 ++-- sdks/php/src/Api/ReportApi.php | 9 +- sdks/php/src/Api/SignatureRequestApi.php | 152 +++++++++++++++-------- sdks/php/src/Api/TeamApi.php | 106 ++++++++++------ sdks/php/src/Api/TemplateApi.php | 107 ++++++++++------ sdks/php/src/Api/UnclaimedDraftApi.php | 36 ++++-- sdks/php/templates/api.mustache | 27 +--- 11 files changed, 369 insertions(+), 219 deletions(-) diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index a24fb2488..58147d1de 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -141,15 +141,14 @@ public function getResponse() * Create Account * * @param Model\AccountCreateRequest $account_create_request account_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountCreate'] to see the possible values for this operation * * @return Model\AccountCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function accountCreate(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) + public function accountCreate(Model\AccountCreateRequest $account_create_request) { - list($response) = $this->accountCreateWithHttpInfo($account_create_request, $contentType); + list($response) = $this->accountCreateWithHttpInfo($account_create_request); return $response; } @@ -164,6 +163,7 @@ public function accountCreate(Model\AccountCreateRequest $account_create_request * @return array of Model\AccountCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountCreate. This method will eventually become unavailable */ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { @@ -299,6 +299,7 @@ public function accountCreateWithHttpInfo(Model\AccountCreateRequest $account_cr * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountCreate. This method will eventually become unavailable */ public function accountCreateAsync(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { @@ -320,6 +321,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountCreate. This method will eventually become unavailable */ public function accountCreateAsyncWithHttpInfo(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { @@ -370,6 +372,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountCreate. This method will eventually become unavailable */ public function accountCreateRequest(Model\AccountCreateRequest $account_create_request, string $contentType = self::contentTypes['accountCreate'][0]) { @@ -479,15 +482,14 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ * * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountGet'] to see the possible values for this operation * * @return Model\AccountGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function accountGet(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) + public function accountGet(string $account_id = null, string $email_address = null) { - list($response) = $this->accountGetWithHttpInfo($account_id, $email_address, $contentType); + list($response) = $this->accountGetWithHttpInfo($account_id, $email_address); return $response; } @@ -503,6 +505,7 @@ public function accountGet(string $account_id = null, string $email_address = nu * @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountGet. This method will eventually become unavailable */ public function accountGetWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { @@ -639,6 +642,7 @@ public function accountGetWithHttpInfo(string $account_id = null, string $email_ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountGet. This method will eventually become unavailable */ public function accountGetAsync(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { @@ -661,6 +665,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountGet. This method will eventually become unavailable */ public function accountGetAsyncWithHttpInfo(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { @@ -712,6 +717,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountGet. This method will eventually become unavailable */ public function accountGetRequest(string $account_id = null, string $email_address = null, string $contentType = self::contentTypes['accountGet'][0]) { @@ -815,15 +821,14 @@ public function accountGetRequest(string $account_id = null, string $email_addre * Update Account * * @param Model\AccountUpdateRequest $account_update_request account_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountUpdate'] to see the possible values for this operation * * @return Model\AccountGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function accountUpdate(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) + public function accountUpdate(Model\AccountUpdateRequest $account_update_request) { - list($response) = $this->accountUpdateWithHttpInfo($account_update_request, $contentType); + list($response) = $this->accountUpdateWithHttpInfo($account_update_request); return $response; } @@ -838,6 +843,7 @@ public function accountUpdate(Model\AccountUpdateRequest $account_update_request * @return array of Model\AccountGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountUpdate. This method will eventually become unavailable */ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { @@ -973,6 +979,7 @@ public function accountUpdateWithHttpInfo(Model\AccountUpdateRequest $account_up * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountUpdate. This method will eventually become unavailable */ public function accountUpdateAsync(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { @@ -994,6 +1001,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountUpdate. This method will eventually become unavailable */ public function accountUpdateAsyncWithHttpInfo(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { @@ -1044,6 +1052,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountUpdate. This method will eventually become unavailable */ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_request, string $contentType = self::contentTypes['accountUpdate'][0]) { @@ -1152,15 +1161,14 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ * Verify Account * * @param Model\AccountVerifyRequest $account_verify_request account_verify_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['accountVerify'] to see the possible values for this operation * * @return Model\AccountVerifyResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function accountVerify(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) + public function accountVerify(Model\AccountVerifyRequest $account_verify_request) { - list($response) = $this->accountVerifyWithHttpInfo($account_verify_request, $contentType); + list($response) = $this->accountVerifyWithHttpInfo($account_verify_request); return $response; } @@ -1175,6 +1183,7 @@ public function accountVerify(Model\AccountVerifyRequest $account_verify_request * @return array of Model\AccountVerifyResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountVerify. This method will eventually become unavailable */ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { @@ -1310,6 +1319,7 @@ public function accountVerifyWithHttpInfo(Model\AccountVerifyRequest $account_ve * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountVerify. This method will eventually become unavailable */ public function accountVerifyAsync(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { @@ -1331,6 +1341,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountVerify. This method will eventually become unavailable */ public function accountVerifyAsyncWithHttpInfo(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { @@ -1381,6 +1392,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::accountVerify. This method will eventually become unavailable */ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_request, string $contentType = self::contentTypes['accountVerify'][0]) { diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index a3e0da033..df8df0cd8 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -146,15 +146,14 @@ public function getResponse() * Create API App * * @param Model\ApiAppCreateRequest $api_app_create_request api_app_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppCreate'] to see the possible values for this operation * * @return Model\ApiAppGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) + public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request) { - list($response) = $this->apiAppCreateWithHttpInfo($api_app_create_request, $contentType); + list($response) = $this->apiAppCreateWithHttpInfo($api_app_create_request); return $response; } @@ -169,6 +168,7 @@ public function apiAppCreate(Model\ApiAppCreateRequest $api_app_create_request, * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppCreate. This method will eventually become unavailable */ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { @@ -304,6 +304,7 @@ public function apiAppCreateWithHttpInfo(Model\ApiAppCreateRequest $api_app_crea * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppCreate. This method will eventually become unavailable */ public function apiAppCreateAsync(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { @@ -325,6 +326,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppCreate. This method will eventually become unavailable */ public function apiAppCreateAsyncWithHttpInfo(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { @@ -375,6 +377,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppCreate. This method will eventually become unavailable */ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_request, string $contentType = self::contentTypes['apiAppCreate'][0]) { @@ -482,15 +485,14 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re * * Delete API App * - * @param string $client_id The client id of the API App to delete. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppDelete'] to see the possible values for this operation + * @param string $client_id The client id of the API App to delete. (required) * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function apiAppDelete(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) + public function apiAppDelete(string $client_id) { - $this->apiAppDeleteWithHttpInfo($client_id, $contentType); + $this->apiAppDeleteWithHttpInfo($client_id); } /** @@ -504,6 +506,7 @@ public function apiAppDelete(string $client_id, string $contentType = self::cont * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppDelete. This method will eventually become unavailable */ public function apiAppDeleteWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { @@ -566,6 +569,7 @@ public function apiAppDeleteWithHttpInfo(string $client_id, string $contentType * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppDelete. This method will eventually become unavailable */ public function apiAppDeleteAsync(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { @@ -587,6 +591,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppDelete. This method will eventually become unavailable */ public function apiAppDeleteAsyncWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { @@ -624,6 +629,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppDelete. This method will eventually become unavailable */ public function apiAppDeleteRequest(string $client_id, string $contentType = self::contentTypes['apiAppDelete'][0]) { @@ -723,16 +729,15 @@ public function apiAppDeleteRequest(string $client_id, string $contentType = sel * * Get API App * - * @param string $client_id The client id of the API App to retrieve. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppGet'] to see the possible values for this operation + * @param string $client_id The client id of the API App to retrieve. (required) * * @return Model\ApiAppGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function apiAppGet(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) + public function apiAppGet(string $client_id) { - list($response) = $this->apiAppGetWithHttpInfo($client_id, $contentType); + list($response) = $this->apiAppGetWithHttpInfo($client_id); return $response; } @@ -747,6 +752,7 @@ public function apiAppGet(string $client_id, string $contentType = self::content * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppGet. This method will eventually become unavailable */ public function apiAppGetWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { @@ -882,6 +888,7 @@ public function apiAppGetWithHttpInfo(string $client_id, string $contentType = s * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppGet. This method will eventually become unavailable */ public function apiAppGetAsync(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { @@ -903,6 +910,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppGet. This method will eventually become unavailable */ public function apiAppGetAsyncWithHttpInfo(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { @@ -953,6 +961,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppGet. This method will eventually become unavailable */ public function apiAppGetRequest(string $client_id, string $contentType = self::contentTypes['apiAppGet'][0]) { @@ -1052,17 +1061,16 @@ public function apiAppGetRequest(string $client_id, string $contentType = self:: * * List API Apps * - * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppList'] to see the possible values for this operation + * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * * @return Model\ApiAppListResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function apiAppList(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) + public function apiAppList(int $page = 1, int $page_size = 20) { - list($response) = $this->apiAppListWithHttpInfo($page, $page_size, $contentType); + list($response) = $this->apiAppListWithHttpInfo($page, $page_size); return $response; } @@ -1078,6 +1086,7 @@ public function apiAppList(int $page = 1, int $page_size = 20, string $contentTy * @return array of Model\ApiAppListResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppList. This method will eventually become unavailable */ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { @@ -1214,6 +1223,7 @@ public function apiAppListWithHttpInfo(int $page = 1, int $page_size = 20, strin * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppList. This method will eventually become unavailable */ public function apiAppListAsync(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { @@ -1236,6 +1246,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppList. This method will eventually become unavailable */ public function apiAppListAsyncWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { @@ -1287,6 +1298,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppList. This method will eventually become unavailable */ public function apiAppListRequest(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['apiAppList'][0]) { @@ -1391,15 +1403,14 @@ public function apiAppListRequest(int $page = 1, int $page_size = 20, string $co * * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request api_app_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['apiAppUpdate'] to see the possible values for this operation * * @return Model\ApiAppGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) + public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request) { - list($response) = $this->apiAppUpdateWithHttpInfo($client_id, $api_app_update_request, $contentType); + list($response) = $this->apiAppUpdateWithHttpInfo($client_id, $api_app_update_request); return $response; } @@ -1415,6 +1426,7 @@ public function apiAppUpdate(string $client_id, Model\ApiAppUpdateRequest $api_a * @return array of Model\ApiAppGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppUpdate. This method will eventually become unavailable */ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { @@ -1551,6 +1563,7 @@ public function apiAppUpdateWithHttpInfo(string $client_id, Model\ApiAppUpdateRe * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppUpdate. This method will eventually become unavailable */ public function apiAppUpdateAsync(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { @@ -1573,6 +1586,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppUpdate. This method will eventually become unavailable */ public function apiAppUpdateAsyncWithHttpInfo(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { @@ -1624,6 +1638,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::apiAppUpdate. This method will eventually become unavailable */ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest $api_app_update_request, string $contentType = self::contentTypes['apiAppUpdate'][0]) { diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 99b84d2ad..6da54c057 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -137,15 +137,14 @@ public function getResponse() * @param string $bulk_send_job_id The id of the BulkSendJob to retrieve. (required) * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobGet'] to see the possible values for this operation * * @return Model\BulkSendJobGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) + public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $page_size = 20) { - list($response) = $this->bulkSendJobGetWithHttpInfo($bulk_send_job_id, $page, $page_size, $contentType); + list($response) = $this->bulkSendJobGetWithHttpInfo($bulk_send_job_id, $page, $page_size); return $response; } @@ -162,6 +161,7 @@ public function bulkSendJobGet(string $bulk_send_job_id, int $page = 1, int $pag * @return array of Model\BulkSendJobGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobGet. This method will eventually become unavailable */ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { @@ -299,6 +299,7 @@ public function bulkSendJobGetWithHttpInfo(string $bulk_send_job_id, int $page = * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobGet. This method will eventually become unavailable */ public function bulkSendJobGetAsync(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { @@ -322,6 +323,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobGet. This method will eventually become unavailable */ public function bulkSendJobGetAsyncWithHttpInfo(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { @@ -374,6 +376,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobGet. This method will eventually become unavailable */ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobGet'][0]) { @@ -492,17 +495,16 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i * * List Bulk Send Jobs * - * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['bulkSendJobList'] to see the possible values for this operation + * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) * * @return Model\BulkSendJobListResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function bulkSendJobList(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) + public function bulkSendJobList(int $page = 1, int $page_size = 20) { - list($response) = $this->bulkSendJobListWithHttpInfo($page, $page_size, $contentType); + list($response) = $this->bulkSendJobListWithHttpInfo($page, $page_size); return $response; } @@ -518,6 +520,7 @@ public function bulkSendJobList(int $page = 1, int $page_size = 20, string $cont * @return array of Model\BulkSendJobListResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobList. This method will eventually become unavailable */ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { @@ -654,6 +657,7 @@ public function bulkSendJobListWithHttpInfo(int $page = 1, int $page_size = 20, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobList. This method will eventually become unavailable */ public function bulkSendJobListAsync(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { @@ -676,6 +680,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobList. This method will eventually become unavailable */ public function bulkSendJobListAsyncWithHttpInfo(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { @@ -727,6 +732,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::bulkSendJobList. This method will eventually become unavailable */ public function bulkSendJobListRequest(int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['bulkSendJobList'][0]) { diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 4c7d54247..d671d9af5 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -136,15 +136,14 @@ public function getResponse() * * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request embedded_edit_url_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedEditUrl'] to see the possible values for this operation * * @return Model\EmbeddedEditUrlResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) + public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request) { - list($response) = $this->embeddedEditUrlWithHttpInfo($template_id, $embedded_edit_url_request, $contentType); + list($response) = $this->embeddedEditUrlWithHttpInfo($template_id, $embedded_edit_url_request); return $response; } @@ -160,6 +159,7 @@ public function embeddedEditUrl(string $template_id, Model\EmbeddedEditUrlReques * @return array of Model\EmbeddedEditUrlResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedEditUrl. This method will eventually become unavailable */ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { @@ -296,6 +296,7 @@ public function embeddedEditUrlWithHttpInfo(string $template_id, Model\EmbeddedE * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedEditUrl. This method will eventually become unavailable */ public function embeddedEditUrlAsync(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { @@ -318,6 +319,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedEditUrl. This method will eventually become unavailable */ public function embeddedEditUrlAsyncWithHttpInfo(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { @@ -369,6 +371,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedEditUrl. This method will eventually become unavailable */ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUrlRequest $embedded_edit_url_request, string $contentType = self::contentTypes['embeddedEditUrl'][0]) { @@ -493,15 +496,14 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr * Get Embedded Sign URL * * @param string $signature_id The id of the signature to get a signature url for. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['embeddedSignUrl'] to see the possible values for this operation * * @return Model\EmbeddedSignUrlResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function embeddedSignUrl(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) + public function embeddedSignUrl(string $signature_id) { - list($response) = $this->embeddedSignUrlWithHttpInfo($signature_id, $contentType); + list($response) = $this->embeddedSignUrlWithHttpInfo($signature_id); return $response; } @@ -516,6 +518,7 @@ public function embeddedSignUrl(string $signature_id, string $contentType = self * @return array of Model\EmbeddedSignUrlResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedSignUrl. This method will eventually become unavailable */ public function embeddedSignUrlWithHttpInfo(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { @@ -651,6 +654,7 @@ public function embeddedSignUrlWithHttpInfo(string $signature_id, string $conten * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedSignUrl. This method will eventually become unavailable */ public function embeddedSignUrlAsync(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { @@ -672,6 +676,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedSignUrl. This method will eventually become unavailable */ public function embeddedSignUrlAsyncWithHttpInfo(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { @@ -722,6 +727,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::embeddedSignUrl. This method will eventually become unavailable */ public function embeddedSignUrlRequest(string $signature_id, string $contentType = self::contentTypes['embeddedSignUrl'][0]) { diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 88c48943f..218a509fe 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -139,17 +139,14 @@ public function getResponse() * URL: https://app.hellosign.com * * @param Model\OAuthTokenGenerateRequest $o_auth_token_generate_request o_auth_token_generate_request (required) - * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenGenerate'] to see the possible values for this operation * * @return Model\OAuthTokenResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) + public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request) { - list($response) = $this->oauthTokenGenerateWithHttpInfo($o_auth_token_generate_request, $hostIndex, $variables, $contentType); + list($response) = $this->oauthTokenGenerateWithHttpInfo($o_auth_token_generate_request); return $response; } @@ -170,6 +167,7 @@ public function oauthTokenGenerate(Model\OAuthTokenGenerateRequest $o_auth_token * @return array of Model\OAuthTokenResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenGenerate. This method will eventually become unavailable */ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { @@ -299,6 +297,7 @@ public function oauthTokenGenerateWithHttpInfo(Model\OAuthTokenGenerateRequest $ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenGenerate. This method will eventually become unavailable */ public function oauthTokenGenerateAsync(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { @@ -326,6 +325,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenGenerate. This method will eventually become unavailable */ public function oauthTokenGenerateAsyncWithHttpInfo(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { @@ -382,6 +382,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenGenerate. This method will eventually become unavailable */ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_auth_token_generate_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenGenerate'][0]) { @@ -510,17 +511,14 @@ protected function getHostSettingsForoauthTokenGenerate(): array * URL: https://app.hellosign.com * * @param Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request o_auth_token_refresh_request (required) - * @param int|null $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['oauthTokenRefresh'] to see the possible values for this operation * * @return Model\OAuthTokenResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) + public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request) { - list($response) = $this->oauthTokenRefreshWithHttpInfo($o_auth_token_refresh_request, $hostIndex, $variables, $contentType); + list($response) = $this->oauthTokenRefreshWithHttpInfo($o_auth_token_refresh_request); return $response; } @@ -541,6 +539,7 @@ public function oauthTokenRefresh(Model\OAuthTokenRefreshRequest $o_auth_token_r * @return array of Model\OAuthTokenResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenRefresh. This method will eventually become unavailable */ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { @@ -670,6 +669,7 @@ public function oauthTokenRefreshWithHttpInfo(Model\OAuthTokenRefreshRequest $o_ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenRefresh. This method will eventually become unavailable */ public function oauthTokenRefreshAsync(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { @@ -697,6 +697,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenRefresh. This method will eventually become unavailable */ public function oauthTokenRefreshAsyncWithHttpInfo(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { @@ -753,6 +754,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::oauthTokenRefresh. This method will eventually become unavailable */ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_token_refresh_request, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['oauthTokenRefresh'][0]) { diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index a5a99844c..246bc534d 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -132,15 +132,14 @@ public function getResponse() * Create Report * * @param Model\ReportCreateRequest $report_create_request report_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['reportCreate'] to see the possible values for this operation * * @return Model\ReportCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function reportCreate(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) + public function reportCreate(Model\ReportCreateRequest $report_create_request) { - list($response) = $this->reportCreateWithHttpInfo($report_create_request, $contentType); + list($response) = $this->reportCreateWithHttpInfo($report_create_request); return $response; } @@ -155,6 +154,7 @@ public function reportCreate(Model\ReportCreateRequest $report_create_request, s * @return array of Model\ReportCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::reportCreate. This method will eventually become unavailable */ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { @@ -290,6 +290,7 @@ public function reportCreateWithHttpInfo(Model\ReportCreateRequest $report_creat * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::reportCreate. This method will eventually become unavailable */ public function reportCreateAsync(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { @@ -311,6 +312,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::reportCreate. This method will eventually become unavailable */ public function reportCreateAsyncWithHttpInfo(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { @@ -361,6 +363,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::reportCreate. This method will eventually become unavailable */ public function reportCreateRequest(Model\ReportCreateRequest $report_create_request, string $contentType = self::contentTypes['reportCreate'][0]) { diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index 0c6c4ae65..e29a714ed 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -184,15 +184,14 @@ public function getResponse() * Embedded Bulk Send with Template * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request signature_request_bulk_create_embedded_with_template_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'] to see the possible values for this operation * * @return Model\BulkSendJobSendResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) + public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request) { - list($response) = $this->signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo($signature_request_bulk_create_embedded_with_template_request, $contentType); + list($response) = $this->signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo($signature_request_bulk_create_embedded_with_template_request); return $response; } @@ -207,6 +206,7 @@ public function signatureRequestBulkCreateEmbeddedWithTemplate(Model\SignatureRe * @return array of Model\BulkSendJobSendResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { @@ -342,6 +342,7 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateWithHttpInfo(Model * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkCreateEmbeddedWithTemplateAsync(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { @@ -363,6 +364,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { @@ -413,6 +415,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkCreateEmbeddedWithTemplate'][0]) { @@ -517,15 +520,14 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign * Bulk Send with Template * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request signature_request_bulk_send_with_template_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestBulkSendWithTemplate'] to see the possible values for this operation * * @return Model\BulkSendJobSendResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) + public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request) { - list($response) = $this->signatureRequestBulkSendWithTemplateWithHttpInfo($signature_request_bulk_send_with_template_request, $contentType); + list($response) = $this->signatureRequestBulkSendWithTemplateWithHttpInfo($signature_request_bulk_send_with_template_request); return $response; } @@ -540,6 +542,7 @@ public function signatureRequestBulkSendWithTemplate(Model\SignatureRequestBulkS * @return array of Model\BulkSendJobSendResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { @@ -675,6 +678,7 @@ public function signatureRequestBulkSendWithTemplateWithHttpInfo(Model\Signature * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkSendWithTemplateAsync(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { @@ -696,6 +700,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { @@ -746,6 +751,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestBulkSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request, string $contentType = self::contentTypes['signatureRequestBulkSendWithTemplate'][0]) { @@ -854,14 +860,13 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque * Cancel Incomplete Signature Request * * @param string $signature_request_id The id of the incomplete SignatureRequest to cancel. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCancel'] to see the possible values for this operation * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestCancel(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) + public function signatureRequestCancel(string $signature_request_id) { - $this->signatureRequestCancelWithHttpInfo($signature_request_id, $contentType); + $this->signatureRequestCancelWithHttpInfo($signature_request_id); } /** @@ -875,6 +880,7 @@ public function signatureRequestCancel(string $signature_request_id, string $con * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCancel. This method will eventually become unavailable */ public function signatureRequestCancelWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { @@ -937,6 +943,7 @@ public function signatureRequestCancelWithHttpInfo(string $signature_request_id, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCancel. This method will eventually become unavailable */ public function signatureRequestCancelAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { @@ -958,6 +965,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCancel. This method will eventually become unavailable */ public function signatureRequestCancelAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { @@ -995,6 +1003,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCancel. This method will eventually become unavailable */ public function signatureRequestCancelRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestCancel'][0]) { @@ -1095,15 +1104,14 @@ public function signatureRequestCancelRequest(string $signature_request_id, stri * Create Embedded Signature Request * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request signature_request_create_embedded_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbedded'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) + public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request) { - list($response) = $this->signatureRequestCreateEmbeddedWithHttpInfo($signature_request_create_embedded_request, $contentType); + list($response) = $this->signatureRequestCreateEmbeddedWithHttpInfo($signature_request_create_embedded_request); return $response; } @@ -1118,6 +1126,7 @@ public function signatureRequestCreateEmbedded(Model\SignatureRequestCreateEmbed * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbedded. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { @@ -1253,6 +1262,7 @@ public function signatureRequestCreateEmbeddedWithHttpInfo(Model\SignatureReques * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbedded. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedAsync(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { @@ -1274,6 +1284,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbedded. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { @@ -1324,6 +1335,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbedded. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request, string $contentType = self::contentTypes['signatureRequestCreateEmbedded'][0]) { @@ -1432,15 +1444,14 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea * Create Embedded Signature Request with Template * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request signature_request_create_embedded_with_template_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) + public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request) { - list($response) = $this->signatureRequestCreateEmbeddedWithTemplateWithHttpInfo($signature_request_create_embedded_with_template_request, $contentType); + list($response) = $this->signatureRequestCreateEmbeddedWithTemplateWithHttpInfo($signature_request_create_embedded_with_template_request); return $response; } @@ -1455,6 +1466,7 @@ public function signatureRequestCreateEmbeddedWithTemplate(Model\SignatureReques * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { @@ -1590,6 +1602,7 @@ public function signatureRequestCreateEmbeddedWithTemplateWithHttpInfo(Model\Sig * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedWithTemplateAsync(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { @@ -1611,6 +1624,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { @@ -1661,6 +1675,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request, string $contentType = self::contentTypes['signatureRequestCreateEmbeddedWithTemplate'][0]) { @@ -1770,15 +1785,14 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFiles'] to see the possible values for this operation * * @return SplFileObject|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestFiles(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) + public function signatureRequestFiles(string $signature_request_id, string $file_type = 'pdf') { - list($response) = $this->signatureRequestFilesWithHttpInfo($signature_request_id, $file_type, $contentType); + list($response) = $this->signatureRequestFilesWithHttpInfo($signature_request_id, $file_type); return $response; } @@ -1794,6 +1808,7 @@ public function signatureRequestFiles(string $signature_request_id, string $file * @return array of \SplFileObject|\Dropbox\Sign\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFiles. This method will eventually become unavailable */ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { @@ -1930,6 +1945,7 @@ public function signatureRequestFilesWithHttpInfo(string $signature_request_id, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFiles. This method will eventually become unavailable */ public function signatureRequestFilesAsync(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { @@ -1952,6 +1968,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFiles. This method will eventually become unavailable */ public function signatureRequestFilesAsyncWithHttpInfo(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { @@ -2003,6 +2020,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFiles. This method will eventually become unavailable */ public function signatureRequestFilesRequest(string $signature_request_id, string $file_type = 'pdf', string $contentType = self::contentTypes['signatureRequestFiles'][0]) { @@ -2113,15 +2131,14 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin * Download Files as Data Uri * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsDataUri'] to see the possible values for this operation * * @return Model\FileResponseDataUri|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestFilesAsDataUri(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) + public function signatureRequestFilesAsDataUri(string $signature_request_id) { - list($response) = $this->signatureRequestFilesAsDataUriWithHttpInfo($signature_request_id, $contentType); + list($response) = $this->signatureRequestFilesAsDataUriWithHttpInfo($signature_request_id); return $response; } @@ -2136,6 +2153,7 @@ public function signatureRequestFilesAsDataUri(string $signature_request_id, str * @return array of Model\FileResponseDataUri, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsDataUri. This method will eventually become unavailable */ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { @@ -2271,6 +2289,7 @@ public function signatureRequestFilesAsDataUriWithHttpInfo(string $signature_req * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsDataUri. This method will eventually become unavailable */ public function signatureRequestFilesAsDataUriAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { @@ -2292,6 +2311,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsDataUri. This method will eventually become unavailable */ public function signatureRequestFilesAsDataUriAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { @@ -2342,6 +2362,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsDataUri. This method will eventually become unavailable */ public function signatureRequestFilesAsDataUriRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestFilesAsDataUri'][0]) { @@ -2443,15 +2464,14 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestFilesAsFileUrl'] to see the possible values for this operation * * @return Model\FileResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestFilesAsFileUrl(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) + public function signatureRequestFilesAsFileUrl(string $signature_request_id, int $force_download = 1) { - list($response) = $this->signatureRequestFilesAsFileUrlWithHttpInfo($signature_request_id, $force_download, $contentType); + list($response) = $this->signatureRequestFilesAsFileUrlWithHttpInfo($signature_request_id, $force_download); return $response; } @@ -2467,6 +2487,7 @@ public function signatureRequestFilesAsFileUrl(string $signature_request_id, int * @return array of Model\FileResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsFileUrl. This method will eventually become unavailable */ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { @@ -2603,6 +2624,7 @@ public function signatureRequestFilesAsFileUrlWithHttpInfo(string $signature_req * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsFileUrl. This method will eventually become unavailable */ public function signatureRequestFilesAsFileUrlAsync(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { @@ -2625,6 +2647,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsFileUrl. This method will eventually become unavailable */ public function signatureRequestFilesAsFileUrlAsyncWithHttpInfo(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { @@ -2676,6 +2699,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestFilesAsFileUrl. This method will eventually become unavailable */ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_id, int $force_download = 1, string $contentType = self::contentTypes['signatureRequestFilesAsFileUrl'][0]) { @@ -2786,15 +2810,14 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ * Get Signature Request * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestGet'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestGet(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) + public function signatureRequestGet(string $signature_request_id) { - list($response) = $this->signatureRequestGetWithHttpInfo($signature_request_id, $contentType); + list($response) = $this->signatureRequestGetWithHttpInfo($signature_request_id); return $response; } @@ -2809,6 +2832,7 @@ public function signatureRequestGet(string $signature_request_id, string $conten * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestGet. This method will eventually become unavailable */ public function signatureRequestGetWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { @@ -2944,6 +2968,7 @@ public function signatureRequestGetWithHttpInfo(string $signature_request_id, st * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestGet. This method will eventually become unavailable */ public function signatureRequestGetAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { @@ -2965,6 +2990,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestGet. This method will eventually become unavailable */ public function signatureRequestGetAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { @@ -3015,6 +3041,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestGet. This method will eventually become unavailable */ public function signatureRequestGetRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestGet'][0]) { @@ -3114,19 +3141,18 @@ public function signatureRequestGetRequest(string $signature_request_id, string * * List Signature Requests * - * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestList'] to see the possible values for this operation + * @param string $account_id Which account to return SignatureRequests for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the SignatureRequest List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) * * @return Model\SignatureRequestListResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) + public function signatureRequestList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) { - list($response) = $this->signatureRequestListWithHttpInfo($account_id, $page, $page_size, $query, $contentType); + list($response) = $this->signatureRequestListWithHttpInfo($account_id, $page, $page_size, $query); return $response; } @@ -3144,6 +3170,7 @@ public function signatureRequestList(string $account_id = null, int $page = 1, i * @return array of Model\SignatureRequestListResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestList. This method will eventually become unavailable */ public function signatureRequestListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { @@ -3282,6 +3309,7 @@ public function signatureRequestListWithHttpInfo(string $account_id = null, int * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestList. This method will eventually become unavailable */ public function signatureRequestListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { @@ -3306,6 +3334,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestList. This method will eventually become unavailable */ public function signatureRequestListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { @@ -3359,6 +3388,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestList. This method will eventually become unavailable */ public function signatureRequestListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['signatureRequestList'][0]) { @@ -3480,15 +3510,14 @@ public function signatureRequestListRequest(string $account_id = null, int $page * Release On-Hold Signature Request * * @param string $signature_request_id The id of the SignatureRequest to release. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestReleaseHold'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestReleaseHold(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) + public function signatureRequestReleaseHold(string $signature_request_id) { - list($response) = $this->signatureRequestReleaseHoldWithHttpInfo($signature_request_id, $contentType); + list($response) = $this->signatureRequestReleaseHoldWithHttpInfo($signature_request_id); return $response; } @@ -3503,6 +3532,7 @@ public function signatureRequestReleaseHold(string $signature_request_id, string * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestReleaseHold. This method will eventually become unavailable */ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { @@ -3638,6 +3668,7 @@ public function signatureRequestReleaseHoldWithHttpInfo(string $signature_reques * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestReleaseHold. This method will eventually become unavailable */ public function signatureRequestReleaseHoldAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { @@ -3659,6 +3690,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestReleaseHold. This method will eventually become unavailable */ public function signatureRequestReleaseHoldAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { @@ -3709,6 +3741,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestReleaseHold. This method will eventually become unavailable */ public function signatureRequestReleaseHoldRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestReleaseHold'][0]) { @@ -3810,15 +3843,14 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id, * * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request signature_request_remind_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemind'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestRemind(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) + public function signatureRequestRemind(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request) { - list($response) = $this->signatureRequestRemindWithHttpInfo($signature_request_id, $signature_request_remind_request, $contentType); + list($response) = $this->signatureRequestRemindWithHttpInfo($signature_request_id, $signature_request_remind_request); return $response; } @@ -3834,6 +3866,7 @@ public function signatureRequestRemind(string $signature_request_id, Model\Signa * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemind. This method will eventually become unavailable */ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { @@ -3970,6 +4003,7 @@ public function signatureRequestRemindWithHttpInfo(string $signature_request_id, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemind. This method will eventually become unavailable */ public function signatureRequestRemindAsync(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { @@ -3992,6 +4026,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemind. This method will eventually become unavailable */ public function signatureRequestRemindAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { @@ -4043,6 +4078,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemind. This method will eventually become unavailable */ public function signatureRequestRemindRequest(string $signature_request_id, Model\SignatureRequestRemindRequest $signature_request_remind_request, string $contentType = self::contentTypes['signatureRequestRemind'][0]) { @@ -4167,14 +4203,13 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode * Remove Signature Request Access * * @param string $signature_request_id The id of the SignatureRequest to remove. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestRemove'] to see the possible values for this operation * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestRemove(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) + public function signatureRequestRemove(string $signature_request_id) { - $this->signatureRequestRemoveWithHttpInfo($signature_request_id, $contentType); + $this->signatureRequestRemoveWithHttpInfo($signature_request_id); } /** @@ -4188,6 +4223,7 @@ public function signatureRequestRemove(string $signature_request_id, string $con * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemove. This method will eventually become unavailable */ public function signatureRequestRemoveWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { @@ -4250,6 +4286,7 @@ public function signatureRequestRemoveWithHttpInfo(string $signature_request_id, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemove. This method will eventually become unavailable */ public function signatureRequestRemoveAsync(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { @@ -4271,6 +4308,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemove. This method will eventually become unavailable */ public function signatureRequestRemoveAsyncWithHttpInfo(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { @@ -4308,6 +4346,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestRemove. This method will eventually become unavailable */ public function signatureRequestRemoveRequest(string $signature_request_id, string $contentType = self::contentTypes['signatureRequestRemove'][0]) { @@ -4404,15 +4443,14 @@ public function signatureRequestRemoveRequest(string $signature_request_id, stri * Send Signature Request * * @param Model\SignatureRequestSendRequest $signature_request_send_request signature_request_send_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSend'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestSend(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) + public function signatureRequestSend(Model\SignatureRequestSendRequest $signature_request_send_request) { - list($response) = $this->signatureRequestSendWithHttpInfo($signature_request_send_request, $contentType); + list($response) = $this->signatureRequestSendWithHttpInfo($signature_request_send_request); return $response; } @@ -4427,6 +4465,7 @@ public function signatureRequestSend(Model\SignatureRequestSendRequest $signatur * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSend. This method will eventually become unavailable */ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { @@ -4562,6 +4601,7 @@ public function signatureRequestSendWithHttpInfo(Model\SignatureRequestSendReque * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSend. This method will eventually become unavailable */ public function signatureRequestSendAsync(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { @@ -4583,6 +4623,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSend. This method will eventually become unavailable */ public function signatureRequestSendAsyncWithHttpInfo(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { @@ -4633,6 +4674,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSend. This method will eventually become unavailable */ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $signature_request_send_request, string $contentType = self::contentTypes['signatureRequestSend'][0]) { @@ -4741,15 +4783,14 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s * Send with Template * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request signature_request_send_with_template_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestSendWithTemplate'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) + public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request) { - list($response) = $this->signatureRequestSendWithTemplateWithHttpInfo($signature_request_send_with_template_request, $contentType); + list($response) = $this->signatureRequestSendWithTemplateWithHttpInfo($signature_request_send_with_template_request); return $response; } @@ -4764,6 +4805,7 @@ public function signatureRequestSendWithTemplate(Model\SignatureRequestSendWithT * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { @@ -4899,6 +4941,7 @@ public function signatureRequestSendWithTemplateWithHttpInfo(Model\SignatureRequ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestSendWithTemplateAsync(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { @@ -4920,6 +4963,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestSendWithTemplateAsyncWithHttpInfo(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { @@ -4970,6 +5014,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestSendWithTemplate. This method will eventually become unavailable */ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request, string $contentType = self::contentTypes['signatureRequestSendWithTemplate'][0]) { @@ -5079,15 +5124,14 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe * * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request signature_request_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['signatureRequestUpdate'] to see the possible values for this operation * * @return Model\SignatureRequestGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function signatureRequestUpdate(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) + public function signatureRequestUpdate(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request) { - list($response) = $this->signatureRequestUpdateWithHttpInfo($signature_request_id, $signature_request_update_request, $contentType); + list($response) = $this->signatureRequestUpdateWithHttpInfo($signature_request_id, $signature_request_update_request); return $response; } @@ -5103,6 +5147,7 @@ public function signatureRequestUpdate(string $signature_request_id, Model\Signa * @return array of Model\SignatureRequestGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestUpdate. This method will eventually become unavailable */ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { @@ -5239,6 +5284,7 @@ public function signatureRequestUpdateWithHttpInfo(string $signature_request_id, * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestUpdate. This method will eventually become unavailable */ public function signatureRequestUpdateAsync(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { @@ -5261,6 +5307,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestUpdate. This method will eventually become unavailable */ public function signatureRequestUpdateAsyncWithHttpInfo(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { @@ -5312,6 +5359,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::signatureRequestUpdate. This method will eventually become unavailable */ public function signatureRequestUpdateRequest(string $signature_request_id, Model\SignatureRequestUpdateRequest $signature_request_update_request, string $contentType = self::contentTypes['signatureRequestUpdate'][0]) { diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 77aadc4a8..37dbdc8ea 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -160,15 +160,14 @@ public function getResponse() * * @param Model\TeamAddMemberRequest $team_add_member_request team_add_member_request (required) * @param string $team_id The id of the team. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamAddMember'] to see the possible values for this operation * * @return Model\TeamGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) + public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null) { - list($response) = $this->teamAddMemberWithHttpInfo($team_add_member_request, $team_id, $contentType); + list($response) = $this->teamAddMemberWithHttpInfo($team_add_member_request, $team_id); return $response; } @@ -184,6 +183,7 @@ public function teamAddMember(Model\TeamAddMemberRequest $team_add_member_reques * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamAddMember. This method will eventually become unavailable */ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { @@ -320,6 +320,7 @@ public function teamAddMemberWithHttpInfo(Model\TeamAddMemberRequest $team_add_m * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamAddMember. This method will eventually become unavailable */ public function teamAddMemberAsync(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { @@ -342,6 +343,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamAddMember. This method will eventually become unavailable */ public function teamAddMemberAsyncWithHttpInfo(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { @@ -393,6 +395,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamAddMember. This method will eventually become unavailable */ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member_request, string $team_id = null, string $contentType = self::contentTypes['teamAddMember'][0]) { @@ -511,15 +514,14 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member * Create Team * * @param Model\TeamCreateRequest $team_create_request team_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamCreate'] to see the possible values for this operation * * @return Model\TeamGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamCreate(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) + public function teamCreate(Model\TeamCreateRequest $team_create_request) { - list($response) = $this->teamCreateWithHttpInfo($team_create_request, $contentType); + list($response) = $this->teamCreateWithHttpInfo($team_create_request); return $response; } @@ -534,6 +536,7 @@ public function teamCreate(Model\TeamCreateRequest $team_create_request, string * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamCreate. This method will eventually become unavailable */ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { @@ -669,6 +672,7 @@ public function teamCreateWithHttpInfo(Model\TeamCreateRequest $team_create_requ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamCreate. This method will eventually become unavailable */ public function teamCreateAsync(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { @@ -690,6 +694,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamCreate. This method will eventually become unavailable */ public function teamCreateAsyncWithHttpInfo(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { @@ -740,6 +745,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamCreate. This method will eventually become unavailable */ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, string $contentType = self::contentTypes['teamCreate'][0]) { @@ -847,14 +853,12 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, * * Delete Team * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamDelete'] to see the possible values for this operation - * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamDelete(string $contentType = self::contentTypes['teamDelete'][0]) + public function teamDelete() { - $this->teamDeleteWithHttpInfo($contentType); + $this->teamDeleteWithHttpInfo(); } /** @@ -867,6 +871,7 @@ public function teamDelete(string $contentType = self::contentTypes['teamDelete' * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamDelete. This method will eventually become unavailable */ public function teamDeleteWithHttpInfo(string $contentType = self::contentTypes['teamDelete'][0]) { @@ -928,6 +933,7 @@ public function teamDeleteWithHttpInfo(string $contentType = self::contentTypes[ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamDelete. This method will eventually become unavailable */ public function teamDeleteAsync(string $contentType = self::contentTypes['teamDelete'][0]) { @@ -948,6 +954,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamDelete. This method will eventually become unavailable */ public function teamDeleteAsyncWithHttpInfo(string $contentType = self::contentTypes['teamDelete'][0]) { @@ -984,6 +991,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamDelete. This method will eventually become unavailable */ public function teamDeleteRequest(string $contentType = self::contentTypes['teamDelete'][0]) { @@ -1067,15 +1075,13 @@ public function teamDeleteRequest(string $contentType = self::contentTypes['team * * Get Team * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamGet'] to see the possible values for this operation - * * @return Model\TeamGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamGet(string $contentType = self::contentTypes['teamGet'][0]) + public function teamGet() { - list($response) = $this->teamGetWithHttpInfo($contentType); + list($response) = $this->teamGetWithHttpInfo(); return $response; } @@ -1089,6 +1095,7 @@ public function teamGet(string $contentType = self::contentTypes['teamGet'][0]) * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamGet. This method will eventually become unavailable */ public function teamGetWithHttpInfo(string $contentType = self::contentTypes['teamGet'][0]) { @@ -1223,6 +1230,7 @@ public function teamGetWithHttpInfo(string $contentType = self::contentTypes['te * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamGet. This method will eventually become unavailable */ public function teamGetAsync(string $contentType = self::contentTypes['teamGet'][0]) { @@ -1243,6 +1251,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamGet. This method will eventually become unavailable */ public function teamGetAsyncWithHttpInfo(string $contentType = self::contentTypes['teamGet'][0]) { @@ -1292,6 +1301,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamGet. This method will eventually become unavailable */ public function teamGetRequest(string $contentType = self::contentTypes['teamGet'][0]) { @@ -1375,16 +1385,15 @@ public function teamGetRequest(string $contentType = self::contentTypes['teamGet * * Get Team Info * - * @param string $team_id The id of the team. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInfo'] to see the possible values for this operation + * @param string $team_id The id of the team. (optional) * * @return Model\TeamGetInfoResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) + public function teamInfo(string $team_id = null) { - list($response) = $this->teamInfoWithHttpInfo($team_id, $contentType); + list($response) = $this->teamInfoWithHttpInfo($team_id); return $response; } @@ -1399,6 +1408,7 @@ public function teamInfo(string $team_id = null, string $contentType = self::con * @return array of Model\TeamGetInfoResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInfo. This method will eventually become unavailable */ public function teamInfoWithHttpInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { @@ -1534,6 +1544,7 @@ public function teamInfoWithHttpInfo(string $team_id = null, string $contentType * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInfo. This method will eventually become unavailable */ public function teamInfoAsync(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { @@ -1555,6 +1566,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInfo. This method will eventually become unavailable */ public function teamInfoAsyncWithHttpInfo(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { @@ -1605,6 +1617,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInfo. This method will eventually become unavailable */ public function teamInfoRequest(string $team_id = null, string $contentType = self::contentTypes['teamInfo'][0]) { @@ -1699,15 +1712,14 @@ public function teamInfoRequest(string $team_id = null, string $contentType = se * List Team Invites * * @param string $email_address The email address for which to display the team invites. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamInvites'] to see the possible values for this operation * * @return Model\TeamInvitesResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamInvites(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) + public function teamInvites(string $email_address = null) { - list($response) = $this->teamInvitesWithHttpInfo($email_address, $contentType); + list($response) = $this->teamInvitesWithHttpInfo($email_address); return $response; } @@ -1722,6 +1734,7 @@ public function teamInvites(string $email_address = null, string $contentType = * @return array of Model\TeamInvitesResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInvites. This method will eventually become unavailable */ public function teamInvitesWithHttpInfo(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { @@ -1857,6 +1870,7 @@ public function teamInvitesWithHttpInfo(string $email_address = null, string $co * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInvites. This method will eventually become unavailable */ public function teamInvitesAsync(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { @@ -1878,6 +1892,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInvites. This method will eventually become unavailable */ public function teamInvitesAsyncWithHttpInfo(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { @@ -1928,6 +1943,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamInvites. This method will eventually become unavailable */ public function teamInvitesRequest(string $email_address = null, string $contentType = self::contentTypes['teamInvites'][0]) { @@ -2021,18 +2037,17 @@ public function teamInvitesRequest(string $email_address = null, string $content * * List Team Members * - * @param string $team_id The id of the team that a member list is being requested from. (required) - * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamMembers'] to see the possible values for this operation + * @param string $team_id The id of the team that a member list is being requested from. (required) + * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * * @return Model\TeamMembersResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamMembers(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) + public function teamMembers(string $team_id, int $page = 1, int $page_size = 20) { - list($response) = $this->teamMembersWithHttpInfo($team_id, $page, $page_size, $contentType); + list($response) = $this->teamMembersWithHttpInfo($team_id, $page, $page_size); return $response; } @@ -2049,6 +2064,7 @@ public function teamMembers(string $team_id, int $page = 1, int $page_size = 20, * @return array of Model\TeamMembersResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamMembers. This method will eventually become unavailable */ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { @@ -2186,6 +2202,7 @@ public function teamMembersWithHttpInfo(string $team_id, int $page = 1, int $pag * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamMembers. This method will eventually become unavailable */ public function teamMembersAsync(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { @@ -2209,6 +2226,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamMembers. This method will eventually become unavailable */ public function teamMembersAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { @@ -2261,6 +2279,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamMembers. This method will eventually become unavailable */ public function teamMembersRequest(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamMembers'][0]) { @@ -2387,15 +2406,14 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz * Remove User from Team * * @param Model\TeamRemoveMemberRequest $team_remove_member_request team_remove_member_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamRemoveMember'] to see the possible values for this operation * * @return Model\TeamGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) + public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_member_request) { - list($response) = $this->teamRemoveMemberWithHttpInfo($team_remove_member_request, $contentType); + list($response) = $this->teamRemoveMemberWithHttpInfo($team_remove_member_request); return $response; } @@ -2410,6 +2428,7 @@ public function teamRemoveMember(Model\TeamRemoveMemberRequest $team_remove_memb * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamRemoveMember. This method will eventually become unavailable */ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { @@ -2545,6 +2564,7 @@ public function teamRemoveMemberWithHttpInfo(Model\TeamRemoveMemberRequest $team * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamRemoveMember. This method will eventually become unavailable */ public function teamRemoveMemberAsync(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { @@ -2566,6 +2586,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamRemoveMember. This method will eventually become unavailable */ public function teamRemoveMemberAsyncWithHttpInfo(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { @@ -2616,6 +2637,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamRemoveMember. This method will eventually become unavailable */ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remove_member_request, string $contentType = self::contentTypes['teamRemoveMember'][0]) { @@ -2723,18 +2745,17 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo * * List Sub Teams * - * @param string $team_id The id of the parent Team. (required) - * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamSubTeams'] to see the possible values for this operation + * @param string $team_id The id of the parent Team. (required) + * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * * @return Model\TeamSubTeamsResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) + public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20) { - list($response) = $this->teamSubTeamsWithHttpInfo($team_id, $page, $page_size, $contentType); + list($response) = $this->teamSubTeamsWithHttpInfo($team_id, $page, $page_size); return $response; } @@ -2751,6 +2772,7 @@ public function teamSubTeams(string $team_id, int $page = 1, int $page_size = 20 * @return array of Model\TeamSubTeamsResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamSubTeams. This method will eventually become unavailable */ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { @@ -2888,6 +2910,7 @@ public function teamSubTeamsWithHttpInfo(string $team_id, int $page = 1, int $pa * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamSubTeams. This method will eventually become unavailable */ public function teamSubTeamsAsync(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { @@ -2911,6 +2934,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamSubTeams. This method will eventually become unavailable */ public function teamSubTeamsAsyncWithHttpInfo(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { @@ -2963,6 +2987,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamSubTeams. This method will eventually become unavailable */ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_size = 20, string $contentType = self::contentTypes['teamSubTeams'][0]) { @@ -3089,15 +3114,14 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si * Update Team * * @param Model\TeamUpdateRequest $team_update_request team_update_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['teamUpdate'] to see the possible values for this operation * * @return Model\TeamGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function teamUpdate(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) + public function teamUpdate(Model\TeamUpdateRequest $team_update_request) { - list($response) = $this->teamUpdateWithHttpInfo($team_update_request, $contentType); + list($response) = $this->teamUpdateWithHttpInfo($team_update_request); return $response; } @@ -3112,6 +3136,7 @@ public function teamUpdate(Model\TeamUpdateRequest $team_update_request, string * @return array of Model\TeamGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamUpdate. This method will eventually become unavailable */ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { @@ -3247,6 +3272,7 @@ public function teamUpdateWithHttpInfo(Model\TeamUpdateRequest $team_update_requ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamUpdate. This method will eventually become unavailable */ public function teamUpdateAsync(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { @@ -3268,6 +3294,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamUpdate. This method will eventually become unavailable */ public function teamUpdateAsyncWithHttpInfo(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { @@ -3318,6 +3345,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::teamUpdate. This method will eventually become unavailable */ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, string $contentType = self::contentTypes['teamUpdate'][0]) { diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 6ac5266a0..38559e98c 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -167,15 +167,14 @@ public function getResponse() * * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request template_add_user_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateAddUser'] to see the possible values for this operation * * @return Model\TemplateGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateAddUser(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) + public function templateAddUser(string $template_id, Model\TemplateAddUserRequest $template_add_user_request) { - list($response) = $this->templateAddUserWithHttpInfo($template_id, $template_add_user_request, $contentType); + list($response) = $this->templateAddUserWithHttpInfo($template_id, $template_add_user_request); return $response; } @@ -191,6 +190,7 @@ public function templateAddUser(string $template_id, Model\TemplateAddUserReques * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateAddUser. This method will eventually become unavailable */ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { @@ -327,6 +327,7 @@ public function templateAddUserWithHttpInfo(string $template_id, Model\TemplateA * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateAddUser. This method will eventually become unavailable */ public function templateAddUserAsync(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { @@ -349,6 +350,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateAddUser. This method will eventually become unavailable */ public function templateAddUserAsyncWithHttpInfo(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { @@ -400,6 +402,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateAddUser. This method will eventually become unavailable */ public function templateAddUserRequest(string $template_id, Model\TemplateAddUserRequest $template_add_user_request, string $contentType = self::contentTypes['templateAddUser'][0]) { @@ -524,15 +527,14 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse * Create Template * * @param Model\TemplateCreateRequest $template_create_request template_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreate'] to see the possible values for this operation * * @return Model\TemplateCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateCreate(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) + public function templateCreate(Model\TemplateCreateRequest $template_create_request) { - list($response) = $this->templateCreateWithHttpInfo($template_create_request, $contentType); + list($response) = $this->templateCreateWithHttpInfo($template_create_request); return $response; } @@ -547,6 +549,7 @@ public function templateCreate(Model\TemplateCreateRequest $template_create_requ * @return array of Model\TemplateCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreate. This method will eventually become unavailable */ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { @@ -682,6 +685,7 @@ public function templateCreateWithHttpInfo(Model\TemplateCreateRequest $template * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreate. This method will eventually become unavailable */ public function templateCreateAsync(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { @@ -703,6 +707,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreate. This method will eventually become unavailable */ public function templateCreateAsyncWithHttpInfo(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { @@ -753,6 +758,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreate. This method will eventually become unavailable */ public function templateCreateRequest(Model\TemplateCreateRequest $template_create_request, string $contentType = self::contentTypes['templateCreate'][0]) { @@ -861,15 +867,14 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea * Create Embedded Template Draft * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request template_create_embedded_draft_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateCreateEmbeddedDraft'] to see the possible values for this operation * * @return Model\TemplateCreateEmbeddedDraftResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) + public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request) { - list($response) = $this->templateCreateEmbeddedDraftWithHttpInfo($template_create_embedded_draft_request, $contentType); + list($response) = $this->templateCreateEmbeddedDraftWithHttpInfo($template_create_embedded_draft_request); return $response; } @@ -884,6 +889,7 @@ public function templateCreateEmbeddedDraft(Model\TemplateCreateEmbeddedDraftReq * @return array of Model\TemplateCreateEmbeddedDraftResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreateEmbeddedDraft. This method will eventually become unavailable */ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { @@ -1019,6 +1025,7 @@ public function templateCreateEmbeddedDraftWithHttpInfo(Model\TemplateCreateEmbe * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreateEmbeddedDraft. This method will eventually become unavailable */ public function templateCreateEmbeddedDraftAsync(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { @@ -1040,6 +1047,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreateEmbeddedDraft. This method will eventually become unavailable */ public function templateCreateEmbeddedDraftAsyncWithHttpInfo(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { @@ -1090,6 +1098,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateCreateEmbeddedDraft. This method will eventually become unavailable */ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request, string $contentType = self::contentTypes['templateCreateEmbeddedDraft'][0]) { @@ -1198,14 +1207,13 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD * Delete Template * * @param string $template_id The id of the Template to delete. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateDelete'] to see the possible values for this operation * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateDelete(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) + public function templateDelete(string $template_id) { - $this->templateDeleteWithHttpInfo($template_id, $contentType); + $this->templateDeleteWithHttpInfo($template_id); } /** @@ -1219,6 +1227,7 @@ public function templateDelete(string $template_id, string $contentType = self:: * @return array of null, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateDelete. This method will eventually become unavailable */ public function templateDeleteWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { @@ -1281,6 +1290,7 @@ public function templateDeleteWithHttpInfo(string $template_id, string $contentT * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateDelete. This method will eventually become unavailable */ public function templateDeleteAsync(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { @@ -1302,6 +1312,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateDelete. This method will eventually become unavailable */ public function templateDeleteAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { @@ -1339,6 +1350,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateDelete. This method will eventually become unavailable */ public function templateDeleteRequest(string $template_id, string $contentType = self::contentTypes['templateDelete'][0]) { @@ -1440,15 +1452,14 @@ public function templateDeleteRequest(string $template_id, string $contentType = * * @param string $template_id The id of the template files to retrieve. (required) * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFiles'] to see the possible values for this operation * * @return SplFileObject|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateFiles(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) + public function templateFiles(string $template_id, string $file_type = null) { - list($response) = $this->templateFilesWithHttpInfo($template_id, $file_type, $contentType); + list($response) = $this->templateFilesWithHttpInfo($template_id, $file_type); return $response; } @@ -1464,6 +1475,7 @@ public function templateFiles(string $template_id, string $file_type = null, str * @return array of \SplFileObject|\Dropbox\Sign\Model\ErrorResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFiles. This method will eventually become unavailable */ public function templateFilesWithHttpInfo(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { @@ -1600,6 +1612,7 @@ public function templateFilesWithHttpInfo(string $template_id, string $file_type * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFiles. This method will eventually become unavailable */ public function templateFilesAsync(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { @@ -1622,6 +1635,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFiles. This method will eventually become unavailable */ public function templateFilesAsyncWithHttpInfo(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { @@ -1673,6 +1687,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFiles. This method will eventually become unavailable */ public function templateFilesRequest(string $template_id, string $file_type = null, string $contentType = self::contentTypes['templateFiles'][0]) { @@ -1783,15 +1798,14 @@ public function templateFilesRequest(string $template_id, string $file_type = nu * Get Template Files as Data Uri * * @param string $template_id The id of the template files to retrieve. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsDataUri'] to see the possible values for this operation * * @return Model\FileResponseDataUri|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateFilesAsDataUri(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) + public function templateFilesAsDataUri(string $template_id) { - list($response) = $this->templateFilesAsDataUriWithHttpInfo($template_id, $contentType); + list($response) = $this->templateFilesAsDataUriWithHttpInfo($template_id); return $response; } @@ -1806,6 +1820,7 @@ public function templateFilesAsDataUri(string $template_id, string $contentType * @return array of Model\FileResponseDataUri, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsDataUri. This method will eventually become unavailable */ public function templateFilesAsDataUriWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { @@ -1941,6 +1956,7 @@ public function templateFilesAsDataUriWithHttpInfo(string $template_id, string $ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsDataUri. This method will eventually become unavailable */ public function templateFilesAsDataUriAsync(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { @@ -1962,6 +1978,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsDataUri. This method will eventually become unavailable */ public function templateFilesAsDataUriAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { @@ -2012,6 +2029,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsDataUri. This method will eventually become unavailable */ public function templateFilesAsDataUriRequest(string $template_id, string $contentType = self::contentTypes['templateFilesAsDataUri'][0]) { @@ -2113,15 +2131,14 @@ public function templateFilesAsDataUriRequest(string $template_id, string $conte * * @param string $template_id The id of the template files to retrieve. (required) * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateFilesAsFileUrl'] to see the possible values for this operation * * @return Model\FileResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateFilesAsFileUrl(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) + public function templateFilesAsFileUrl(string $template_id, int $force_download = 1) { - list($response) = $this->templateFilesAsFileUrlWithHttpInfo($template_id, $force_download, $contentType); + list($response) = $this->templateFilesAsFileUrlWithHttpInfo($template_id, $force_download); return $response; } @@ -2137,6 +2154,7 @@ public function templateFilesAsFileUrl(string $template_id, int $force_download * @return array of Model\FileResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsFileUrl. This method will eventually become unavailable */ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { @@ -2273,6 +2291,7 @@ public function templateFilesAsFileUrlWithHttpInfo(string $template_id, int $for * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsFileUrl. This method will eventually become unavailable */ public function templateFilesAsFileUrlAsync(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { @@ -2295,6 +2314,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsFileUrl. This method will eventually become unavailable */ public function templateFilesAsFileUrlAsyncWithHttpInfo(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { @@ -2346,6 +2366,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateFilesAsFileUrl. This method will eventually become unavailable */ public function templateFilesAsFileUrlRequest(string $template_id, int $force_download = 1, string $contentType = self::contentTypes['templateFilesAsFileUrl'][0]) { @@ -2456,15 +2477,14 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do * Get Template * * @param string $template_id The id of the Template to retrieve. (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateGet'] to see the possible values for this operation * * @return Model\TemplateGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateGet(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) + public function templateGet(string $template_id) { - list($response) = $this->templateGetWithHttpInfo($template_id, $contentType); + list($response) = $this->templateGetWithHttpInfo($template_id); return $response; } @@ -2479,6 +2499,7 @@ public function templateGet(string $template_id, string $contentType = self::con * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateGet. This method will eventually become unavailable */ public function templateGetWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { @@ -2614,6 +2635,7 @@ public function templateGetWithHttpInfo(string $template_id, string $contentType * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateGet. This method will eventually become unavailable */ public function templateGetAsync(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { @@ -2635,6 +2657,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateGet. This method will eventually become unavailable */ public function templateGetAsyncWithHttpInfo(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { @@ -2685,6 +2708,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateGet. This method will eventually become unavailable */ public function templateGetRequest(string $template_id, string $contentType = self::contentTypes['templateGet'][0]) { @@ -2784,19 +2808,18 @@ public function templateGetRequest(string $template_id, string $contentType = se * * List Templates * - * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) - * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) - * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) - * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateList'] to see the possible values for this operation + * @param string $account_id Which account to return Templates for. Must be a team member. Use `all` to indicate all team members. Defaults to your account. (optional) + * @param int $page Which page number of the Template List to return. Defaults to `1`. (optional, default to 1) + * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) + * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) * * @return Model\TemplateListResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) + public function templateList(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null) { - list($response) = $this->templateListWithHttpInfo($account_id, $page, $page_size, $query, $contentType); + list($response) = $this->templateListWithHttpInfo($account_id, $page, $page_size, $query); return $response; } @@ -2814,6 +2837,7 @@ public function templateList(string $account_id = null, int $page = 1, int $page * @return array of Model\TemplateListResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateList. This method will eventually become unavailable */ public function templateListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { @@ -2952,6 +2976,7 @@ public function templateListWithHttpInfo(string $account_id = null, int $page = * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateList. This method will eventually become unavailable */ public function templateListAsync(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { @@ -2976,6 +3001,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateList. This method will eventually become unavailable */ public function templateListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { @@ -3029,6 +3055,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateList. This method will eventually become unavailable */ public function templateListRequest(string $account_id = null, int $page = 1, int $page_size = 20, string $query = null, string $contentType = self::contentTypes['templateList'][0]) { @@ -3158,15 +3185,14 @@ public function templateListRequest(string $account_id = null, int $page = 1, in * * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request template_remove_user_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateRemoveUser'] to see the possible values for this operation * * @return Model\TemplateGetResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateRemoveUser(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) + public function templateRemoveUser(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request) { - list($response) = $this->templateRemoveUserWithHttpInfo($template_id, $template_remove_user_request, $contentType); + list($response) = $this->templateRemoveUserWithHttpInfo($template_id, $template_remove_user_request); return $response; } @@ -3182,6 +3208,7 @@ public function templateRemoveUser(string $template_id, Model\TemplateRemoveUser * @return array of Model\TemplateGetResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateRemoveUser. This method will eventually become unavailable */ public function templateRemoveUserWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { @@ -3318,6 +3345,7 @@ public function templateRemoveUserWithHttpInfo(string $template_id, Model\Templa * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateRemoveUser. This method will eventually become unavailable */ public function templateRemoveUserAsync(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { @@ -3340,6 +3368,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateRemoveUser. This method will eventually become unavailable */ public function templateRemoveUserAsyncWithHttpInfo(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { @@ -3391,6 +3420,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateRemoveUser. This method will eventually become unavailable */ public function templateRemoveUserRequest(string $template_id, Model\TemplateRemoveUserRequest $template_remove_user_request, string $contentType = self::contentTypes['templateRemoveUser'][0]) { @@ -3516,15 +3546,14 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem * * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request template_update_files_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['templateUpdateFiles'] to see the possible values for this operation * * @return Model\TemplateUpdateFilesResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) + public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request) { - list($response) = $this->templateUpdateFilesWithHttpInfo($template_id, $template_update_files_request, $contentType); + list($response) = $this->templateUpdateFilesWithHttpInfo($template_id, $template_update_files_request); return $response; } @@ -3540,6 +3569,7 @@ public function templateUpdateFiles(string $template_id, Model\TemplateUpdateFil * @return array of Model\TemplateUpdateFilesResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdateFiles. This method will eventually become unavailable */ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { @@ -3676,6 +3706,7 @@ public function templateUpdateFilesWithHttpInfo(string $template_id, Model\Templ * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdateFiles. This method will eventually become unavailable */ public function templateUpdateFilesAsync(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { @@ -3698,6 +3729,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdateFiles. This method will eventually become unavailable */ public function templateUpdateFilesAsyncWithHttpInfo(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { @@ -3749,6 +3781,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::templateUpdateFiles. This method will eventually become unavailable */ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUpdateFilesRequest $template_update_files_request, string $contentType = self::contentTypes['templateUpdateFiles'][0]) { diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index b7337c038..39e71699d 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -144,15 +144,14 @@ public function getResponse() * Create Unclaimed Draft * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request unclaimed_draft_create_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreate'] to see the possible values for this operation * * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) + public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request) { - list($response) = $this->unclaimedDraftCreateWithHttpInfo($unclaimed_draft_create_request, $contentType); + list($response) = $this->unclaimedDraftCreateWithHttpInfo($unclaimed_draft_create_request); return $response; } @@ -167,6 +166,7 @@ public function unclaimedDraftCreate(Model\UnclaimedDraftCreateRequest $unclaime * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreate. This method will eventually become unavailable */ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { @@ -302,6 +302,7 @@ public function unclaimedDraftCreateWithHttpInfo(Model\UnclaimedDraftCreateReque * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreate. This method will eventually become unavailable */ public function unclaimedDraftCreateAsync(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { @@ -323,6 +324,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreate. This method will eventually become unavailable */ public function unclaimedDraftCreateAsyncWithHttpInfo(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { @@ -373,6 +375,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreate. This method will eventually become unavailable */ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request, string $contentType = self::contentTypes['unclaimedDraftCreate'][0]) { @@ -481,15 +484,14 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u * Create Embedded Unclaimed Draft * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request unclaimed_draft_create_embedded_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbedded'] to see the possible values for this operation * * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) + public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request) { - list($response) = $this->unclaimedDraftCreateEmbeddedWithHttpInfo($unclaimed_draft_create_embedded_request, $contentType); + list($response) = $this->unclaimedDraftCreateEmbeddedWithHttpInfo($unclaimed_draft_create_embedded_request); return $response; } @@ -504,6 +506,7 @@ public function unclaimedDraftCreateEmbedded(Model\UnclaimedDraftCreateEmbeddedR * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbedded. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { @@ -639,6 +642,7 @@ public function unclaimedDraftCreateEmbeddedWithHttpInfo(Model\UnclaimedDraftCre * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbedded. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedAsync(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { @@ -660,6 +664,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbedded. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { @@ -710,6 +715,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbedded. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbedded'][0]) { @@ -818,15 +824,14 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm * Create Embedded Unclaimed Draft with Template * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request unclaimed_draft_create_embedded_with_template_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'] to see the possible values for this operation * * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) + public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request) { - list($response) = $this->unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo($unclaimed_draft_create_embedded_with_template_request, $contentType); + list($response) = $this->unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo($unclaimed_draft_create_embedded_with_template_request); return $response; } @@ -841,6 +846,7 @@ public function unclaimedDraftCreateEmbeddedWithTemplate(Model\UnclaimedDraftCre * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { @@ -976,6 +982,7 @@ public function unclaimedDraftCreateEmbeddedWithTemplateWithHttpInfo(Model\Uncla * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedWithTemplateAsync(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { @@ -997,6 +1004,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedWithTemplateAsyncWithHttpInfo(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { @@ -1047,6 +1055,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftCreateEmbeddedWithTemplate. This method will eventually become unavailable */ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request, string $contentType = self::contentTypes['unclaimedDraftCreateEmbeddedWithTemplate'][0]) { @@ -1156,15 +1165,14 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD * * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request unclaimed_draft_edit_and_resend_request (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['unclaimedDraftEditAndResend'] to see the possible values for this operation * * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ - public function unclaimedDraftEditAndResend(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) + public function unclaimedDraftEditAndResend(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request) { - list($response) = $this->unclaimedDraftEditAndResendWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request, $contentType); + list($response) = $this->unclaimedDraftEditAndResendWithHttpInfo($signature_request_id, $unclaimed_draft_edit_and_resend_request); return $response; } @@ -1180,6 +1188,7 @@ public function unclaimedDraftEditAndResend(string $signature_request_id, Model\ * @return array of Model\UnclaimedDraftCreateResponse, HTTP status code, HTTP response headers (array of strings) * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftEditAndResend. This method will eventually become unavailable */ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { @@ -1316,6 +1325,7 @@ public function unclaimedDraftEditAndResendWithHttpInfo(string $signature_reques * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftEditAndResend. This method will eventually become unavailable */ public function unclaimedDraftEditAndResendAsync(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { @@ -1338,6 +1348,7 @@ function ($response) { * * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftEditAndResend. This method will eventually become unavailable */ public function unclaimedDraftEditAndResendAsyncWithHttpInfo(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { @@ -1389,6 +1400,7 @@ function ($exception) { * * @return Request * @throws InvalidArgumentException + * @deprecated Prefer to use ::unclaimedDraftEditAndResend. This method will eventually become unavailable */ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request, string $contentType = self::contentTypes['unclaimedDraftEditAndResend'][0]) { diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index c9d1b2f8e..96306527b 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -169,13 +169,6 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} -{{#servers}} -{{#-first}} - * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead - * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. -{{/-first}} -{{/servers}} - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation * * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException @@ -184,9 +177,9 @@ use {{invokerPackage}}\ObjectSerializer; * @deprecated {{/isDeprecated}} */ - public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { - {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return $response;{{/returnType}} } @@ -239,9 +232,7 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} + * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable */ public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -436,9 +427,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} + * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable */ public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -498,9 +487,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} + * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable */ public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -588,9 +575,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request - {{#isDeprecated}} - * @deprecated - {{/isDeprecated}} + * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable */ public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { From c1040ab7606e205d78696ad576b820828e1099a9 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 15:58:12 -0500 Subject: [PATCH 05/19] Remove ErrorReponse from @return --- sdks/php/bin/replace | 4 ++++ sdks/php/src/Api/AccountApi.php | 8 +++---- sdks/php/src/Api/ApiAppApi.php | 8 +++---- sdks/php/src/Api/BulkSendJobApi.php | 4 ++-- sdks/php/src/Api/EmbeddedApi.php | 4 ++-- sdks/php/src/Api/ReportApi.php | 2 +- sdks/php/src/Api/SignatureRequestApi.php | 28 ++++++++++++------------ sdks/php/src/Api/TeamApi.php | 18 +++++++-------- sdks/php/src/Api/TemplateApi.php | 20 ++++++++--------- sdks/php/src/Api/UnclaimedDraftApi.php | 8 +++---- 10 files changed, 54 insertions(+), 50 deletions(-) diff --git a/sdks/php/bin/replace b/sdks/php/bin/replace index ddf95444e..232cc7b3b 100755 --- a/sdks/php/bin/replace +++ b/sdks/php/bin/replace @@ -16,4 +16,8 @@ perl -pi -e 's#@return Model\\(.*)\|\\Dropbox\\Sign\\Model\\ErrorResponse#@retur "${ROOT_DIR}/src/Api/"*.php perl -pi -e 's#@return SplFileObject\|\\Dropbox\\Sign\\Model\\ErrorResponse#@return SplFileObject#g' \ "${ROOT_DIR}/src/Api/"*.php +perl -pi -e 's#@return Model\\(.*)\|Model\\ErrorResponse#@return Model\\$1#g' \ + "${ROOT_DIR}/src/Api/"*.php +perl -pi -e 's#@return SplFileObject\|Model\\ErrorResponse#@return SplFileObject#g' \ + "${ROOT_DIR}/src/Api/"*.php printf "\n" diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 58147d1de..c78fd6785 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -142,7 +142,7 @@ public function getResponse() * * @param Model\AccountCreateRequest $account_create_request account_create_request (required) * - * @return Model\AccountCreateResponse|Model\ErrorResponse + * @return Model\AccountCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -483,7 +483,7 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ * @param string $account_id `account_id` or `email_address` is required. If both are provided, the account id prevails. The ID of the Account. (optional) * @param string $email_address `account_id` or `email_address` is required, If both are provided, the account id prevails. The email address of the Account. (optional) * - * @return Model\AccountGetResponse|Model\ErrorResponse + * @return Model\AccountGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -822,7 +822,7 @@ public function accountGetRequest(string $account_id = null, string $email_addre * * @param Model\AccountUpdateRequest $account_update_request account_update_request (required) * - * @return Model\AccountGetResponse|Model\ErrorResponse + * @return Model\AccountGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1162,7 +1162,7 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ * * @param Model\AccountVerifyRequest $account_verify_request account_verify_request (required) * - * @return Model\AccountVerifyResponse|Model\ErrorResponse + * @return Model\AccountVerifyResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index df8df0cd8..b7d0e0fee 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -147,7 +147,7 @@ public function getResponse() * * @param Model\ApiAppCreateRequest $api_app_create_request api_app_create_request (required) * - * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @return Model\ApiAppGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -731,7 +731,7 @@ public function apiAppDeleteRequest(string $client_id, string $contentType = sel * * @param string $client_id The client id of the API App to retrieve. (required) * - * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @return Model\ApiAppGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1064,7 +1064,7 @@ public function apiAppGetRequest(string $client_id, string $contentType = self:: * @param int $page Which page number of the API App List to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * - * @return Model\ApiAppListResponse|Model\ErrorResponse + * @return Model\ApiAppListResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1404,7 +1404,7 @@ public function apiAppListRequest(int $page = 1, int $page_size = 20, string $co * @param string $client_id The client id of the API App to update. (required) * @param Model\ApiAppUpdateRequest $api_app_update_request api_app_update_request (required) * - * @return Model\ApiAppGetResponse|Model\ErrorResponse + * @return Model\ApiAppGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 6da54c057..0b51fac1f 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -138,7 +138,7 @@ public function getResponse() * @param int $page Which page number of the BulkSendJob list to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) * - * @return Model\BulkSendJobGetResponse|Model\ErrorResponse + * @return Model\BulkSendJobGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -498,7 +498,7 @@ public function bulkSendJobGetRequest(string $bulk_send_job_id, int $page = 1, i * @param int $page Which page number of the BulkSendJob List to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is 20. (optional, default to 20) * - * @return Model\BulkSendJobListResponse|Model\ErrorResponse + * @return Model\BulkSendJobListResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index d671d9af5..6e69eaddb 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -137,7 +137,7 @@ public function getResponse() * @param string $template_id The id of the template to edit. (required) * @param Model\EmbeddedEditUrlRequest $embedded_edit_url_request embedded_edit_url_request (required) * - * @return Model\EmbeddedEditUrlResponse|Model\ErrorResponse + * @return Model\EmbeddedEditUrlResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -497,7 +497,7 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr * * @param string $signature_id The id of the signature to get a signature url for. (required) * - * @return Model\EmbeddedSignUrlResponse|Model\ErrorResponse + * @return Model\EmbeddedSignUrlResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 246bc534d..3904b37c4 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -133,7 +133,7 @@ public function getResponse() * * @param Model\ReportCreateRequest $report_create_request report_create_request (required) * - * @return Model\ReportCreateResponse|Model\ErrorResponse + * @return Model\ReportCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index e29a714ed..cc9f6e3ee 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -185,7 +185,7 @@ public function getResponse() * * @param Model\SignatureRequestBulkCreateEmbeddedWithTemplateRequest $signature_request_bulk_create_embedded_with_template_request signature_request_bulk_create_embedded_with_template_request (required) * - * @return Model\BulkSendJobSendResponse|Model\ErrorResponse + * @return Model\BulkSendJobSendResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -521,7 +521,7 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign * * @param Model\SignatureRequestBulkSendWithTemplateRequest $signature_request_bulk_send_with_template_request signature_request_bulk_send_with_template_request (required) * - * @return Model\BulkSendJobSendResponse|Model\ErrorResponse + * @return Model\BulkSendJobSendResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1105,7 +1105,7 @@ public function signatureRequestCancelRequest(string $signature_request_id, stri * * @param Model\SignatureRequestCreateEmbeddedRequest $signature_request_create_embedded_request signature_request_create_embedded_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1445,7 +1445,7 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea * * @param Model\SignatureRequestCreateEmbeddedWithTemplateRequest $signature_request_create_embedded_with_template_request signature_request_create_embedded_with_template_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1786,7 +1786,7 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional, default to 'pdf') * - * @return SplFileObject|Model\ErrorResponse + * @return SplFileObject * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2132,7 +2132,7 @@ public function signatureRequestFilesRequest(string $signature_request_id, strin * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * - * @return Model\FileResponseDataUri|Model\ErrorResponse + * @return Model\FileResponseDataUri * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2465,7 +2465,7 @@ public function signatureRequestFilesAsDataUriRequest(string $signature_request_ * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) * - * @return Model\FileResponse|Model\ErrorResponse + * @return Model\FileResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2811,7 +2811,7 @@ public function signatureRequestFilesAsFileUrlRequest(string $signature_request_ * * @param string $signature_request_id The id of the SignatureRequest to retrieve. (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3146,7 +3146,7 @@ public function signatureRequestGetRequest(string $signature_request_id, string * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * @param string $query String that includes search terms and/or fields to be used to filter the SignatureRequest objects. (optional) * - * @return Model\SignatureRequestListResponse|Model\ErrorResponse + * @return Model\SignatureRequestListResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3511,7 +3511,7 @@ public function signatureRequestListRequest(string $account_id = null, int $page * * @param string $signature_request_id The id of the SignatureRequest to release. (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3844,7 +3844,7 @@ public function signatureRequestReleaseHoldRequest(string $signature_request_id, * @param string $signature_request_id The id of the SignatureRequest to send a reminder for. (required) * @param Model\SignatureRequestRemindRequest $signature_request_remind_request signature_request_remind_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -4444,7 +4444,7 @@ public function signatureRequestRemoveRequest(string $signature_request_id, stri * * @param Model\SignatureRequestSendRequest $signature_request_send_request signature_request_send_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -4784,7 +4784,7 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s * * @param Model\SignatureRequestSendWithTemplateRequest $signature_request_send_with_template_request signature_request_send_with_template_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -5125,7 +5125,7 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe * @param string $signature_request_id The id of the SignatureRequest to update. (required) * @param Model\SignatureRequestUpdateRequest $signature_request_update_request signature_request_update_request (required) * - * @return Model\SignatureRequestGetResponse|Model\ErrorResponse + * @return Model\SignatureRequestGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 37dbdc8ea..0320580ae 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -161,7 +161,7 @@ public function getResponse() * @param Model\TeamAddMemberRequest $team_add_member_request team_add_member_request (required) * @param string $team_id The id of the team. (optional) * - * @return Model\TeamGetResponse|Model\ErrorResponse + * @return Model\TeamGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -515,7 +515,7 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member * * @param Model\TeamCreateRequest $team_create_request team_create_request (required) * - * @return Model\TeamGetResponse|Model\ErrorResponse + * @return Model\TeamGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1075,7 +1075,7 @@ public function teamDeleteRequest(string $contentType = self::contentTypes['team * * Get Team * - * @return Model\TeamGetResponse|Model\ErrorResponse + * @return Model\TeamGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1387,7 +1387,7 @@ public function teamGetRequest(string $contentType = self::contentTypes['teamGet * * @param string $team_id The id of the team. (optional) * - * @return Model\TeamGetInfoResponse|Model\ErrorResponse + * @return Model\TeamGetInfoResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1713,7 +1713,7 @@ public function teamInfoRequest(string $team_id = null, string $contentType = se * * @param string $email_address The email address for which to display the team invites. (optional) * - * @return Model\TeamInvitesResponse|Model\ErrorResponse + * @return Model\TeamInvitesResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2041,7 +2041,7 @@ public function teamInvitesRequest(string $email_address = null, string $content * @param int $page Which page number of the team member list to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * - * @return Model\TeamMembersResponse|Model\ErrorResponse + * @return Model\TeamMembersResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2407,7 +2407,7 @@ public function teamMembersRequest(string $team_id, int $page = 1, int $page_siz * * @param Model\TeamRemoveMemberRequest $team_remove_member_request team_remove_member_request (required) * - * @return Model\TeamGetResponse|Model\ErrorResponse + * @return Model\TeamGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2749,7 +2749,7 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo * @param int $page Which page number of the SubTeam List to return. Defaults to `1`. (optional, default to 1) * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * - * @return Model\TeamSubTeamsResponse|Model\ErrorResponse + * @return Model\TeamSubTeamsResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3115,7 +3115,7 @@ public function teamSubTeamsRequest(string $team_id, int $page = 1, int $page_si * * @param Model\TeamUpdateRequest $team_update_request team_update_request (required) * - * @return Model\TeamGetResponse|Model\ErrorResponse + * @return Model\TeamGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 38559e98c..b8df71874 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -168,7 +168,7 @@ public function getResponse() * @param string $template_id The id of the Template to give the Account access to. (required) * @param Model\TemplateAddUserRequest $template_add_user_request template_add_user_request (required) * - * @return Model\TemplateGetResponse|Model\ErrorResponse + * @return Model\TemplateGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -528,7 +528,7 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse * * @param Model\TemplateCreateRequest $template_create_request template_create_request (required) * - * @return Model\TemplateCreateResponse|Model\ErrorResponse + * @return Model\TemplateCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -868,7 +868,7 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea * * @param Model\TemplateCreateEmbeddedDraftRequest $template_create_embedded_draft_request template_create_embedded_draft_request (required) * - * @return Model\TemplateCreateEmbeddedDraftResponse|Model\ErrorResponse + * @return Model\TemplateCreateEmbeddedDraftResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1453,7 +1453,7 @@ public function templateDeleteRequest(string $template_id, string $contentType = * @param string $template_id The id of the template files to retrieve. (required) * @param string $file_type Set to `pdf` for a single merged document or `zip` for a collection of individual documents. (optional) * - * @return SplFileObject|Model\ErrorResponse + * @return SplFileObject * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1799,7 +1799,7 @@ public function templateFilesRequest(string $template_id, string $file_type = nu * * @param string $template_id The id of the template files to retrieve. (required) * - * @return Model\FileResponseDataUri|Model\ErrorResponse + * @return Model\FileResponseDataUri * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2132,7 +2132,7 @@ public function templateFilesAsDataUriRequest(string $template_id, string $conte * @param string $template_id The id of the template files to retrieve. (required) * @param int $force_download By default when opening the `file_url` a browser will download the PDF and save it locally. When set to `0` the PDF file will be displayed in the browser. (optional, default to 1) * - * @return Model\FileResponse|Model\ErrorResponse + * @return Model\FileResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2478,7 +2478,7 @@ public function templateFilesAsFileUrlRequest(string $template_id, int $force_do * * @param string $template_id The id of the Template to retrieve. (required) * - * @return Model\TemplateGetResponse|Model\ErrorResponse + * @return Model\TemplateGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -2813,7 +2813,7 @@ public function templateGetRequest(string $template_id, string $contentType = se * @param int $page_size Number of objects to be returned per page. Must be between `1` and `100`. Default is `20`. (optional, default to 20) * @param string $query String that includes search terms and/or fields to be used to filter the Template objects. (optional) * - * @return Model\TemplateListResponse|Model\ErrorResponse + * @return Model\TemplateListResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3186,7 +3186,7 @@ public function templateListRequest(string $account_id = null, int $page = 1, in * @param string $template_id The id of the Template to remove the Account's access to. (required) * @param Model\TemplateRemoveUserRequest $template_remove_user_request template_remove_user_request (required) * - * @return Model\TemplateGetResponse|Model\ErrorResponse + * @return Model\TemplateGetResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -3547,7 +3547,7 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem * @param string $template_id The ID of the template whose files to update. (required) * @param Model\TemplateUpdateFilesRequest $template_update_files_request template_update_files_request (required) * - * @return Model\TemplateUpdateFilesResponse|Model\ErrorResponse + * @return Model\TemplateUpdateFilesResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index 39e71699d..6ed668521 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -145,7 +145,7 @@ public function getResponse() * * @param Model\UnclaimedDraftCreateRequest $unclaimed_draft_create_request unclaimed_draft_create_request (required) * - * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @return Model\UnclaimedDraftCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -485,7 +485,7 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u * * @param Model\UnclaimedDraftCreateEmbeddedRequest $unclaimed_draft_create_embedded_request unclaimed_draft_create_embedded_request (required) * - * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @return Model\UnclaimedDraftCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -825,7 +825,7 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm * * @param Model\UnclaimedDraftCreateEmbeddedWithTemplateRequest $unclaimed_draft_create_embedded_with_template_request unclaimed_draft_create_embedded_with_template_request (required) * - * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @return Model\UnclaimedDraftCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ @@ -1166,7 +1166,7 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD * @param string $signature_request_id The ID of the signature request to edit and resend. (required) * @param Model\UnclaimedDraftEditAndResendRequest $unclaimed_draft_edit_and_resend_request unclaimed_draft_edit_and_resend_request (required) * - * @return Model\UnclaimedDraftCreateResponse|Model\ErrorResponse + * @return Model\UnclaimedDraftCreateResponse * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException */ From c24c90fb53c781013b7c500e758f1715c5705b37 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 16:06:28 -0500 Subject: [PATCH 06/19] Marks more methods as @deprecated --- sdks/php/src/Api/AccountApi.php | 2 ++ sdks/php/src/Api/ApiAppApi.php | 2 ++ sdks/php/src/Api/BulkSendJobApi.php | 2 ++ sdks/php/src/Api/EmbeddedApi.php | 2 ++ sdks/php/src/Api/OAuthApi.php | 2 ++ sdks/php/src/Api/ReportApi.php | 2 ++ sdks/php/src/Api/SignatureRequestApi.php | 2 ++ sdks/php/src/Api/TeamApi.php | 2 ++ sdks/php/src/Api/TemplateApi.php | 2 ++ sdks/php/src/Api/UnclaimedDraftApi.php | 2 ++ sdks/php/templates/api.mustache | 2 ++ 11 files changed, 22 insertions(+) diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index c78fd6785..1ce15275a 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -103,6 +103,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -113,6 +114,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index b7d0e0fee..a9bbf136e 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -108,6 +108,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -118,6 +119,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 0b51fac1f..0e2639e3f 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -97,6 +97,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -107,6 +108,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 6e69eaddb..c198ebed3 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -97,6 +97,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -107,6 +108,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 218a509fe..7c3ab1f70 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -97,6 +97,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -107,6 +108,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 3904b37c4..6e098ea0e 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -94,6 +94,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -104,6 +105,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index cc9f6e3ee..a8438ec7f 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -146,6 +146,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -156,6 +157,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 0320580ae..15c4756fd 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -121,6 +121,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -131,6 +132,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index b8df71874..1275f8d0f 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -128,6 +128,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -138,6 +139,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index 6ed668521..19d96a314 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -106,6 +106,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -116,6 +117,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 96306527b..a5a91601f 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -98,6 +98,7 @@ use {{invokerPackage}}\ObjectSerializer; * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex($hostIndex): void { @@ -108,6 +109,7 @@ use {{invokerPackage}}\ObjectSerializer; * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { From ce143827c09402de291067c53f73c012adc94275 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 16:23:39 -0500 Subject: [PATCH 07/19] Fixes Config methods --- sdks/php/src/Configuration.php | 23 +++++++++++++++-------- sdks/php/templates/Configuration.mustache | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/sdks/php/src/Configuration.php b/sdks/php/src/Configuration.php index 386e29114..b1d5ec56d 100644 --- a/sdks/php/src/Configuration.php +++ b/sdks/php/src/Configuration.php @@ -146,7 +146,7 @@ public function __construct() * * @return $this */ - public function setApiKey(string $apiKeyIdentifier, string $key) + protected function setApiKey(string $apiKeyIdentifier, string $key) { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -159,7 +159,7 @@ public function setApiKey(string $apiKeyIdentifier, string $key) * * @return string|null API key or token */ - public function getApiKey(string $apiKeyIdentifier) + protected function getApiKey(string $apiKeyIdentifier) { return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; } @@ -172,7 +172,7 @@ public function getApiKey(string $apiKeyIdentifier) * * @return $this */ - public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix) + protected function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix) { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -185,7 +185,7 @@ public function setApiKeyPrefix(string $apiKeyIdentifier, string $prefix) * * @return string|null */ - public function getApiKeyPrefix(string $apiKeyIdentifier) + protected function getApiKeyPrefix(string $apiKeyIdentifier) { return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; } @@ -220,7 +220,7 @@ public function getAccessToken() * * @return $this */ - public function setBooleanFormatForQueryString(string $booleanFormat) + protected function setBooleanFormatForQueryString(string $booleanFormat) { $this->booleanFormatForQueryString = $booleanFormat; @@ -267,7 +267,7 @@ public function getUsername() * * @return $this */ - public function setPassword(string $password) + protected function setPassword(string $password) { $this->password = $password; return $this; @@ -278,7 +278,7 @@ public function setPassword(string $password) * * @return string Password for HTTP basic authentication */ - public function getPassword() + protected function getPassword() { return $this->password; } @@ -451,7 +451,7 @@ public static function toDebugReport() * * @return string|null API key with the prefix */ - public function getApiKeyWithPrefix(string $apiKeyIdentifier) + protected function getApiKeyWithPrefix(string $apiKeyIdentifier) { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -535,6 +535,13 @@ public function getHostFromSettings(int $index, ?array $variables = null) return self::getHostString($this->getHostSettings(), $index, $variables); } + public function setOptions(array $options): self + { + $this->options = $options; + + return $this; + } + /** * Get extra request options */ diff --git a/sdks/php/templates/Configuration.mustache b/sdks/php/templates/Configuration.mustache index bec33b2d9..62ee01f9b 100644 --- a/sdks/php/templates/Configuration.mustache +++ b/sdks/php/templates/Configuration.mustache @@ -140,7 +140,7 @@ class Configuration * * @return $this */ - public function setApiKey($apiKeyIdentifier, $key) + protected function setApiKey($apiKeyIdentifier, $key) { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -153,7 +153,7 @@ class Configuration * * @return null|string API key or token */ - public function getApiKey($apiKeyIdentifier) + protected function getApiKey($apiKeyIdentifier) { return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; } @@ -166,7 +166,7 @@ class Configuration * * @return $this */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + protected function setApiKeyPrefix($apiKeyIdentifier, $prefix) { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -179,7 +179,7 @@ class Configuration * * @return null|string */ - public function getApiKeyPrefix($apiKeyIdentifier) + protected function getApiKeyPrefix($apiKeyIdentifier) { return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; } @@ -214,7 +214,7 @@ class Configuration * * @return $this */ - public function setBooleanFormatForQueryString(string $booleanFormat) + protected function setBooleanFormatForQueryString(string $booleanFormat) { $this->booleanFormatForQueryString = $booleanFormat; @@ -261,7 +261,7 @@ class Configuration * * @return $this */ - public function setPassword($password) + protected function setPassword($password) { $this->password = $password; return $this; @@ -272,7 +272,7 @@ class Configuration * * @return string Password for HTTP basic authentication */ - public function getPassword() + protected function getPassword() { return $this->password; } @@ -449,7 +449,7 @@ class Configuration * * @return null|string API key with the prefix */ - public function getApiKeyWithPrefix($apiKeyIdentifier) + protected function getApiKeyWithPrefix($apiKeyIdentifier) { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -556,6 +556,13 @@ class Configuration return self::getHostString($this->getHostSettings(), $index, $variables); } + public function setOptions(array $options): self + { + $this->options = $options; + + return $this; + } + /** * Get extra request options * From e57982564bd93dc67a78d1b61b675ef08d1816b5 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 23 Aug 2024 16:34:24 -0500 Subject: [PATCH 08/19] Reduce diff in template --- sdks/php/templates/api.mustache | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index a5a91601f..9b5d4eda2 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -235,6 +235,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} */ public function {{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -430,6 +433,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} */ public function {{operationId}}Async({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -490,6 +496,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} */ public function {{operationId}}AsyncWithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { @@ -578,6 +587,9 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} */ public function {{operationId}}Request({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { From 33a70611ebf0d3a919966e06ca4ff2b9befee152 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Tue, 27 Aug 2024 09:30:03 -0500 Subject: [PATCH 09/19] Updates SDK --- sdks/php/.gitignore | 2 + sdks/php/bin/php-8 | 2 - sdks/php/src/Api/FaxLineApi.php | 1732 +++++++++-------- sdks/php/src/Model/FaxLineAddUserRequest.php | 147 +- .../Model/FaxLineAreaCodeGetCountryEnum.php | 4 +- .../Model/FaxLineAreaCodeGetProvinceEnum.php | 4 +- .../src/Model/FaxLineAreaCodeGetResponse.php | 139 +- .../src/Model/FaxLineAreaCodeGetStateEnum.php | 4 +- sdks/php/src/Model/FaxLineCreateRequest.php | 151 +- sdks/php/src/Model/FaxLineDeleteRequest.php | 135 +- sdks/php/src/Model/FaxLineListResponse.php | 151 +- .../src/Model/FaxLineRemoveUserRequest.php | 147 +- sdks/php/src/Model/FaxLineResponse.php | 145 +- sdks/php/src/Model/FaxLineResponseFaxLine.php | 157 +- sdks/php/templates/ApiException.mustache | 3 + sdks/php/templates/Configuration.mustache | 12 + sdks/php/templates/ObjectSerializer.mustache | 21 + sdks/php/templates/api.mustache | 70 +- sdks/php/templates/composer.mustache | 9 + sdks/php/templates/gitignore | 2 + .../libraries/psr-18/ApiException.mustache | 1 + sdks/php/templates/model_generic.mustache | 7 + .../templates/php_doc_auth_partial.mustache | 10 + 23 files changed, 1987 insertions(+), 1068 deletions(-) diff --git a/sdks/php/.gitignore b/sdks/php/.gitignore index 3f10c0389..12f85db8f 100644 --- a/sdks/php/.gitignore +++ b/sdks/php/.gitignore @@ -14,7 +14,9 @@ composer.phar # PHPUnit cache .phpunit.result.cache +# CUSTOM - BEGIN .composer .openapi-generator git_push.sh composer.lock +# CUSTOM - END diff --git a/sdks/php/bin/php-8 b/sdks/php/bin/php-8 index c4a5bb062..78acc6d73 100755 --- a/sdks/php/bin/php-8 +++ b/sdks/php/bin/php-8 @@ -13,8 +13,6 @@ docker run --rm \ -v "dropbox-sign-sdk-composer-cache:/.composer" \ -w "${WORKING_DIR}" \ -u root:root \ - -e PHP.display_errors=1 \ - -e PHP.error_reporting=-1 \ jtreminio/php:8.1 "$@" exit 0 diff --git a/sdks/php/src/Api/FaxLineApi.php b/sdks/php/src/Api/FaxLineApi.php index 11a334e0e..1d2c0ee80 100644 --- a/sdks/php/src/Api/FaxLineApi.php +++ b/sdks/php/src/Api/FaxLineApi.php @@ -4,7 +4,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -16,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -36,11 +35,11 @@ use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; -use GuzzleHttp\Promise; -use GuzzleHttp\Psr7; +use GuzzleHttp\Psr7\MultipartStream; +use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use GuzzleHttp\Utils; use InvalidArgumentException; +use JsonException; use Psr\Http\Message\ResponseInterface; use RuntimeException; @@ -48,34 +47,50 @@ * FaxLineApi Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class FaxLineApi { - /** - * @var ClientInterface - */ + /** @var ClientInterface */ protected $client; - /** - * @var Configuration - */ + /** @var Configuration */ protected $config; - /** - * @var HeaderSelector - */ + /** @var HeaderSelector */ protected $headerSelector; - /** - * @var int Host index - */ + /** @var int Host index */ protected $hostIndex; /** - * @var ResponseInterface|null + * @var string[] * */ + public const contentTypes = [ + 'faxLineAddUser' => [ + 'application/json', + ], + 'faxLineAreaCodeGet' => [ + 'application/json', + ], + 'faxLineCreate' => [ + 'application/json', + ], + 'faxLineDelete' => [ + 'application/json', + ], + 'faxLineGet' => [ + 'application/json', + ], + 'faxLineList' => [ + 'application/json', + ], + 'faxLineRemoveUser' => [ + 'application/json', + ], + ]; + + /** @var ResponseInterface|null */ protected $response; /** @@ -97,6 +112,7 @@ public function __construct( * Set the host index * * @param int $hostIndex Host index (required) + * @deprecated To be made private in the future */ public function setHostIndex(int $hostIndex): void { @@ -107,6 +123,7 @@ public function setHostIndex(int $hostIndex): void * Get the host index * * @return int Host index + * @deprecated To be made private in the future */ public function getHostIndex() { @@ -136,14 +153,13 @@ public function getResponse() * * @param Model\FaxLineAddUserRequest $fax_line_add_user_request fax_line_add_user_request (required) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineAddUser(Model\FaxLineAddUserRequest $fax_line_add_user_request) { list($response) = $this->faxLineAddUserWithHttpInfo($fax_line_add_user_request); - return $response; } @@ -153,14 +169,16 @@ public function faxLineAddUser(Model\FaxLineAddUserRequest $fax_line_add_user_re * Add Fax Line User * * @param Model\FaxLineAddUserRequest $fax_line_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAddUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineAddUser. This method will eventually become unavailable */ - public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line_add_user_request) + public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line_add_user_request, string $contentType = self::contentTypes['faxLineAddUser'][0]) { - $request = $this->faxLineAddUserRequest($fax_line_add_user_request); + $request = $this->faxLineAddUserRequest($fax_line_add_user_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -170,14 +188,14 @@ public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -190,51 +208,73 @@ public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -243,28 +283,19 @@ public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -275,13 +306,15 @@ public function faxLineAddUserWithHttpInfo(Model\FaxLineAddUserRequest $fax_line * Add Fax Line User * * @param Model\FaxLineAddUserRequest $fax_line_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAddUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineAddUser. This method will eventually become unavailable */ - public function faxLineAddUserAsync(Model\FaxLineAddUserRequest $fax_line_add_user_request) + public function faxLineAddUserAsync(Model\FaxLineAddUserRequest $fax_line_add_user_request, string $contentType = self::contentTypes['faxLineAddUser'][0]) { - return $this->faxLineAddUserAsyncWithHttpInfo($fax_line_add_user_request) + return $this->faxLineAddUserAsyncWithHttpInfo($fax_line_add_user_request, $contentType) ->then( function ($response) { return $response[0]; @@ -295,23 +328,28 @@ function ($response) { * Add Fax Line User * * @param Model\FaxLineAddUserRequest $fax_line_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAddUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineAddUser. This method will eventually become unavailable */ - public function faxLineAddUserAsyncWithHttpInfo(Model\FaxLineAddUserRequest $fax_line_add_user_request) + public function faxLineAddUserAsyncWithHttpInfo(Model\FaxLineAddUserRequest $fax_line_add_user_request, string $contentType = self::contentTypes['faxLineAddUser'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; - $request = $this->faxLineAddUserRequest($fax_line_add_user_request); + $request = $this->faxLineAddUserRequest($fax_line_add_user_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -331,7 +369,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -341,11 +379,13 @@ function ($exception) { * Create request for operation 'faxLineAddUser' * * @param Model\FaxLineAddUserRequest $fax_line_add_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAddUser'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineAddUser. This method will eventually become unavailable */ - public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_user_request) + public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_user_request, string $contentType = self::contentTypes['faxLineAddUser'][0]) { // verify the required parameter 'fax_line_add_user_request' is set if ($fax_line_add_user_request === null || (is_array($fax_line_add_user_request) && count($fax_line_add_user_request) === 0)) { @@ -355,9 +395,11 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ } $resourcePath = '/fax_line/add_user'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $fax_line_add_user_request @@ -365,21 +407,17 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_add_user_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_add_user_request)); } else { $httpBody = $fax_line_add_user_request; } @@ -398,9 +436,9 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -408,12 +446,13 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ $payloadHook('multipart', $multipartContents, $fax_line_add_user_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -433,11 +472,11 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -448,19 +487,18 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ * * Get Available Fax Line Area Codes * - * @param string $country Filter area codes by country. (required) - * @param string $state Filter area codes by state. (optional) + * @param string $country Filter area codes by country. (required) + * @param string $state Filter area codes by state. (optional) * @param string $province Filter area codes by province. (optional) - * @param string $city Filter area codes by city. (optional) + * @param string $city Filter area codes by city. (optional) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineAreaCodeGetResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineAreaCodeGet(string $country, string $state = null, string $province = null, string $city = null) { list($response) = $this->faxLineAreaCodeGetWithHttpInfo($country, $state, $province, $city); - return $response; } @@ -469,18 +507,20 @@ public function faxLineAreaCodeGet(string $country, string $state = null, string * * Get Available Fax Line Area Codes * - * @param string $country Filter area codes by country. (required) - * @param string $state Filter area codes by state. (optional) - * @param string $province Filter area codes by province. (optional) - * @param string $city Filter area codes by city. (optional) + * @param string $country Filter area codes by country. (required) + * @param string $state Filter area codes by state. (optional) + * @param string $province Filter area codes by province. (optional) + * @param string $city Filter area codes by city. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAreaCodeGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineAreaCodeGetResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineAreaCodeGet. This method will eventually become unavailable */ - public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = null, string $province = null, string $city = null) + public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = null, string $province = null, string $city = null, string $contentType = self::contentTypes['faxLineAreaCodeGet'][0]) { - $request = $this->faxLineAreaCodeGetRequest($country, $state, $province, $city); + $request = $this->faxLineAreaCodeGetRequest($country, $state, $province, $city, $contentType); try { $options = $this->createHttpClientOption(); @@ -490,14 +530,14 @@ public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -510,51 +550,73 @@ public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -563,28 +625,19 @@ public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -594,17 +647,19 @@ public function faxLineAreaCodeGetWithHttpInfo(string $country, string $state = * * Get Available Fax Line Area Codes * - * @param string $country Filter area codes by country. (required) - * @param string $state Filter area codes by state. (optional) - * @param string $province Filter area codes by province. (optional) - * @param string $city Filter area codes by city. (optional) + * @param string $country Filter area codes by country. (required) + * @param string $state Filter area codes by state. (optional) + * @param string $province Filter area codes by province. (optional) + * @param string $city Filter area codes by city. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAreaCodeGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineAreaCodeGet. This method will eventually become unavailable */ - public function faxLineAreaCodeGetAsync(string $country, string $state = null, string $province = null, string $city = null) + public function faxLineAreaCodeGetAsync(string $country, string $state = null, string $province = null, string $city = null, string $contentType = self::contentTypes['faxLineAreaCodeGet'][0]) { - return $this->faxLineAreaCodeGetAsyncWithHttpInfo($country, $state, $province, $city) + return $this->faxLineAreaCodeGetAsyncWithHttpInfo($country, $state, $province, $city, $contentType) ->then( function ($response) { return $response[0]; @@ -617,27 +672,32 @@ function ($response) { * * Get Available Fax Line Area Codes * - * @param string $country Filter area codes by country. (required) - * @param string $state Filter area codes by state. (optional) - * @param string $province Filter area codes by province. (optional) - * @param string $city Filter area codes by city. (optional) + * @param string $country Filter area codes by country. (required) + * @param string $state Filter area codes by state. (optional) + * @param string $province Filter area codes by province. (optional) + * @param string $city Filter area codes by city. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAreaCodeGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineAreaCodeGet. This method will eventually become unavailable */ - public function faxLineAreaCodeGetAsyncWithHttpInfo(string $country, string $state = null, string $province = null, string $city = null) + public function faxLineAreaCodeGetAsyncWithHttpInfo(string $country, string $state = null, string $province = null, string $city = null, string $contentType = self::contentTypes['faxLineAreaCodeGet'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineAreaCodeGetResponse'; - $request = $this->faxLineAreaCodeGetRequest($country, $state, $province, $city); + $request = $this->faxLineAreaCodeGetRequest($country, $state, $province, $city, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -657,7 +717,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -666,15 +726,17 @@ function ($exception) { /** * Create request for operation 'faxLineAreaCodeGet' * - * @param string $country Filter area codes by country. (required) - * @param string $state Filter area codes by state. (optional) - * @param string $province Filter area codes by province. (optional) - * @param string $city Filter area codes by city. (optional) + * @param string $country Filter area codes by country. (required) + * @param string $state Filter area codes by state. (optional) + * @param string $province Filter area codes by province. (optional) + * @param string $city Filter area codes by city. (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineAreaCodeGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineAreaCodeGet. This method will eventually become unavailable */ - public function faxLineAreaCodeGetRequest(string $country, string $state = null, string $province = null, string $city = null) + public function faxLineAreaCodeGetRequest(string $country, string $state = null, string $province = null, string $city = null, string $contentType = self::contentTypes['faxLineAreaCodeGet'][0]) { // verify the required parameter 'country' is set if ($country === null || (is_array($country) && count($country) === 0)) { @@ -684,64 +746,54 @@ public function faxLineAreaCodeGetRequest(string $country, string $state = null, } $resourcePath = '/fax_line/area_codes'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($country !== null) { - if ('form' === 'form' && is_array($country)) { - foreach ($country as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['country'] = $country; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $country, + 'country', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); // query params - if ($state !== null) { - if ('form' === 'form' && is_array($state)) { - foreach ($state as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['state'] = $state; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $state, + 'state', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($province !== null) { - if ('form' === 'form' && is_array($province)) { - foreach ($province as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['province'] = $province; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $province, + 'province', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($city !== null) { - if ('form' === 'form' && is_array($city)) { - foreach ($city as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['city'] = $city; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $city, + 'city', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -759,18 +811,19 @@ public function faxLineAreaCodeGetRequest(string $country, string $state = null, // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -790,11 +843,11 @@ public function faxLineAreaCodeGetRequest(string $country, string $state = null, $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -807,14 +860,13 @@ public function faxLineAreaCodeGetRequest(string $country, string $state = null, * * @param Model\FaxLineCreateRequest $fax_line_create_request fax_line_create_request (required) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineCreate(Model\FaxLineCreateRequest $fax_line_create_request) { list($response) = $this->faxLineCreateWithHttpInfo($fax_line_create_request); - return $response; } @@ -824,14 +876,16 @@ public function faxLineCreate(Model\FaxLineCreateRequest $fax_line_create_reques * Purchase Fax Line * * @param Model\FaxLineCreateRequest $fax_line_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineCreate'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineCreate. This method will eventually become unavailable */ - public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_create_request) + public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_create_request, string $contentType = self::contentTypes['faxLineCreate'][0]) { - $request = $this->faxLineCreateRequest($fax_line_create_request); + $request = $this->faxLineCreateRequest($fax_line_create_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -841,14 +895,14 @@ public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_c } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -861,51 +915,73 @@ public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_c sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -914,28 +990,19 @@ public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_c $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -946,13 +1013,15 @@ public function faxLineCreateWithHttpInfo(Model\FaxLineCreateRequest $fax_line_c * Purchase Fax Line * * @param Model\FaxLineCreateRequest $fax_line_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineCreate. This method will eventually become unavailable */ - public function faxLineCreateAsync(Model\FaxLineCreateRequest $fax_line_create_request) + public function faxLineCreateAsync(Model\FaxLineCreateRequest $fax_line_create_request, string $contentType = self::contentTypes['faxLineCreate'][0]) { - return $this->faxLineCreateAsyncWithHttpInfo($fax_line_create_request) + return $this->faxLineCreateAsyncWithHttpInfo($fax_line_create_request, $contentType) ->then( function ($response) { return $response[0]; @@ -966,23 +1035,28 @@ function ($response) { * Purchase Fax Line * * @param Model\FaxLineCreateRequest $fax_line_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineCreate'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineCreate. This method will eventually become unavailable */ - public function faxLineCreateAsyncWithHttpInfo(Model\FaxLineCreateRequest $fax_line_create_request) + public function faxLineCreateAsyncWithHttpInfo(Model\FaxLineCreateRequest $fax_line_create_request, string $contentType = self::contentTypes['faxLineCreate'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; - $request = $this->faxLineCreateRequest($fax_line_create_request); + $request = $this->faxLineCreateRequest($fax_line_create_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1002,7 +1076,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1012,11 +1086,13 @@ function ($exception) { * Create request for operation 'faxLineCreate' * * @param Model\FaxLineCreateRequest $fax_line_create_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineCreate'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineCreate. This method will eventually become unavailable */ - public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create_request) + public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create_request, string $contentType = self::contentTypes['faxLineCreate'][0]) { // verify the required parameter 'fax_line_create_request' is set if ($fax_line_create_request === null || (is_array($fax_line_create_request) && count($fax_line_create_request) === 0)) { @@ -1026,9 +1102,11 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create } $resourcePath = '/fax_line/create'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $fax_line_create_request @@ -1036,21 +1114,17 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_create_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_create_request)); } else { $httpBody = $fax_line_create_request; } @@ -1069,9 +1143,9 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1079,12 +1153,13 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create $payloadHook('multipart', $multipartContents, $fax_line_create_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1104,11 +1179,11 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'POST', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1121,9 +1196,8 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create * * @param Model\FaxLineDeleteRequest $fax_line_delete_request fax_line_delete_request (required) * - * @throws ApiException on non-2xx response + * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return void */ public function faxLineDelete(Model\FaxLineDeleteRequest $fax_line_delete_request) { @@ -1136,14 +1210,16 @@ public function faxLineDelete(Model\FaxLineDeleteRequest $fax_line_delete_reques * Delete Fax Line * * @param Model\FaxLineDeleteRequest $fax_line_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineDelete'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineDelete. This method will eventually become unavailable */ - public function faxLineDeleteWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_delete_request) + public function faxLineDeleteWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_delete_request, string $contentType = self::contentTypes['faxLineDelete'][0]) { - $request = $this->faxLineDeleteRequest($fax_line_delete_request); + $request = $this->faxLineDeleteRequest($fax_line_delete_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -1153,14 +1229,14 @@ public function faxLineDeleteWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_d } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1173,29 +1249,21 @@ public function faxLineDeleteWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_d sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { } - throw $e; } } @@ -1206,13 +1274,15 @@ public function faxLineDeleteWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_d * Delete Fax Line * * @param Model\FaxLineDeleteRequest $fax_line_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineDelete. This method will eventually become unavailable */ - public function faxLineDeleteAsync(Model\FaxLineDeleteRequest $fax_line_delete_request) + public function faxLineDeleteAsync(Model\FaxLineDeleteRequest $fax_line_delete_request, string $contentType = self::contentTypes['faxLineDelete'][0]) { - return $this->faxLineDeleteAsyncWithHttpInfo($fax_line_delete_request) + return $this->faxLineDeleteAsyncWithHttpInfo($fax_line_delete_request, $contentType) ->then( function ($response) { return $response[0]; @@ -1226,14 +1296,16 @@ function ($response) { * Delete Fax Line * * @param Model\FaxLineDeleteRequest $fax_line_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineDelete'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineDelete. This method will eventually become unavailable */ - public function faxLineDeleteAsyncWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_delete_request) + public function faxLineDeleteAsyncWithHttpInfo(Model\FaxLineDeleteRequest $fax_line_delete_request, string $contentType = self::contentTypes['faxLineDelete'][0]) { $returnType = ''; - $request = $this->faxLineDeleteRequest($fax_line_delete_request); + $request = $this->faxLineDeleteRequest($fax_line_delete_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -1252,7 +1324,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1262,11 +1334,13 @@ function ($exception) { * Create request for operation 'faxLineDelete' * * @param Model\FaxLineDeleteRequest $fax_line_delete_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineDelete'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineDelete. This method will eventually become unavailable */ - public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete_request) + public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete_request, string $contentType = self::contentTypes['faxLineDelete'][0]) { // verify the required parameter 'fax_line_delete_request' is set if ($fax_line_delete_request === null || (is_array($fax_line_delete_request) && count($fax_line_delete_request) === 0)) { @@ -1276,9 +1350,11 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete } $resourcePath = '/fax_line'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $fax_line_delete_request @@ -1286,21 +1362,17 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_delete_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_delete_request)); } else { $httpBody = $fax_line_delete_request; } @@ -1319,9 +1391,9 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -1329,12 +1401,13 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete $payloadHook('multipart', $multipartContents, $fax_line_delete_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1354,11 +1427,11 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'DELETE', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1371,14 +1444,13 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete * * @param string $number The Fax Line number. (required) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineGet(string $number) { list($response) = $this->faxLineGetWithHttpInfo($number); - return $response; } @@ -1387,15 +1459,17 @@ public function faxLineGet(string $number) * * Get Fax Line * - * @param string $number The Fax Line number. (required) + * @param string $number The Fax Line number. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineGet'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineGet. This method will eventually become unavailable */ - public function faxLineGetWithHttpInfo(string $number) + public function faxLineGetWithHttpInfo(string $number, string $contentType = self::contentTypes['faxLineGet'][0]) { - $request = $this->faxLineGetRequest($number); + $request = $this->faxLineGetRequest($number, $contentType); try { $options = $this->createHttpClientOption(); @@ -1405,14 +1479,14 @@ public function faxLineGetWithHttpInfo(string $number) } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1425,51 +1499,73 @@ public function faxLineGetWithHttpInfo(string $number) sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1478,28 +1574,19 @@ public function faxLineGetWithHttpInfo(string $number) $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1509,14 +1596,16 @@ public function faxLineGetWithHttpInfo(string $number) * * Get Fax Line * - * @param string $number The Fax Line number. (required) + * @param string $number The Fax Line number. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineGet. This method will eventually become unavailable */ - public function faxLineGetAsync(string $number) + public function faxLineGetAsync(string $number, string $contentType = self::contentTypes['faxLineGet'][0]) { - return $this->faxLineGetAsyncWithHttpInfo($number) + return $this->faxLineGetAsyncWithHttpInfo($number, $contentType) ->then( function ($response) { return $response[0]; @@ -1529,24 +1618,29 @@ function ($response) { * * Get Fax Line * - * @param string $number The Fax Line number. (required) + * @param string $number The Fax Line number. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineGet'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineGet. This method will eventually become unavailable */ - public function faxLineGetAsyncWithHttpInfo(string $number) + public function faxLineGetAsyncWithHttpInfo(string $number, string $contentType = self::contentTypes['faxLineGet'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; - $request = $this->faxLineGetRequest($number); + $request = $this->faxLineGetRequest($number, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1566,7 +1660,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1575,12 +1669,14 @@ function ($exception) { /** * Create request for operation 'faxLineGet' * - * @param string $number The Fax Line number. (required) + * @param string $number The Fax Line number. (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineGet'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineGet. This method will eventually become unavailable */ - public function faxLineGetRequest(string $number) + public function faxLineGetRequest(string $number, string $contentType = self::contentTypes['faxLineGet'][0]) { // verify the required parameter 'number' is set if ($number === null || (is_array($number) && count($number) === 0)) { @@ -1590,34 +1686,27 @@ public function faxLineGetRequest(string $number) } $resourcePath = '/fax_line'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($number !== null) { - if ('form' === 'form' && is_array($number)) { - foreach ($number as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['number'] = $number; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $number, + 'number', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1635,18 +1724,19 @@ public function faxLineGetRequest(string $number) // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -1666,11 +1756,11 @@ public function faxLineGetRequest(string $number) $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -1681,19 +1771,18 @@ public function faxLineGetRequest(string $number) * * List Fax Lines * - * @param string $account_id Account ID (optional) - * @param int $page Page (optional, default to 1) - * @param int $page_size Page size (optional, default to 20) - * @param bool $show_team_lines Show team lines (optional) + * @param string $account_id Account ID (optional) + * @param int $page Page (optional, default to 1) + * @param int $page_size Page size (optional, default to 20) + * @param bool $show_team_lines Show team lines (optional) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineListResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineList(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null) { list($response) = $this->faxLineListWithHttpInfo($account_id, $page, $page_size, $show_team_lines); - return $response; } @@ -1702,18 +1791,20 @@ public function faxLineList(string $account_id = null, int $page = 1, int $page_ * * List Fax Lines * - * @param string $account_id Account ID (optional) - * @param int $page Page (optional, default to 1) - * @param int $page_size Page size (optional, default to 20) - * @param bool $show_team_lines Show team lines (optional) + * @param string $account_id Account ID (optional) + * @param int $page Page (optional, default to 1) + * @param int $page_size Page size (optional, default to 20) + * @param bool $show_team_lines Show team lines (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineList'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineListResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineList. This method will eventually become unavailable */ - public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null) + public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null, string $contentType = self::contentTypes['faxLineList'][0]) { - $request = $this->faxLineListRequest($account_id, $page, $page_size, $show_team_lines); + $request = $this->faxLineListRequest($account_id, $page, $page_size, $show_team_lines, $contentType); try { $options = $this->createHttpClientOption(); @@ -1723,14 +1814,14 @@ public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1 } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -1743,51 +1834,73 @@ public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1 sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineListResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineListResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineListResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineListResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineListResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineListResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -1796,28 +1909,19 @@ public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1 $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineListResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineListResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -1827,17 +1931,19 @@ public function faxLineListWithHttpInfo(string $account_id = null, int $page = 1 * * List Fax Lines * - * @param string $account_id Account ID (optional) - * @param int $page Page (optional, default to 1) - * @param int $page_size Page size (optional, default to 20) - * @param bool $show_team_lines Show team lines (optional) + * @param string $account_id Account ID (optional) + * @param int $page Page (optional, default to 1) + * @param int $page_size Page size (optional, default to 20) + * @param bool $show_team_lines Show team lines (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineList. This method will eventually become unavailable */ - public function faxLineListAsync(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null) + public function faxLineListAsync(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null, string $contentType = self::contentTypes['faxLineList'][0]) { - return $this->faxLineListAsyncWithHttpInfo($account_id, $page, $page_size, $show_team_lines) + return $this->faxLineListAsyncWithHttpInfo($account_id, $page, $page_size, $show_team_lines, $contentType) ->then( function ($response) { return $response[0]; @@ -1850,27 +1956,32 @@ function ($response) { * * List Fax Lines * - * @param string $account_id Account ID (optional) - * @param int $page Page (optional, default to 1) - * @param int $page_size Page size (optional, default to 20) - * @param bool $show_team_lines Show team lines (optional) + * @param string $account_id Account ID (optional) + * @param int $page Page (optional, default to 1) + * @param int $page_size Page size (optional, default to 20) + * @param bool $show_team_lines Show team lines (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineList'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineList. This method will eventually become unavailable */ - public function faxLineListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null) + public function faxLineListAsyncWithHttpInfo(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null, string $contentType = self::contentTypes['faxLineList'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineListResponse'; - $request = $this->faxLineListRequest($account_id, $page, $page_size, $show_team_lines); + $request = $this->faxLineListRequest($account_id, $page, $page_size, $show_team_lines, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -1890,7 +2001,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -1899,75 +2010,67 @@ function ($exception) { /** * Create request for operation 'faxLineList' * - * @param string $account_id Account ID (optional) - * @param int $page Page (optional, default to 1) - * @param int $page_size Page size (optional, default to 20) - * @param bool $show_team_lines Show team lines (optional) + * @param string $account_id Account ID (optional) + * @param int $page Page (optional, default to 1) + * @param int $page_size Page size (optional, default to 20) + * @param bool $show_team_lines Show team lines (optional) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineList'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineList. This method will eventually become unavailable */ - public function faxLineListRequest(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null) + public function faxLineListRequest(string $account_id = null, int $page = 1, int $page_size = 20, bool $show_team_lines = null, string $contentType = self::contentTypes['faxLineList'][0]) { $resourcePath = '/fax_line/list'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - - $formParams = []; $multipart = false; // query params - if ($account_id !== null) { - if ('form' === 'form' && is_array($account_id)) { - foreach ($account_id as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['account_id'] = $account_id; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $account_id, + 'account_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page !== null) { - if ('form' === 'form' && is_array($page)) { - foreach ($page as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page'] = $page; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page, + 'page', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($page_size !== null) { - if ('form' === 'form' && is_array($page_size)) { - foreach ($page_size as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['page_size'] = $page_size; - } - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $page_size, + 'page_size', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // query params - if ($show_team_lines !== null) { - if ('form' === 'form' && is_array($show_team_lines)) { - foreach ($show_team_lines as $key => $value) { - $queryParams[$key] = $value; - } - } else { - $queryParams['show_team_lines'] = $show_team_lines; - } - } - - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - [] - ); - } + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $show_team_lines, + 'show_team_lines', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) > 0) { @@ -1985,18 +2088,19 @@ public function faxLineListRequest(string $account_id = null, int $page = 1, int // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2016,11 +2120,11 @@ public function faxLineListRequest(string $account_id = null, int $page = 1, int $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'GET', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2033,14 +2137,13 @@ public function faxLineListRequest(string $account_id = null, int $page = 1, int * * @param Model\FaxLineRemoveUserRequest $fax_line_remove_user_request fax_line_remove_user_request (required) * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return Model\FaxLineResponse + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException */ public function faxLineRemoveUser(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request) { list($response) = $this->faxLineRemoveUserWithHttpInfo($fax_line_remove_user_request); - return $response; } @@ -2050,14 +2153,16 @@ public function faxLineRemoveUser(Model\FaxLineRemoveUserRequest $fax_line_remov * Remove Fax Line Access * * @param Model\FaxLineRemoveUserRequest $fax_line_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineRemoveUser'] to see the possible values for this operation * - * @throws ApiException on non-2xx response - * @throws InvalidArgumentException * @return array of Model\FaxLineResponse, HTTP status code, HTTP response headers (array of strings) + * @throws ApiException on non-2xx response or if the response body is not in the expected format + * @throws InvalidArgumentException + * @deprecated Prefer to use ::faxLineRemoveUser. This method will eventually become unavailable */ - public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request) + public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request, string $contentType = self::contentTypes['faxLineRemoveUser'][0]) { - $request = $this->faxLineRemoveUserRequest($fax_line_remove_user_request); + $request = $this->faxLineRemoveUserRequest($fax_line_remove_user_request, $contentType); try { $options = $this->createHttpClientOption(); @@ -2067,14 +2172,14 @@ public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fa } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null + $e->getResponse() ? (string)$e->getResponse()->getBody() : null ); } catch (ConnectException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), + (int)$e->getCode(), null, null ); @@ -2087,51 +2192,73 @@ public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fa sprintf( '[%d] Error connecting to the API (%s)', $statusCode, - (string) $request->getUri() + (string)$request->getUri() ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } - $statusCode = $response->getStatusCode(); - - if ($statusCode === 200) { - if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } - - return [ - ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + $result = $this->handleRangeCodeResponse( + $response, + '4XX', + '\Dropbox\Sign\Model\ErrorResponse' + ); + if ($result) { + return $result; } - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - if ('\Dropbox\Sign\Model\ErrorResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - } + switch ($statusCode) { + case 200: + if ('\Dropbox\Sign\Model\FaxLineResponse' === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + if ('\Dropbox\Sign\Model\FaxLineResponse' !== 'string') { + try { + $content = json_decode($content, false, 512, 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, '\Dropbox\Sign\Model\ErrorResponse', []), - $response->getStatusCode(), - $response->getHeaders(), - ]; + return [ + ObjectSerializer::deserialize($content, '\Dropbox\Sign\Model\FaxLineResponse', []), + $response->getStatusCode(), + $response->getHeaders(), + ]; } $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $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 [ @@ -2140,28 +2267,19 @@ public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fa $response->getHeaders(), ]; } catch (ApiException $e) { - $statusCode = $e->getCode(); - - if ($statusCode === 200) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\FaxLineResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - } - - $rangeCodeLeft = (int) (substr('4XX', 0, 1) . '00'); - $rangeCodeRight = (int) (substr('4XX', 0, 1) . '99'); - if ($statusCode >= $rangeCodeLeft && $statusCode <= $rangeCodeRight) { - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Dropbox\Sign\Model\ErrorResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); + if ($this->handleRangeCodeException($e, '4XX', '\Dropbox\Sign\Model\ErrorResponse')) { + throw $e; + } + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Dropbox\Sign\Model\FaxLineResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } - throw $e; } } @@ -2172,13 +2290,15 @@ public function faxLineRemoveUserWithHttpInfo(Model\FaxLineRemoveUserRequest $fa * Remove Fax Line Access * * @param Model\FaxLineRemoveUserRequest $fax_line_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineRemoveUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineRemoveUser. This method will eventually become unavailable */ - public function faxLineRemoveUserAsync(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request) + public function faxLineRemoveUserAsync(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request, string $contentType = self::contentTypes['faxLineRemoveUser'][0]) { - return $this->faxLineRemoveUserAsyncWithHttpInfo($fax_line_remove_user_request) + return $this->faxLineRemoveUserAsyncWithHttpInfo($fax_line_remove_user_request, $contentType) ->then( function ($response) { return $response[0]; @@ -2192,23 +2312,28 @@ function ($response) { * Remove Fax Line Access * * @param Model\FaxLineRemoveUserRequest $fax_line_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineRemoveUser'] to see the possible values for this operation * + * @return \GuzzleHttp\Promise\PromiseInterface * @throws InvalidArgumentException - * @return Promise\PromiseInterface + * @deprecated Prefer to use ::faxLineRemoveUser. This method will eventually become unavailable */ - public function faxLineRemoveUserAsyncWithHttpInfo(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request) + public function faxLineRemoveUserAsyncWithHttpInfo(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request, string $contentType = self::contentTypes['faxLineRemoveUser'][0]) { $returnType = '\Dropbox\Sign\Model\FaxLineResponse'; - $request = $this->faxLineRemoveUserRequest($fax_line_remove_user_request); + $request = $this->faxLineRemoveUserRequest($fax_line_remove_user_request, $contentType); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer + $content = $response->getBody(); // stream goes to serializer } else { - $content = (string) $response->getBody(); + $content = (string)$response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } } return [ @@ -2228,7 +2353,7 @@ function ($exception) { ), $statusCode, $response->getHeaders(), - (string) $response->getBody() + (string)$response->getBody() ); } ); @@ -2238,11 +2363,13 @@ function ($exception) { * Create request for operation 'faxLineRemoveUser' * * @param Model\FaxLineRemoveUserRequest $fax_line_remove_user_request (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['faxLineRemoveUser'] to see the possible values for this operation * + * @return Request * @throws InvalidArgumentException - * @return Psr7\Request + * @deprecated Prefer to use ::faxLineRemoveUser. This method will eventually become unavailable */ - public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request) + public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_line_remove_user_request, string $contentType = self::contentTypes['faxLineRemoveUser'][0]) { // verify the required parameter 'fax_line_remove_user_request' is set if ($fax_line_remove_user_request === null || (is_array($fax_line_remove_user_request) && count($fax_line_remove_user_request) === 0)) { @@ -2252,9 +2379,11 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin } $resourcePath = '/fax_line/remove_user'; + $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; + $multipart = false; $formParams = ObjectSerializer::getFormParams( $fax_line_remove_user_request @@ -2262,21 +2391,17 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin $multipart = !empty($formParams); - if ($multipart) { - $headers = $this->headerSelector->selectHeadersForMultipart( - ['multipart/form-data'] - ); - } else { - $headers = $this->headerSelector->selectHeaders( - ['application/json'], - ['application/json'] - ); - } + $headers = $this->headerSelector->selectHeaders( + $multipart ? ['multipart/form-data'] : ['application/json'], + $contentType, + $multipart + ); // for model (json/xml) if (count($formParams) === 0) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_remove_user_request)); + if (stripos($headers['Content-Type'], 'application/json') !== false) { + // if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($fax_line_remove_user_request)); } else { $httpBody = $fax_line_remove_user_request; } @@ -2295,9 +2420,9 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin // for HTTP post (form) if (!empty($body)) { $multipartContents[] = [ - 'name' => 'body', + 'name' => 'body', 'contents' => $body, - 'headers' => ['Content-Type' => 'application/json'], + 'headers' => ['Content-Type' => 'application/json'], ]; } @@ -2305,12 +2430,13 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin $payloadHook('multipart', $multipartContents, $fax_line_remove_user_request); } - $httpBody = new Psr7\MultipartStream($multipartContents); - } elseif ($headers['Content-Type'] === 'application/json') { - $httpBody = Utils::jsonEncode($formParams); + $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 = Psr7\Query::build($formParams); + $httpBody = ObjectSerializer::buildQuery($formParams); } } @@ -2330,11 +2456,11 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin $headers ); - $query = Psr7\Query::build($queryParams); - - return new Psr7\Request( + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( 'PUT', - $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody ); @@ -2343,12 +2469,12 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin /** * Create http client option * - * @throws RuntimeException on file opening failure * @return array of http client options + * @throws RuntimeException on file opening failure */ protected function createHttpClientOption() { - $options = $this->config->getOptions(); + $options = []; if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { @@ -2358,4 +2484,66 @@ protected function createHttpClientOption() return $options; } + + /** + * @return object|array|null + */ + private function handleRangeCodeResponse( + ResponseInterface $response, + string $rangeCode, + string $returnDataType + ) { + $statusCode = $response->getStatusCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return null; + } + + if ($returnDataType === '\SplFileObject') { + $content = $response->getBody(); // stream goes to serializer + } else { + $content = (string)$response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnDataType, []), + $statusCode, + $response->getHeaders(), + ]; + } + + /** + * @return object|array|null + */ + private function handleRangeCodeException( + ApiException $e, + string $rangeCode, + string $exceptionDataType + ): bool { + $statusCode = $e->getCode(); + $rangeCodeLeft = (int)(substr($rangeCode, 0, 1) . '00'); + $rangeCodeRight = (int)(substr($rangeCode, 0, 1) . '99'); + + if ( + $statusCode < $rangeCodeLeft + || $statusCode > $rangeCodeRight + ) { + return false; + } + + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + $exceptionDataType, + $e->getResponseHeaders() + ); + + $e->setResponseObject($data); + + return true; + } } diff --git a/sdks/php/src/Model/FaxLineAddUserRequest.php b/sdks/php/src/Model/FaxLineAddUserRequest.php index 02c975ca4..d1f5b3f6e 100644 --- a/sdks/php/src/Model/FaxLineAddUserRequest.php +++ b/sdks/php/src/Model/FaxLineAddUserRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * FaxLineAddUserRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FaxLineAddUserRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class FaxLineAddUserRequest implements ModelInterface, ArrayAccess, JsonSerializ 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'account_id' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineAddUserRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineAddUserRequest { - /** @var FaxLineAddUserRequest $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineAddUserRequest */ + return ObjectSerializer::deserialize( $data, FaxLineAddUserRequest::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -223,7 +300,6 @@ public function listInvalidProperties() if ($this->container['number'] === null) { $invalidProperties[] = "'number' can't be null"; } - return $invalidProperties; } @@ -257,6 +333,9 @@ public function getNumber() */ public function setNumber(string $number) { + if (is_null($number)) { + throw new InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -281,6 +360,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -305,6 +387,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -313,12 +398,10 @@ public function setEmailAddress(?string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -326,7 +409,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -339,13 +422,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -357,12 +438,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -371,8 +450,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php index d310fb693..111c20b6d 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * FaxLineAreaCodeGetCountryEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class FaxLineAreaCodeGetCountryEnum diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php index 4342c33ce..e81d86818 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * FaxLineAreaCodeGetProvinceEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class FaxLineAreaCodeGetProvinceEnum diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php b/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php index 502d55db5..c02f07681 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FaxLineAreaCodeGetResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FaxLineAreaCodeGetResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -75,6 +71,22 @@ class FaxLineAreaCodeGetResponse implements ModelInterface, ArrayAccess, JsonSer 'area_codes' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'area_codes' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -95,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -167,37 +223,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['area_codes'] = $data['area_codes'] ?? null; + $this->setIfExists('area_codes', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineAreaCodeGetResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineAreaCodeGetResponse { - /** @var FaxLineAreaCodeGetResponse $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineAreaCodeGetResponse */ + return ObjectSerializer::deserialize( $data, FaxLineAreaCodeGetResponse::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -207,9 +281,7 @@ public static function init(array $data): FaxLineAreaCodeGetResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -242,6 +314,9 @@ public function getAreaCodes() */ public function setAreaCodes(?array $area_codes) { + if (is_null($area_codes)) { + throw new InvalidArgumentException('non-nullable area_codes cannot be null'); + } $this->container['area_codes'] = $area_codes; return $this; @@ -250,12 +325,10 @@ public function setAreaCodes(?array $area_codes) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -263,7 +336,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -276,13 +349,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -294,12 +365,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -308,8 +377,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php index 14e49fe85..ed3e29355 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -32,7 +31,6 @@ * FaxLineAreaCodeGetStateEnum Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ class FaxLineAreaCodeGetStateEnum diff --git a/sdks/php/src/Model/FaxLineCreateRequest.php b/sdks/php/src/Model/FaxLineCreateRequest.php index cda0fe017..3463881c7 100644 --- a/sdks/php/src/Model/FaxLineCreateRequest.php +++ b/sdks/php/src/Model/FaxLineCreateRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -38,11 +37,8 @@ * FaxLineCreateRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FaxLineCreateRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class FaxLineCreateRequest implements ModelInterface, ArrayAccess, JsonSerializa 'account_id' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'area_code' => false, + 'country' => false, + 'city' => false, + 'account_id' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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,40 +259,58 @@ public function getCountryAllowableValues() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['area_code'] = $data['area_code'] ?? null; - $this->container['country'] = $data['country'] ?? null; - $this->container['city'] = $data['city'] ?? null; - $this->container['account_id'] = $data['account_id'] ?? null; + $this->setIfExists('area_code', $data ?? [], null); + $this->setIfExists('country', $data ?? [], null); + $this->setIfExists('city', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineCreateRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineCreateRequest { - /** @var FaxLineCreateRequest $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineCreateRequest */ + return ObjectSerializer::deserialize( $data, FaxLineCreateRequest::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -293,6 +370,9 @@ public function getAreaCode() */ public function setAreaCode(int $area_code) { + if (is_null($area_code)) { + throw new InvalidArgumentException('non-nullable area_code cannot be null'); + } $this->container['area_code'] = $area_code; return $this; @@ -317,6 +397,9 @@ public function getCountry() */ public function setCountry(string $country) { + if (is_null($country)) { + throw new InvalidArgumentException('non-nullable country cannot be null'); + } $allowedValues = $this->getCountryAllowableValues(); if (!in_array($country, $allowedValues, true)) { throw new InvalidArgumentException( @@ -351,6 +434,9 @@ public function getCity() */ public function setCity(?string $city) { + if (is_null($city)) { + throw new InvalidArgumentException('non-nullable city cannot be null'); + } $this->container['city'] = $city; return $this; @@ -375,6 +461,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -383,12 +472,10 @@ public function setAccountId(?string $account_id) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -396,7 +483,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -409,13 +496,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -427,12 +512,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -441,8 +524,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineDeleteRequest.php b/sdks/php/src/Model/FaxLineDeleteRequest.php index cb3152aa8..2df4e4325 100644 --- a/sdks/php/src/Model/FaxLineDeleteRequest.php +++ b/sdks/php/src/Model/FaxLineDeleteRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * FaxLineDeleteRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FaxLineDeleteRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -74,6 +71,22 @@ class FaxLineDeleteRequest implements ModelInterface, ArrayAccess, JsonSerializa 'number' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'number' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -94,6 +107,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -166,37 +223,55 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; + $this->setIfExists('number', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineDeleteRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineDeleteRequest { - /** @var FaxLineDeleteRequest $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineDeleteRequest */ + return ObjectSerializer::deserialize( $data, FaxLineDeleteRequest::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -211,7 +286,6 @@ public function listInvalidProperties() if ($this->container['number'] === null) { $invalidProperties[] = "'number' can't be null"; } - return $invalidProperties; } @@ -245,6 +319,9 @@ public function getNumber() */ public function setNumber(string $number) { + if (is_null($number)) { + throw new InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -253,12 +330,10 @@ public function setNumber(string $number) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -266,7 +341,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -279,13 +354,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -297,12 +370,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -311,8 +382,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineListResponse.php b/sdks/php/src/Model/FaxLineListResponse.php index 18c13f69c..855c2c1e4 100644 --- a/sdks/php/src/Model/FaxLineListResponse.php +++ b/sdks/php/src/Model/FaxLineListResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FaxLineListResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FaxLineListResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -79,6 +75,24 @@ class FaxLineListResponse implements ModelInterface, ArrayAccess, JsonSerializab 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'list_info' => false, + 'fax_lines' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -99,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -177,39 +235,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['list_info'] = $data['list_info'] ?? null; - $this->container['fax_lines'] = $data['fax_lines'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('list_info', $data ?? [], null); + $this->setIfExists('fax_lines', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineListResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineListResponse { - /** @var FaxLineListResponse $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineListResponse */ + return ObjectSerializer::deserialize( $data, FaxLineListResponse::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -219,9 +295,7 @@ public static function init(array $data): FaxLineListResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -254,6 +328,9 @@ public function getListInfo() */ public function setListInfo(?ListInfoResponse $list_info) { + if (is_null($list_info)) { + throw new InvalidArgumentException('non-nullable list_info cannot be null'); + } $this->container['list_info'] = $list_info; return $this; @@ -278,6 +355,9 @@ public function getFaxLines() */ public function setFaxLines(?array $fax_lines) { + if (is_null($fax_lines)) { + throw new InvalidArgumentException('non-nullable fax_lines cannot be null'); + } $this->container['fax_lines'] = $fax_lines; return $this; @@ -302,6 +382,9 @@ public function getWarnings() */ public function setWarnings(?WarningResponse $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -310,12 +393,10 @@ public function setWarnings(?WarningResponse $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -323,7 +404,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -336,13 +417,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -354,12 +433,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -368,8 +445,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineRemoveUserRequest.php b/sdks/php/src/Model/FaxLineRemoveUserRequest.php index fcc2b1f97..b876f78c4 100644 --- a/sdks/php/src/Model/FaxLineRemoveUserRequest.php +++ b/sdks/php/src/Model/FaxLineRemoveUserRequest.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,11 +37,8 @@ * FaxLineRemoveUserRequest Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null + * @implements \ArrayAccess */ class FaxLineRemoveUserRequest implements ModelInterface, ArrayAccess, JsonSerializable { @@ -78,6 +75,24 @@ class FaxLineRemoveUserRequest implements ModelInterface, ArrayAccess, JsonSeria 'email_address' => 'email', ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'account_id' => false, + 'email_address' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -98,6 +113,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -176,39 +235,57 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; - $this->container['account_id'] = $data['account_id'] ?? null; - $this->container['email_address'] = $data['email_address'] ?? null; + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('account_id', $data ?? [], null); + $this->setIfExists('email_address', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineRemoveUserRequest { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineRemoveUserRequest { - /** @var FaxLineRemoveUserRequest $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineRemoveUserRequest */ + return ObjectSerializer::deserialize( $data, FaxLineRemoveUserRequest::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -223,7 +300,6 @@ public function listInvalidProperties() if ($this->container['number'] === null) { $invalidProperties[] = "'number' can't be null"; } - return $invalidProperties; } @@ -257,6 +333,9 @@ public function getNumber() */ public function setNumber(string $number) { + if (is_null($number)) { + throw new InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -281,6 +360,9 @@ public function getAccountId() */ public function setAccountId(?string $account_id) { + if (is_null($account_id)) { + throw new InvalidArgumentException('non-nullable account_id cannot be null'); + } $this->container['account_id'] = $account_id; return $this; @@ -305,6 +387,9 @@ public function getEmailAddress() */ public function setEmailAddress(?string $email_address) { + if (is_null($email_address)) { + throw new InvalidArgumentException('non-nullable email_address cannot be null'); + } $this->container['email_address'] = $email_address; return $this; @@ -313,12 +398,10 @@ public function setEmailAddress(?string $email_address) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -326,7 +409,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -339,13 +422,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -357,12 +438,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -371,8 +450,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineResponse.php b/sdks/php/src/Model/FaxLineResponse.php index f8676d7b0..5d0875cc5 100644 --- a/sdks/php/src/Model/FaxLineResponse.php +++ b/sdks/php/src/Model/FaxLineResponse.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FaxLineResponse Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FaxLineResponse implements ModelInterface, ArrayAccess, JsonSerializable { @@ -77,6 +73,23 @@ class FaxLineResponse implements ModelInterface, ArrayAccess, JsonSerializable 'warnings' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'fax_line' => false, + 'warnings' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -97,6 +110,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -172,38 +229,56 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['fax_line'] = $data['fax_line'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; + $this->setIfExists('fax_line', $data ?? [], null); + $this->setIfExists('warnings', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineResponse { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineResponse { - /** @var FaxLineResponse $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineResponse */ + return ObjectSerializer::deserialize( $data, FaxLineResponse::class, ); + } + + /** + * 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|int|object|array|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; + } - return $obj; + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; } /** @@ -213,9 +288,7 @@ public static function init(array $data): FaxLineResponse */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -248,6 +321,9 @@ public function getFaxLine() */ public function setFaxLine(?FaxLineResponseFaxLine $fax_line) { + if (is_null($fax_line)) { + throw new InvalidArgumentException('non-nullable fax_line cannot be null'); + } $this->container['fax_line'] = $fax_line; return $this; @@ -272,6 +348,9 @@ public function getWarnings() */ public function setWarnings(?WarningResponse $warnings) { + if (is_null($warnings)) { + throw new InvalidArgumentException('non-nullable warnings cannot be null'); + } $this->container['warnings'] = $warnings; return $this; @@ -280,12 +359,10 @@ public function setWarnings(?WarningResponse $warnings) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -293,7 +370,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -306,13 +383,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -324,12 +399,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -338,8 +411,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/src/Model/FaxLineResponseFaxLine.php b/sdks/php/src/Model/FaxLineResponseFaxLine.php index 6ccc2ddf5..3a34a3a9a 100644 --- a/sdks/php/src/Model/FaxLineResponseFaxLine.php +++ b/sdks/php/src/Model/FaxLineResponseFaxLine.php @@ -5,7 +5,6 @@ * PHP version 7.4 * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech */ @@ -17,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * OpenAPI Generator version: 5.3.0 + * Generator version: 7.7.0 */ /** @@ -30,6 +29,7 @@ use ArrayAccess; use Dropbox\Sign\ObjectSerializer; +use InvalidArgumentException; use JsonSerializable; use ReturnTypeWillChange; @@ -37,12 +37,8 @@ * FaxLineResponseFaxLine Class Doc Comment * * @category Class - * @author OpenAPI Generator team * @see https://openapi-generator.tech - * @implements \ArrayAccess - * @template TKey int|null - * @template TValue mixed|null - * @internal This class should not be instantiated directly + * @implements \ArrayAccess */ class FaxLineResponseFaxLine implements ModelInterface, ArrayAccess, JsonSerializable { @@ -81,6 +77,25 @@ class FaxLineResponseFaxLine implements ModelInterface, ArrayAccess, JsonSeriali 'accounts' => null, ]; + /** + * Array of nullable properties. Used for (de)serialization + * + * @var bool[] + */ + protected static array $openAPINullables = [ + 'number' => false, + 'created_at' => false, + 'updated_at' => false, + 'accounts' => false, + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var bool[] + */ + protected array $openAPINullablesSetToNull = []; + /** * Array of property to type mappings. Used for (de)serialization * @@ -101,6 +116,50 @@ public static function openAPIFormats() return self::$openAPIFormats; } + /** + * Array of nullable properties + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return bool[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param bool[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + */ + 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 @@ -182,40 +241,58 @@ public function getModelName() /** * Associative array for storing property values * - * @var array + * @var mixed[] */ protected $container = []; /** * Constructor * - * @param array|null $data Associated array of property values - * initializing the model + * @param mixed[] $data Associated array of property values + * initializing the model */ public function __construct(array $data = null) { - $this->container['number'] = $data['number'] ?? null; - $this->container['created_at'] = $data['created_at'] ?? null; - $this->container['updated_at'] = $data['updated_at'] ?? null; - $this->container['accounts'] = $data['accounts'] ?? null; + $this->setIfExists('number', $data ?? [], null); + $this->setIfExists('created_at', $data ?? [], null); + $this->setIfExists('updated_at', $data ?? [], null); + $this->setIfExists('accounts', $data ?? [], null); } - /** @deprecated use ::init() */ + /** + * @deprecated use ::init() + */ public static function fromArray(array $data): FaxLineResponseFaxLine { return self::init($data); } - /** Attempt to instantiate and hydrate a new instance of this class */ + /** + * Attempt to instantiate and hydrate a new instance of this class + */ public static function init(array $data): FaxLineResponseFaxLine { - /** @var FaxLineResponseFaxLine $obj */ - $obj = ObjectSerializer::deserialize( + /** @var FaxLineResponseFaxLine */ + return ObjectSerializer::deserialize( $data, FaxLineResponseFaxLine::class, ); + } - return $obj; + /** + * 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|int|object|array|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; } /** @@ -225,9 +302,7 @@ public static function init(array $data): FaxLineResponseFaxLine */ public function listInvalidProperties() { - $invalidProperties = []; - - return $invalidProperties; + return []; } /** @@ -260,6 +335,9 @@ public function getNumber() */ public function setNumber(?string $number) { + if (is_null($number)) { + throw new InvalidArgumentException('non-nullable number cannot be null'); + } $this->container['number'] = $number; return $this; @@ -284,6 +362,9 @@ public function getCreatedAt() */ public function setCreatedAt(?int $created_at) { + if (is_null($created_at)) { + throw new InvalidArgumentException('non-nullable created_at cannot be null'); + } $this->container['created_at'] = $created_at; return $this; @@ -308,6 +389,9 @@ public function getUpdatedAt() */ public function setUpdatedAt(?int $updated_at) { + if (is_null($updated_at)) { + throw new InvalidArgumentException('non-nullable updated_at cannot be null'); + } $this->container['updated_at'] = $updated_at; return $this; @@ -332,6 +416,9 @@ public function getAccounts() */ public function setAccounts(?array $accounts) { + if (is_null($accounts)) { + throw new InvalidArgumentException('non-nullable accounts cannot be null'); + } $this->container['accounts'] = $accounts; return $this; @@ -340,12 +427,10 @@ public function setAccounts(?array $accounts) /** * Returns true if offset exists. False otherwise. * - * @param mixed $offset Offset - * - * @return bool + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetExists($offset) + public function offsetExists($offset): bool { return isset($this->container[$offset]); } @@ -353,7 +438,7 @@ public function offsetExists($offset) /** * Gets offset. * - * @param mixed $offset Offset + * @param int $offset Offset * * @return mixed|null */ @@ -366,13 +451,11 @@ public function offsetGet($offset) /** * Sets value based on offset. * - * @param mixed $offset Offset - * @param mixed $value Value to be set - * - * @return void + * @param int|null $offset Offset + * @param mixed $value Value to be set */ #[ReturnTypeWillChange] - public function offsetSet($offset, $value) + public function offsetSet($offset, $value): void { if (is_null($offset)) { $this->container[] = $value; @@ -384,12 +467,10 @@ public function offsetSet($offset, $value) /** * Unsets offset. * - * @param mixed $offset Offset - * - * @return void + * @param int $offset Offset */ #[ReturnTypeWillChange] - public function offsetUnset($offset) + public function offsetUnset($offset): void { unset($this->container[$offset]); } @@ -398,8 +479,8 @@ public function offsetUnset($offset) * Serializes the object to a value that can be serialized natively by json_encode(). * @see https://www.php.net/manual/en/jsonserializable.jsonserialize.php * - * @return scalar|object|array|null returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource + * @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() diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index 6aefc4408..d6929bd34 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -47,6 +47,7 @@ class ApiException extends Exception /** * The deserialized response object * +{{! CUSTOM - \stdClass to Model\ErrorResponse }} * @var Model\ErrorResponse|string|null */ protected $responseObject; @@ -89,6 +90,7 @@ class ApiException extends Exception /** * Sets the deserialized response object (during deserialization) * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $obj Deserialized response object * * @return void @@ -101,6 +103,7 @@ class ApiException extends Exception /** * Gets the deserialized response object (during deserialization) * +{{! CUSTOM - mixed to Model\ErrorResponse }} * @return Model\ErrorResponse the deserialized response object */ public function getResponseObject() diff --git a/sdks/php/templates/Configuration.mustache b/sdks/php/templates/Configuration.mustache index 62ee01f9b..97d1d3d15 100644 --- a/sdks/php/templates/Configuration.mustache +++ b/sdks/php/templates/Configuration.mustache @@ -114,6 +114,7 @@ class Configuration */ protected $tempFolderPath; +{{! CUSTOM - BEGIN }} /** * Holds any extra request options you want to send * @@ -123,6 +124,7 @@ class Configuration /** @var ?callable */ protected $payloadHook = null; +{{! CUSTOM - END }} /** * Constructor @@ -140,6 +142,7 @@ class Configuration * * @return $this */ +{{! CUSTOM - public to protected }} protected function setApiKey($apiKeyIdentifier, $key) { $this->apiKeys[$apiKeyIdentifier] = $key; @@ -153,6 +156,7 @@ class Configuration * * @return null|string API key or token */ +{{! CUSTOM - public to protected }} protected function getApiKey($apiKeyIdentifier) { return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; @@ -166,6 +170,7 @@ class Configuration * * @return $this */ +{{! CUSTOM - public to protected }} protected function setApiKeyPrefix($apiKeyIdentifier, $prefix) { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; @@ -179,6 +184,7 @@ class Configuration * * @return null|string */ +{{! CUSTOM - public to protected }} protected function getApiKeyPrefix($apiKeyIdentifier) { return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; @@ -214,6 +220,7 @@ class Configuration * * @return $this */ +{{! CUSTOM - public to protected }} protected function setBooleanFormatForQueryString(string $booleanFormat) { $this->booleanFormatForQueryString = $booleanFormat; @@ -261,6 +268,7 @@ class Configuration * * @return $this */ +{{! CUSTOM - public to protected }} protected function setPassword($password) { $this->password = $password; @@ -272,6 +280,7 @@ class Configuration * * @return string Password for HTTP basic authentication */ +{{! CUSTOM - public to protected }} protected function getPassword() { return $this->password; @@ -449,6 +458,7 @@ class Configuration * * @return null|string API key with the prefix */ +{{! CUSTOM - public to protected }} protected function getApiKeyWithPrefix($apiKeyIdentifier) { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); @@ -556,6 +566,7 @@ class Configuration return self::getHostString($this->getHostSettings(), $index, $variables); } +{{! CUSTOM - BEGIN }} public function setOptions(array $options): self { $this->options = $options; @@ -584,4 +595,5 @@ class Configuration { return $this->payloadHook; } +{{! CUSTOM - END }} } diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index cc7a940f4..6a64ec8af 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -19,6 +19,7 @@ namespace {{invokerPackage}}; +{{! CUSTOM - add \GuzzleHttp }} use GuzzleHttp; use GuzzleHttp\Psr7\Utils; use {{modelPackage}}\ModelInterface; @@ -49,6 +50,7 @@ class ObjectSerializer /** * Serialize data * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $data the data to serialize * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data @@ -90,12 +92,19 @@ class ObjectSerializer } } } +{{#vendorExtensions.x-ignore-block}} + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} if ($value !== null) { +{{! CUSTOM - END }} $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } +{{! CUSTOM - BEGIN }} } else if ($data instanceof \SplFileObject) { return (string) $data; +{{! CUSTOM - END }} } else { foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); @@ -154,6 +163,7 @@ class ObjectSerializer /** * Checks if a value is empty, based on its OpenAPI type. * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $value * @param string $openApiType * @@ -198,6 +208,7 @@ class ObjectSerializer * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $value Parameter value * @param string $paramName Parameter name * @param string $openApiType OpenAPIType eg. array or object @@ -332,6 +343,7 @@ class ObjectSerializer * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * +{{! CUSTOM - float|int|bool|\DateTime to string|int|object|array|mixed }} * @param string|int|object|array|mixed $value the value of the parameter * * @return string the header string @@ -387,6 +399,7 @@ class ObjectSerializer /** * Deserialize a JSON string into an object * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $data object or primitive to be deserialized * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers @@ -506,6 +519,7 @@ class ObjectSerializer // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; +{{! CUSTOM - BEGIN }} $discriminatorValue = null; if (is_object($data)) { $discriminatorValue = $data->{$discriminator} ?? null; @@ -514,14 +528,18 @@ class ObjectSerializer } $discrimnatorSubclassFound = false; +{{! CUSTOM - END }} if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; if (is_subclass_of($subclass, $class)) { $class = $subclass; +{{! CUSTOM - BEGIN }} $discrimnatorSubclassFound = true; +{{! CUSTOM - END }} } } +{{! CUSTOM - BEGIN }} if ( !$discrimnatorSubclassFound && !empty($discriminator) @@ -539,6 +557,7 @@ class ObjectSerializer $class = $subclass; $discrimnatorSubclassFound = true; } +{{! CUSTOM - END }} /** @var ModelInterface $instance */ $instance = new $class(); @@ -628,6 +647,7 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } +{{! CUSTOM - BEGIN }} /** * Allows a multipart/form-data request to grab data from the typed * class created by OpenAPI. @@ -698,4 +718,5 @@ class ObjectSerializer return $hasFile ? $formParams : []; } +{{! CUSTOM - END }} } diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 9b5d4eda2..4db18c2e0 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -25,12 +25,14 @@ use GuzzleHttp\Exception\RequestException; use GuzzleHttp\Psr7\MultipartStream; use GuzzleHttp\Psr7\Request; use GuzzleHttp\RequestOptions; -use Psr\Http\Message\ResponseInterface; use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; -use {{invokerPackage}}\Model; use {{invokerPackage}}\ObjectSerializer; +{{! CUSTOM - BEGIN }} +use {{invokerPackage}}\Model; +use Psr\Http\Message\ResponseInterface; +{{! CUSTOM - END }} /** * {{classname}} Class Doc Comment @@ -71,11 +73,25 @@ use {{invokerPackage}}\ObjectSerializer; {{/consumes}} ],{{/operation}} ]; - /** - * @var ResponseInterface|null - */ +{{! CUSTOM - BEGIN }} + /** @var ResponseInterface|null */ protected $response; +{{! CUSTOM - END }} +{{#vendorExtensions.x-ignore-block}} + /** + * @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 + ) { +{{/vendorExtensions.x-ignore-block}} /** * @param Configuration $config * @param ClientInterface $client @@ -98,6 +114,7 @@ use {{invokerPackage}}\ObjectSerializer; * Set the host index * * @param int $hostIndex Host index (required) +{{! CUSTOM - Add @deprecated }} * @deprecated To be made private in the future */ public function setHostIndex($hostIndex): void @@ -109,6 +126,7 @@ use {{invokerPackage}}\ObjectSerializer; * Get the host index * * @return int Host index +{{! CUSTOM - Add @deprecated }} * @deprecated To be made private in the future */ public function getHostIndex() @@ -124,6 +142,7 @@ use {{invokerPackage}}\ObjectSerializer; return $this->config; } +{{! CUSTOM - BEGIN }} /** * @return ResponseInterface|null */ @@ -131,6 +150,7 @@ use {{invokerPackage}}\ObjectSerializer; { return $this->response; } +{{! CUSTOM - END }} {{#operation}} /** @@ -171,6 +191,15 @@ use {{invokerPackage}}\ObjectSerializer; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} +{{#vendorExtensions.x-ignore-block}} +{{#servers}} +{{#-first}} + * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead + * @param array $variables Associative array of variables to pass to the host. Defaults to empty array. +{{/-first}} +{{/servers}} + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation +{{/vendorExtensions.x-ignore-block}} * * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException @@ -179,10 +208,18 @@ use {{invokerPackage}}\ObjectSerializer; * @deprecated {{/isDeprecated}} */ +{{#vendorExtensions.x-ignore-block}} + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + return $response;{{/returnType}} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return $response;{{/returnType}} +{{! CUSTOM - END }} } /** @@ -234,6 +271,7 @@ use {{invokerPackage}}\ObjectSerializer; * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) +{{! CUSTOM - Add @deprecated }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable {{#isDeprecated}} * @deprecated @@ -247,6 +285,7 @@ use {{invokerPackage}}\ObjectSerializer; $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); +{{! CUSTOM - Set $this->response }} $this->response = $response; } catch (RequestException $e) { throw new ApiException( @@ -279,6 +318,7 @@ use {{invokerPackage}}\ObjectSerializer; ); } {{#returnType}} +{{! CUSTOM - BEGIN }} {{#responses}}{{#dataType}}{{#isRange}} $result = $this->handleRangeCodeResponse( $response, @@ -289,6 +329,7 @@ use {{invokerPackage}}\ObjectSerializer; return $result; } {{/isRange}}{{/dataType}}{{/responses}} +{{! CUSTOM - END }} {{#responses}} {{#-first}} @@ -362,10 +403,12 @@ use {{invokerPackage}}\ObjectSerializer; {{/returnType}} } catch (ApiException $e) { +{{! CUSTOM - BEGIN }} {{#responses}}{{#dataType}}{{#isRange}} if ($this->handleRangeCodeException($e, '{{code}}', '{{{dataType}}}')) { throw $e; }{{/isRange}}{{/dataType}}{{/responses}} +{{! CUSTOM - END }} switch ($e->getCode()) { {{#responses}} {{#dataType}} @@ -432,6 +475,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface +{{! CUSTOM - add @deprecated }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable {{#isDeprecated}} * @deprecated @@ -495,6 +539,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface +{{! CUSTOM - add @deprecated }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable {{#isDeprecated}} * @deprecated @@ -586,6 +631,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request +{{! CUSTOM - add @deprecated }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable {{#isDeprecated}} * @deprecated @@ -656,6 +702,7 @@ use {{invokerPackage}}\ObjectSerializer; $httpBody = ''; $multipart = false; +{{! CUSTOM - BEGIN }} {{#bodyParam}} $formParams = ObjectSerializer::getFormParams( ${{paramName}} @@ -663,6 +710,7 @@ use {{invokerPackage}}\ObjectSerializer; $multipart = !empty($formParams); {{/bodyParam}} +{{! CUSTOM - END }} {{#queryParams}} // query params @@ -725,6 +773,7 @@ use {{invokerPackage}}\ObjectSerializer; {{/formParams}} $headers = $this->headerSelector->selectHeaders( +{{! CUSTOM - ternary on $multipart }} $multipart ? ['multipart/form-data'] : [{{#produces}}'{{{mediaType}}}', {{/produces}}], $contentType, $multipart @@ -732,6 +781,7 @@ use {{invokerPackage}}\ObjectSerializer; // for model (json/xml) {{#bodyParams}} +{{! CUSTOM - count on $formParam instead of check on $paramName }} if (count($formParams) === 0) { if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body @@ -756,6 +806,7 @@ use {{invokerPackage}}\ObjectSerializer; } } // for HTTP post (form) +{{! CUSTOM - BEGIN }} if (!empty($body)) { $multipartContents[] = [ 'name' => 'body', @@ -769,6 +820,7 @@ use {{invokerPackage}}\ObjectSerializer; $payloadHook('multipart', $multipartContents, ${{paramName}}); } {{/bodyParam}} +{{! CUSTOM - END }} $httpBody = new MultipartStream($multipartContents); @@ -792,8 +844,14 @@ use {{invokerPackage}}\ObjectSerializer; {{#isBasic}} {{#isBasicBasic}} // this endpoint requires HTTP basic authentication +{{#vendorExtensions.x-ignore-block}} + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} if (!empty($this->config->getUsername())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ':'); +{{! CUSTOM - END }} } {{/isBasicBasic}} {{#isBasicBearer}} @@ -907,6 +965,7 @@ use {{invokerPackage}}\ObjectSerializer; return $options; } +{{! CUSTOM - BEGIN }} /** * @return object|array|null */ @@ -968,5 +1027,6 @@ use {{invokerPackage}}\ObjectSerializer; return true; } +{{! CUSTOM - END }} } {{/operations}} diff --git a/sdks/php/templates/composer.mustache b/sdks/php/templates/composer.mustache index 8e4e03bc6..4c84c3cfa 100644 --- a/sdks/php/templates/composer.mustache +++ b/sdks/php/templates/composer.mustache @@ -2,6 +2,11 @@ {{#composerPackageName}} "name": "{{{.}}}", {{/composerPackageName}} +{{#vendorExtensions.x-ignore-block}} + {{#artifactVersion}} + "version": "{{{.}}}", + {{/artifactVersion}} +{{/vendorExtensions.x-ignore-block}} "description": "{{{appDescription}}}", "keywords": [ "openapitools", @@ -11,8 +16,10 @@ "sdk", "rest", "api", +{{! CUSTOM - BEGIN }} "hellosign", "dropboxsign" +{{! CUSTOM - END }} ], "homepage": "{{{artifactUrl}}}", "license": "{{{licenseName}}}", @@ -20,6 +27,7 @@ { "name": "{{{developerOrganization}}}", "homepage": "{{{developerOrganizationUrl}}}", +{{! CUSTOM - add email }} "email": "{{{developerOrganizationEmail}}}" } ], @@ -34,6 +42,7 @@ "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^3.5", +{{! CUSTOM - add symfony/yaml }} "symfony/yaml": "^5.4" }, "autoload": { diff --git a/sdks/php/templates/gitignore b/sdks/php/templates/gitignore index 3f10c0389..12f85db8f 100644 --- a/sdks/php/templates/gitignore +++ b/sdks/php/templates/gitignore @@ -14,7 +14,9 @@ composer.phar # PHPUnit cache .phpunit.result.cache +# CUSTOM - BEGIN .composer .openapi-generator git_push.sh composer.lock +# CUSTOM - END diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache index 83f35c109..43d9695b0 100644 --- a/sdks/php/templates/libraries/psr-18/ApiException.mustache +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -92,6 +92,7 @@ class ApiException extends RequestException /** * Sets the deseralized response object (during deserialization) * +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $obj Deserialized response object * * @return void diff --git a/sdks/php/templates/model_generic.mustache b/sdks/php/templates/model_generic.mustache index 431810e2a..88de8dfed 100644 --- a/sdks/php/templates/model_generic.mustache +++ b/sdks/php/templates/model_generic.mustache @@ -250,6 +250,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par {{/discriminator}} } +{{! CUSTOM - BEGIN }} {{^discriminator}} /** @deprecated use ::init() */ public static function fromArray(array $data): {{classname}} @@ -286,6 +287,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par return null; } {{/discriminator}} +{{! CUSTOM - END }} /** * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName @@ -294,6 +296,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @param string $variableName * @param array $fields +{{! CUSTOM - mixed to string|int|object|array|mixed }} * @param string|int|object|array|mixed $defaultValue */ private function setIfExists(string $variableName, array $fields, $defaultValue): void @@ -512,6 +515,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return boolean */ +{{! CUSTOM - add #[\ReturnTypeWillChange] }} #[\ReturnTypeWillChange] public function offsetExists($offset): bool { @@ -539,6 +543,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ +{{! CUSTOM - add #[\ReturnTypeWillChange] }} #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { @@ -556,6 +561,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ +{{! CUSTOM - add #[\ReturnTypeWillChange] }} #[\ReturnTypeWillChange] public function offsetUnset($offset): void { @@ -584,6 +590,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par { return json_encode( ObjectSerializer::sanitizeForSerialization($this), +{{! CUSTOM - JSON_PRETTY_PRINT to JSON_UNESCAPED_SLASHES }} JSON_UNESCAPED_SLASHES ); } diff --git a/sdks/php/templates/php_doc_auth_partial.mustache b/sdks/php/templates/php_doc_auth_partial.mustache index 6b03e0d09..3208a6b04 100644 --- a/sdks/php/templates/php_doc_auth_partial.mustache +++ b/sdks/php/templates/php_doc_auth_partial.mustache @@ -3,7 +3,13 @@ {{#isBasicBasic}} // Configure HTTP basic authorization: {{{name}}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration() +{{#vendorExtensions.x-ignore-block}} + ->setUsername('YOUR_USERNAME') + ->setPassword('YOUR_PASSWORD'); +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} ->setApiKey('YOUR_API_KEY'); +{{! CUSTOM - END }} {{/isBasicBasic}} {{#isBasicBearer}} // Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authorization: {{{name}}} @@ -13,6 +19,10 @@ $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAcce {{#isApiKey}} // Configure API key authorization: {{{name}}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); +{{#vendorExtensions.x-ignore-block}} +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer'); +{{/vendorExtensions.x-ignore-block}} {{/isApiKey}} {{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} From 12d7be52a8bbcf0c901d455b2dd44a0bbc2e8a1c Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Tue, 27 Aug 2024 17:53:52 -0500 Subject: [PATCH 10/19] Adds better CUSTOM block notations --- sdks/php/README.md | 5 +- sdks/php/docs/Api/AccountApi.md | 4 - sdks/php/docs/Api/ApiAppApi.md | 5 - sdks/php/docs/Api/BulkSendJobApi.md | 2 - sdks/php/docs/Api/EmbeddedApi.md | 2 - sdks/php/docs/Api/FaxLineApi.md | 7 -- sdks/php/docs/Api/OAuthApi.md | 2 - sdks/php/docs/Api/ReportApi.md | 1 - sdks/php/docs/Api/SignatureRequestApi.md | 16 ---- sdks/php/docs/Api/TeamApi.md | 10 -- sdks/php/docs/Api/TemplateApi.md | 11 --- sdks/php/docs/Api/UnclaimedDraftApi.md | 4 - sdks/php/src/Api/AccountApi.php | 3 - sdks/php/src/Api/ApiAppApi.php | 2 - sdks/php/src/Api/EmbeddedApi.php | 1 - sdks/php/src/Api/FaxLineApi.php | 4 - sdks/php/src/Api/OAuthApi.php | 2 - sdks/php/src/Api/ReportApi.php | 1 - sdks/php/src/Api/SignatureRequestApi.php | 8 -- sdks/php/src/Api/TeamApi.php | 5 - sdks/php/src/Api/TemplateApi.php | 5 - sdks/php/src/Api/UnclaimedDraftApi.php | 4 - sdks/php/templates/ApiException.mustache | 18 +++- sdks/php/templates/Configuration.mustache | 52 +++++++++-- sdks/php/templates/ObjectSerializer.mustache | 35 +++++-- sdks/php/templates/README.mustache | 92 ++++++++++++++++++- sdks/php/templates/api.mustache | 41 ++++++--- sdks/php/templates/api_doc.mustache | 77 +++++++++++++++- sdks/php/templates/composer.mustache | 6 +- .../libraries/psr-18/ApiException.mustache | 7 +- sdks/php/templates/model_doc.mustache | 8 ++ sdks/php/templates/model_generic.mustache | 23 +++-- 32 files changed, 316 insertions(+), 147 deletions(-) diff --git a/sdks/php/README.md b/sdks/php/README.md index f694462fa..7a2b727c6 100644 --- a/sdks/php/README.md +++ b/sdks/php/README.md @@ -59,7 +59,7 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow } ``` -Then run `composer install`. +Then run `composer install` Alternatively, install directly with @@ -212,6 +212,7 @@ All URIs are relative to *https://api.hellosign.com/v3* | *UnclaimedDraftApi* | [**unclaimedDraftCreateEmbeddedWithTemplate**](docs/Api/UnclaimedDraftApi.md#unclaimeddraftcreateembeddedwithtemplate) | **POST** /unclaimed_draft/create_embedded_with_template | Create Embedded Unclaimed Draft with Template | | *UnclaimedDraftApi* | [**unclaimedDraftEditAndResend**](docs/Api/UnclaimedDraftApi.md#unclaimeddrafteditandresend) | **POST** /unclaimed_draft/edit_and_resend/{signature_request_id} | Edit and Resend Unclaimed Draft | + ## Models - [AccountCreateRequest](docs/Model/AccountCreateRequest.md) @@ -400,6 +401,7 @@ All URIs are relative to *https://api.hellosign.com/v3* ## Authorization + ### api_key - **Type**: HTTP basic authentication @@ -428,4 +430,5 @@ This PHP package is automatically generated by the [OpenAPI Generator](https://o - API version: `3.0.0` - Package version: `1.5-dev` + - Generator version: `7.7.0` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/sdks/php/docs/Api/AccountApi.md b/sdks/php/docs/Api/AccountApi.md index 7e850df59..9c8e8c9f0 100644 --- a/sdks/php/docs/Api/AccountApi.md +++ b/sdks/php/docs/Api/AccountApi.md @@ -15,7 +15,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php accountCreate($account_create_request): \Dropbox\Sign\Model\AccountCreateResponse ``` - Create Account Creates a new Dropbox Sign Account that is associated with the specified `email_address`. @@ -79,7 +78,6 @@ try { ```php accountGet($account_id, $email_address): \Dropbox\Sign\Model\AccountGetResponse ``` - Get Account Returns the properties and settings of your Account. @@ -141,7 +139,6 @@ try { ```php accountUpdate($account_update_request): \Dropbox\Sign\Model\AccountGetResponse ``` - Update Account Updates the properties and settings of your Account. Currently only allows for updates to the [Callback URL](/api/reference/tag/Callbacks-and-Events) and locale. @@ -205,7 +202,6 @@ try { ```php accountVerify($account_verify_request): \Dropbox\Sign\Model\AccountVerifyResponse ``` - Verify Account Verifies whether an Dropbox Sign Account exists for the given email address. diff --git a/sdks/php/docs/Api/ApiAppApi.md b/sdks/php/docs/Api/ApiAppApi.md index e330f9946..a591601b2 100644 --- a/sdks/php/docs/Api/ApiAppApi.md +++ b/sdks/php/docs/Api/ApiAppApi.md @@ -16,7 +16,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php apiAppCreate($api_app_create_request): \Dropbox\Sign\Model\ApiAppGetResponse ``` - Create API App Creates a new API App. @@ -97,7 +96,6 @@ try { ```php apiAppDelete($client_id) ``` - Delete API App Deletes an API App. Can only be invoked for apps you own. @@ -159,7 +157,6 @@ void (empty response body) ```php apiAppGet($client_id): \Dropbox\Sign\Model\ApiAppGetResponse ``` - Get API App Returns an object with information about an API App. @@ -222,7 +219,6 @@ try { ```php apiAppList($page, $page_size): \Dropbox\Sign\Model\ApiAppListResponse ``` - List API Apps Returns a list of API Apps that are accessible by you. If you are on a team with an Admin or Developer role, this list will include apps owned by teammates. @@ -287,7 +283,6 @@ try { ```php apiAppUpdate($client_id, $api_app_update_request): \Dropbox\Sign\Model\ApiAppGetResponse ``` - Update API App Updates an existing API App. Can only be invoked for apps you own. Only the fields you provide will be updated. If you wish to clear an existing optional field, provide an empty string. diff --git a/sdks/php/docs/Api/BulkSendJobApi.md b/sdks/php/docs/Api/BulkSendJobApi.md index b53d3074c..ede4f3415 100644 --- a/sdks/php/docs/Api/BulkSendJobApi.md +++ b/sdks/php/docs/Api/BulkSendJobApi.md @@ -13,7 +13,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php bulkSendJobGet($bulk_send_job_id, $page, $page_size): \Dropbox\Sign\Model\BulkSendJobGetResponse ``` - Get Bulk Send Job Returns the status of the BulkSendJob and its SignatureRequests specified by the `bulk_send_job_id` parameter. @@ -78,7 +77,6 @@ try { ```php bulkSendJobList($page, $page_size): \Dropbox\Sign\Model\BulkSendJobListResponse ``` - List Bulk Send Jobs Returns a list of BulkSendJob that you can access. diff --git a/sdks/php/docs/Api/EmbeddedApi.md b/sdks/php/docs/Api/EmbeddedApi.md index 111eefb3b..8b1acfbc4 100644 --- a/sdks/php/docs/Api/EmbeddedApi.md +++ b/sdks/php/docs/Api/EmbeddedApi.md @@ -13,7 +13,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php embeddedEditUrl($template_id, $embedded_edit_url_request): \Dropbox\Sign\Model\EmbeddedEditUrlResponse ``` - Get Embedded Template Edit URL Retrieves an embedded object containing a template url that can be opened in an iFrame. Note that only templates created via the embedded template process are available to be edited with this endpoint. @@ -81,7 +80,6 @@ try { ```php embeddedSignUrl($signature_id): \Dropbox\Sign\Model\EmbeddedSignUrlResponse ``` - Get Embedded Sign URL Retrieves an embedded object containing a signature url that can be opened in an iFrame. Note that templates created via the embedded template process will only be accessible through the API. diff --git a/sdks/php/docs/Api/FaxLineApi.md b/sdks/php/docs/Api/FaxLineApi.md index 677d605e9..1bb340d36 100644 --- a/sdks/php/docs/Api/FaxLineApi.md +++ b/sdks/php/docs/Api/FaxLineApi.md @@ -18,7 +18,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php faxLineAddUser($fax_line_add_user_request): \Dropbox\Sign\Model\FaxLineResponse ``` - Add Fax Line User Grants a user access to the specified Fax Line. @@ -80,7 +79,6 @@ try { ```php faxLineAreaCodeGet($country, $state, $province, $city): \Dropbox\Sign\Model\FaxLineAreaCodeGetResponse ``` - Get Available Fax Line Area Codes Returns a response with the area codes available for a given state/provice and city. @@ -141,7 +139,6 @@ try { ```php faxLineCreate($fax_line_create_request): \Dropbox\Sign\Model\FaxLineResponse ``` - Purchase Fax Line Purchases a new Fax Line. @@ -203,7 +200,6 @@ try { ```php faxLineDelete($fax_line_delete_request) ``` - Delete Fax Line Deletes the specified Fax Line from the subscription. @@ -263,7 +259,6 @@ void (empty response body) ```php faxLineGet($number): \Dropbox\Sign\Model\FaxLineResponse ``` - Get Fax Line Returns the properties and settings of a Fax Line. @@ -321,7 +316,6 @@ try { ```php faxLineList($account_id, $page, $page_size, $show_team_lines): \Dropbox\Sign\Model\FaxLineListResponse ``` - List Fax Lines Returns the properties and settings of multiple Fax Lines. @@ -382,7 +376,6 @@ try { ```php faxLineRemoveUser($fax_line_remove_user_request): \Dropbox\Sign\Model\FaxLineResponse ``` - Remove Fax Line Access Removes a user's access to the specified Fax Line. diff --git a/sdks/php/docs/Api/OAuthApi.md b/sdks/php/docs/Api/OAuthApi.md index 9b63ca7fd..854b4b7a0 100644 --- a/sdks/php/docs/Api/OAuthApi.md +++ b/sdks/php/docs/Api/OAuthApi.md @@ -13,7 +13,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php oauthTokenGenerate($o_auth_token_generate_request): \Dropbox\Sign\Model\OAuthTokenResponse ``` - OAuth Token Generate Once you have retrieved the code from the user callback, you will need to exchange it for an access token via a backend call. @@ -74,7 +73,6 @@ No authorization required ```php oauthTokenRefresh($o_auth_token_refresh_request): \Dropbox\Sign\Model\OAuthTokenResponse ``` - OAuth Token Refresh Access tokens are only valid for a given period of time (typically one hour) for security reasons. Whenever acquiring an new access token its TTL is also given (see `expires_in`), along with a refresh token that can be used to acquire a new access token after the current one has expired. diff --git a/sdks/php/docs/Api/ReportApi.md b/sdks/php/docs/Api/ReportApi.md index 95afd1fd0..285a20e83 100644 --- a/sdks/php/docs/Api/ReportApi.md +++ b/sdks/php/docs/Api/ReportApi.md @@ -12,7 +12,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php reportCreate($report_create_request): \Dropbox\Sign\Model\ReportCreateResponse ``` - Create Report Request the creation of one or more report(s). When the report(s) have been generated, you will receive an email (one per requested report type) containing a link to download the report as a CSV file. The requested date range may be up to 12 months in duration, and `start_date` must not be more than 10 years in the past. diff --git a/sdks/php/docs/Api/SignatureRequestApi.md b/sdks/php/docs/Api/SignatureRequestApi.md index 078cc8769..373d1215c 100644 --- a/sdks/php/docs/Api/SignatureRequestApi.md +++ b/sdks/php/docs/Api/SignatureRequestApi.md @@ -27,7 +27,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php signatureRequestBulkCreateEmbeddedWithTemplate($signature_request_bulk_create_embedded_with_template_request): \Dropbox\Sign\Model\BulkSendJobSendResponse ``` - Embedded Bulk Send with Template Creates BulkSendJob which sends up to 250 SignatureRequests in bulk based off of the provided Template(s) specified with the `template_ids` parameter to be signed in an embedded iFrame. These embedded signature requests can only be signed in embedded iFrames whereas normal signature requests can only be signed on Dropbox Sign. **NOTE:** Only available for Standard plan and higher. @@ -126,7 +125,6 @@ try { ```php signatureRequestBulkSendWithTemplate($signature_request_bulk_send_with_template_request): \Dropbox\Sign\Model\BulkSendJobSendResponse ``` - Bulk Send with Template Creates BulkSendJob which sends up to 250 SignatureRequests in bulk based off of the provided Template(s) specified with the `template_ids` parameter. **NOTE:** Only available for Standard plan and higher. @@ -227,7 +225,6 @@ try { ```php signatureRequestCancel($signature_request_id) ``` - Cancel Incomplete Signature Request Cancels an incomplete signature request. This action is **not reversible**. The request will be canceled and signers will no longer be able to sign. If they try to access the signature request they will receive a HTTP 410 status code indicating that the resource has been deleted. Cancelation is asynchronous and a successful call to this endpoint will return an empty 200 OK response if the signature request is eligible to be canceled and has been successfully queued. This 200 OK response does not indicate a successful cancelation of the signature request itself. The cancelation is confirmed via the `signature_request_canceled` event. It is recommended that a [callback handler](/api/reference/tag/Callbacks-and-Events) be implemented to listen for the `signature_request_canceled` event. This callback will be sent only when the cancelation has completed successfully. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the [API Dashboard](https://app.hellosign.com/apidashboard) and retry the cancelation if necessary. To be eligible for cancelation, a signature request must have been sent successfully, must not yet have been signed by all signers, and you must either be the sender or own the API app under which it was sent. A partially signed signature request can be canceled. **NOTE:** To remove your access to a completed signature request, use the endpoint: `POST /signature_request/remove/[:signature_request_id]`. @@ -289,7 +286,6 @@ void (empty response body) ```php signatureRequestCreateEmbedded($signature_request_create_embedded_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Create Embedded Signature Request Creates a new SignatureRequest with the submitted documents to be signed in an embedded iFrame. If form_fields_per_document is not specified, a signature page will be affixed where all signers will be required to add their signature, signifying their agreement to all contained documents. Note that embedded signature requests can only be signed in embedded iFrames whereas normal signature requests can only be signed on Dropbox Sign. @@ -381,7 +377,6 @@ try { ```php signatureRequestCreateEmbeddedWithTemplate($signature_request_create_embedded_with_template_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Create Embedded Signature Request with Template Creates a new SignatureRequest based on the given Template(s) to be signed in an embedded iFrame. Note that embedded signature requests can only be signed in embedded iFrames whereas normal signature requests can only be signed on Dropbox Sign. @@ -463,7 +458,6 @@ try { ```php signatureRequestFiles($signature_request_id, $file_type): \SplFileObject ``` - Download Files Obtain a copy of the current documents specified by the `signature_request_id` parameter. Returns a PDF or ZIP file. If the files are currently being prepared, a status code of `409` will be returned instead. @@ -528,7 +522,6 @@ try { ```php signatureRequestFilesAsDataUri($signature_request_id): \Dropbox\Sign\Model\FileResponseDataUri ``` - Download Files as Data Uri Obtain a copy of the current documents specified by the `signature_request_id` parameter. Returns a JSON object with a `data_uri` representing the base64 encoded file (PDFs only). If the files are currently being prepared, a status code of `409` will be returned instead. @@ -591,7 +584,6 @@ try { ```php signatureRequestFilesAsFileUrl($signature_request_id, $force_download): \Dropbox\Sign\Model\FileResponse ``` - Download Files as File Url Obtain a copy of the current documents specified by the `signature_request_id` parameter. Returns a JSON object with a url to the file (PDFs only). If the files are currently being prepared, a status code of `409` will be returned instead. @@ -655,7 +647,6 @@ try { ```php signatureRequestGet($signature_request_id): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Get Signature Request Returns the status of the SignatureRequest specified by the `signature_request_id` parameter. @@ -718,7 +709,6 @@ try { ```php signatureRequestList($account_id, $page, $page_size, $query): \Dropbox\Sign\Model\SignatureRequestListResponse ``` - List Signature Requests Returns a list of SignatureRequests that you can access. This includes SignatureRequests you have sent as well as received, but not ones that you have been CCed on. Take a look at our [search guide](/api/reference/search/) to learn more about querying signature requests. @@ -785,7 +775,6 @@ try { ```php signatureRequestReleaseHold($signature_request_id): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Release On-Hold Signature Request Releases a held SignatureRequest that was claimed and prepared from an [UnclaimedDraft](/api/reference/tag/Unclaimed-Draft). The owner of the Draft must indicate at Draft creation that the SignatureRequest created from the Draft should be held. Releasing the SignatureRequest will send requests to all signers. @@ -848,7 +837,6 @@ try { ```php signatureRequestRemind($signature_request_id, $signature_request_remind_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Send Request Reminder Sends an email to the signer reminding them to sign the signature request. You cannot send a reminder within 1 hour of the last reminder that was sent. This includes manual AND automatic reminders. **NOTE:** This action can **not** be used with embedded signature requests. @@ -915,7 +903,6 @@ try { ```php signatureRequestRemove($signature_request_id) ``` - Remove Signature Request Access Removes your access to a completed signature request. This action is **not reversible**. The signature request must be fully executed by all parties (signed or declined to sign). Other parties will continue to maintain access to the completed signature request document(s). Unlike /signature_request/cancel, this endpoint is synchronous and your access will be immediately removed. Upon successful removal, this endpoint will return a 200 OK response. @@ -974,7 +961,6 @@ void (empty response body) ```php signatureRequestSend($signature_request_send_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Send Signature Request Creates and sends a new SignatureRequest with the submitted documents. If `form_fields_per_document` is not specified, a signature page will be affixed where all signers will be required to add their signature, signifying their agreement to all contained documents. @@ -1073,7 +1059,6 @@ try { ```php signatureRequestSendWithTemplate($signature_request_send_with_template_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Send with Template Creates and sends a new SignatureRequest based off of the Template(s) specified with the `template_ids` parameter. @@ -1166,7 +1151,6 @@ try { ```php signatureRequestUpdate($signature_request_id, $signature_request_update_request): \Dropbox\Sign\Model\SignatureRequestGetResponse ``` - Update Signature Request Updates the email address and/or the name for a given signer on a signature request. You can listen for the `signature_request_email_bounce` event on your app or account to detect bounced emails, and respond with this method. Updating the email address of a signer will generate a new `signature_id` value. **NOTE:** This action cannot be performed on a signature request with an appended signature page. diff --git a/sdks/php/docs/Api/TeamApi.md b/sdks/php/docs/Api/TeamApi.md index 7705304ad..1f46c6b3f 100644 --- a/sdks/php/docs/Api/TeamApi.md +++ b/sdks/php/docs/Api/TeamApi.md @@ -21,7 +21,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php teamAddMember($team_add_member_request, $team_id): \Dropbox\Sign\Model\TeamGetResponse ``` - Add User to Team Invites a user (specified using the `email_address` parameter) to your Team. If the user does not currently have a Dropbox Sign Account, a new one will be created for them. If a user is already a part of another Team, a `team_invite_failed` error will be returned. @@ -86,7 +85,6 @@ try { ```php teamCreate($team_create_request): \Dropbox\Sign\Model\TeamGetResponse ``` - Create Team Creates a new Team and makes you a member. You must not currently belong to a Team to invoke. @@ -150,7 +148,6 @@ try { ```php teamDelete() ``` - Delete Team Deletes your Team. Can only be invoked when you have a Team with only one member (yourself). @@ -208,7 +205,6 @@ void (empty response body) ```php teamGet(): \Dropbox\Sign\Model\TeamGetResponse ``` - Get Team Returns information about your Team as well as a list of its members. If you do not belong to a Team, a 404 error with an error_name of \"not_found\" will be returned. @@ -267,7 +263,6 @@ try { ```php teamInfo($team_id): \Dropbox\Sign\Model\TeamGetInfoResponse ``` - Get Team Info Provides information about a team. @@ -328,7 +323,6 @@ try { ```php teamInvites($email_address): \Dropbox\Sign\Model\TeamInvitesResponse ``` - List Team Invites Provides a list of team invites (and their roles). @@ -391,7 +385,6 @@ try { ```php teamMembers($team_id, $page, $page_size): \Dropbox\Sign\Model\TeamMembersResponse ``` - List Team Members Provides a paginated list of members (and their roles) that belong to a given team. @@ -456,7 +449,6 @@ try { ```php teamRemoveMember($team_remove_member_request): \Dropbox\Sign\Model\TeamGetResponse ``` - Remove User from Team Removes the provided user Account from your Team. If the Account had an outstanding invitation to your Team, the invitation will be expired. If you choose to transfer documents from the removed Account to an Account provided in the `new_owner_email_address` parameter (available only for Enterprise plans), the response status code will be 201, which indicates that your request has been queued but not fully executed. @@ -521,7 +513,6 @@ try { ```php teamSubTeams($team_id, $page, $page_size): \Dropbox\Sign\Model\TeamSubTeamsResponse ``` - List Sub Teams Provides a paginated list of sub teams that belong to a given team. @@ -586,7 +577,6 @@ try { ```php teamUpdate($team_update_request): \Dropbox\Sign\Model\TeamGetResponse ``` - Update Team Updates the name of your Team. diff --git a/sdks/php/docs/Api/TemplateApi.md b/sdks/php/docs/Api/TemplateApi.md index c81bc7b74..3331db8dd 100644 --- a/sdks/php/docs/Api/TemplateApi.md +++ b/sdks/php/docs/Api/TemplateApi.md @@ -22,7 +22,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php templateAddUser($template_id, $template_add_user_request): \Dropbox\Sign\Model\TemplateGetResponse ``` - Add User to Template Gives the specified Account access to the specified Template. The specified Account must be a part of your Team. @@ -89,7 +88,6 @@ try { ```php templateCreate($template_create_request): \Dropbox\Sign\Model\TemplateCreateResponse ``` - Create Template Creates a template that can then be used. @@ -181,7 +179,6 @@ try { ```php templateCreateEmbeddedDraft($template_create_embedded_draft_request): \Dropbox\Sign\Model\TemplateCreateEmbeddedDraftResponse ``` - Create Embedded Template Draft The first step in an embedded template workflow. Creates a draft template that can then be further set up in the template 'edit' stage. @@ -273,7 +270,6 @@ try { ```php templateDelete($template_id) ``` - Delete Template Completely deletes the template specified from the account. @@ -335,7 +331,6 @@ void (empty response body) ```php templateFiles($template_id, $file_type): \SplFileObject ``` - Get Template Files Obtain a copy of the current documents specified by the `template_id` parameter. Returns a PDF or ZIP file. If the files are currently being prepared, a status code of `409` will be returned instead. In this case please wait for the `template_created` callback event. @@ -400,7 +395,6 @@ try { ```php templateFilesAsDataUri($template_id): \Dropbox\Sign\Model\FileResponseDataUri ``` - Get Template Files as Data Uri Obtain a copy of the current documents specified by the `template_id` parameter. Returns a JSON object with a `data_uri` representing the base64 encoded file (PDFs only). If the files are currently being prepared, a status code of `409` will be returned instead. In this case please wait for the `template_created` callback event. @@ -463,7 +457,6 @@ try { ```php templateFilesAsFileUrl($template_id, $force_download): \Dropbox\Sign\Model\FileResponse ``` - Get Template Files as File Url Obtain a copy of the current documents specified by the `template_id` parameter. Returns a JSON object with a url to the file (PDFs only). If the files are currently being prepared, a status code of `409` will be returned instead. In this case please wait for the `template_created` callback event. @@ -527,7 +520,6 @@ try { ```php templateGet($template_id): \Dropbox\Sign\Model\TemplateGetResponse ``` - Get Template Returns the Template specified by the `template_id` parameter. @@ -590,7 +582,6 @@ try { ```php templateList($account_id, $page, $page_size, $query): \Dropbox\Sign\Model\TemplateListResponse ``` - List Templates Returns a list of the Templates that are accessible by you. Take a look at our [search guide](/api/reference/search/) to learn more about querying templates. @@ -656,7 +647,6 @@ try { ```php templateRemoveUser($template_id, $template_remove_user_request): \Dropbox\Sign\Model\TemplateGetResponse ``` - Remove User from Template Removes the specified Account's access to the specified Template. @@ -723,7 +713,6 @@ try { ```php templateUpdateFiles($template_id, $template_update_files_request): \Dropbox\Sign\Model\TemplateUpdateFilesResponse ``` - Update Template Files Overlays a new file with the overlay of an existing template. The new file(s) must: 1. have the same or higher page count 2. the same orientation as the file(s) being replaced. This will not overwrite or in any way affect the existing template. Both the existing template and new template will be available for use after executing this endpoint. Also note that this will decrement your template quota. Overlaying new files is asynchronous and a successful call to this endpoint will return 200 OK response if the request passes initial validation checks. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event will be sent when the files are updated or a `template_error` event will be sent if there was a problem while updating the files. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary. If the page orientation or page count is different from the original template document, we will notify you with a `template_error` [callback event](https://app.hellosign.com/api/eventsAndCallbacksWalkthrough). diff --git a/sdks/php/docs/Api/UnclaimedDraftApi.md b/sdks/php/docs/Api/UnclaimedDraftApi.md index c0dd2c438..a2b2f4236 100644 --- a/sdks/php/docs/Api/UnclaimedDraftApi.md +++ b/sdks/php/docs/Api/UnclaimedDraftApi.md @@ -15,7 +15,6 @@ All URIs are relative to https://api.hellosign.com/v3. ```php unclaimedDraftCreate($unclaimed_draft_create_request): \Dropbox\Sign\Model\UnclaimedDraftCreateResponse ``` - Create Unclaimed Draft Creates a new Draft that can be claimed using the claim URL. The first authenticated user to access the URL will claim the Draft and will be shown either the \"Sign and send\" or the \"Request signature\" page with the Draft loaded. Subsequent access to the claim URL will result in a 404. @@ -114,7 +113,6 @@ try { ```php unclaimedDraftCreateEmbedded($unclaimed_draft_create_embedded_request): \Dropbox\Sign\Model\UnclaimedDraftCreateResponse ``` - Create Embedded Unclaimed Draft Creates a new Draft that can be claimed and used in an embedded iFrame. The first authenticated user to access the URL will claim the Draft and will be shown the \"Request signature\" page with the Draft loaded. Subsequent access to the claim URL will result in a `404`. For this embedded endpoint the `requester_email_address` parameter is required. **NOTE:** Embedded unclaimed drafts can only be accessed in embedded iFrames whereas normal drafts can be used and accessed on Dropbox Sign. @@ -181,7 +179,6 @@ try { ```php unclaimedDraftCreateEmbeddedWithTemplate($unclaimed_draft_create_embedded_with_template_request): \Dropbox\Sign\Model\UnclaimedDraftCreateResponse ``` - Create Embedded Unclaimed Draft with Template Creates a new Draft with a previously saved template(s) that can be claimed and used in an embedded iFrame. The first authenticated user to access the URL will claim the Draft and will be shown the \"Request signature\" page with the Draft loaded. Subsequent access to the claim URL will result in a `404`. For this embedded endpoint the `requester_email_address` parameter is required. **NOTE:** Embedded unclaimed drafts can only be accessed in embedded iFrames whereas normal drafts can be used and accessed on Dropbox Sign. @@ -259,7 +256,6 @@ try { ```php unclaimedDraftEditAndResend($signature_request_id, $unclaimed_draft_edit_and_resend_request): \Dropbox\Sign\Model\UnclaimedDraftCreateResponse ``` - Edit and Resend Unclaimed Draft Creates a new signature request from an embedded request that can be edited prior to being sent to the recipients. Parameter `test_mode` can be edited prior to request. Signers can be edited in embedded editor. Requester's email address will remain unchanged if `requester_email_address` parameter is not set. **NOTE:** Embedded unclaimed drafts can only be accessed in embedded iFrames whereas normal drafts can be used and accessed on Dropbox Sign. diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 1ce15275a..82c1242fe 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -436,7 +436,6 @@ public function accountCreateRequest(Model\AccountCreateRequest $account_create_ if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $account_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1116,7 +1115,6 @@ public function accountUpdateRequest(Model\AccountUpdateRequest $account_update_ if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $account_update_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1456,7 +1454,6 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $account_verify_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index a9bbf136e..ecd81f2bf 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -441,7 +441,6 @@ public function apiAppCreateRequest(Model\ApiAppCreateRequest $api_app_create_re if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $api_app_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1718,7 +1717,6 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $api_app_update_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index c198ebed3..b01be61c3 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -451,7 +451,6 @@ public function embeddedEditUrlRequest(string $template_id, Model\EmbeddedEditUr if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $embedded_edit_url_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/FaxLineApi.php b/sdks/php/src/Api/FaxLineApi.php index 1d2c0ee80..d8dac79fa 100644 --- a/sdks/php/src/Api/FaxLineApi.php +++ b/sdks/php/src/Api/FaxLineApi.php @@ -445,7 +445,6 @@ public function faxLineAddUserRequest(Model\FaxLineAddUserRequest $fax_line_add_ if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $fax_line_add_user_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1152,7 +1151,6 @@ public function faxLineCreateRequest(Model\FaxLineCreateRequest $fax_line_create if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $fax_line_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1400,7 +1398,6 @@ public function faxLineDeleteRequest(Model\FaxLineDeleteRequest $fax_line_delete if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $fax_line_delete_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2429,7 +2426,6 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $fax_line_remove_user_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index 7c3ab1f70..fadcfe7a5 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -446,7 +446,6 @@ public function oauthTokenGenerateRequest(Model\OAuthTokenGenerateRequest $o_aut if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $o_auth_token_generate_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -818,7 +817,6 @@ public function oauthTokenRefreshRequest(Model\OAuthTokenRefreshRequest $o_auth_ if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $o_auth_token_refresh_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 6e098ea0e..f2a2f29b9 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -427,7 +427,6 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $report_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index a8438ec7f..0681d7bcf 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -479,7 +479,6 @@ public function signatureRequestBulkCreateEmbeddedWithTemplateRequest(Model\Sign if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_bulk_create_embedded_with_template_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -815,7 +814,6 @@ public function signatureRequestBulkSendWithTemplateRequest(Model\SignatureReque if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_bulk_send_with_template_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1399,7 +1397,6 @@ public function signatureRequestCreateEmbeddedRequest(Model\SignatureRequestCrea if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1739,7 +1736,6 @@ public function signatureRequestCreateEmbeddedWithTemplateRequest(Model\Signatur if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_create_embedded_with_template_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -4158,7 +4154,6 @@ public function signatureRequestRemindRequest(string $signature_request_id, Mode if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_remind_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -4738,7 +4733,6 @@ public function signatureRequestSendRequest(Model\SignatureRequestSendRequest $s if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_send_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -5078,7 +5072,6 @@ public function signatureRequestSendWithTemplateRequest(Model\SignatureRequestSe if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_send_with_template_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -5439,7 +5432,6 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $signature_request_update_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 15c4756fd..9cdf1db79 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -420,7 +420,6 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member ); $multipart = !empty($formParams); - // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( $team_id, @@ -469,7 +468,6 @@ public function teamAddMemberRequest(Model\TeamAddMemberRequest $team_add_member if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $team_add_member_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -809,7 +807,6 @@ public function teamCreateRequest(Model\TeamCreateRequest $team_create_request, if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $team_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -2701,7 +2698,6 @@ public function teamRemoveMemberRequest(Model\TeamRemoveMemberRequest $team_remo if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $team_remove_member_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3409,7 +3405,6 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $team_update_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 1275f8d0f..01fffa9ed 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -482,7 +482,6 @@ public function templateAddUserRequest(string $template_id, Model\TemplateAddUse if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $template_add_user_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -822,7 +821,6 @@ public function templateCreateRequest(Model\TemplateCreateRequest $template_crea if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $template_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1162,7 +1160,6 @@ public function templateCreateEmbeddedDraftRequest(Model\TemplateCreateEmbeddedD if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $template_create_embedded_draft_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3500,7 +3497,6 @@ public function templateRemoveUserRequest(string $template_id, Model\TemplateRem if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $template_remove_user_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -3861,7 +3857,6 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $template_update_files_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index 19d96a314..32cc2a4bf 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -439,7 +439,6 @@ public function unclaimedDraftCreateRequest(Model\UnclaimedDraftCreateRequest $u if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -779,7 +778,6 @@ public function unclaimedDraftCreateEmbeddedRequest(Model\UnclaimedDraftCreateEm if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1119,7 +1117,6 @@ public function unclaimedDraftCreateEmbeddedWithTemplateRequest(Model\UnclaimedD if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $unclaimed_draft_create_embedded_with_template_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters @@ -1480,7 +1477,6 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, if ($payloadHook = $this->config->getPayloadHook()) { $payloadHook('multipart', $multipartContents, $unclaimed_draft_edit_and_resend_request); } - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { // if Content-Type contains "application/json", json_encode the form parameters diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index d6929bd34..dddc9e00d 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -47,8 +47,12 @@ class ApiException extends Exception /** * The deserialized response object * -{{! CUSTOM - \stdClass to Model\ErrorResponse }} +{{#vendorExtensions.x-ignore-block}} + * @var \stdClass|string|null +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @var Model\ErrorResponse|string|null +{{! CUSTOM - END }} */ protected $responseObject; @@ -90,8 +94,12 @@ class ApiException extends Exception /** * Sets the deserialized response object (during deserialization) * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $obj Deserialized response object +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $obj Deserialized response object +{{! CUSTOM - END }} * * @return void */ @@ -103,8 +111,12 @@ class ApiException extends Exception /** * Gets the deserialized response object (during deserialization) * -{{! CUSTOM - mixed to Model\ErrorResponse }} +{{#vendorExtensions.x-ignore-block}} + * @return mixed the deserialized response object +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @return Model\ErrorResponse the deserialized response object +{{! CUSTOM - END }} */ public function getResponseObject() { diff --git a/sdks/php/templates/Configuration.mustache b/sdks/php/templates/Configuration.mustache index 97d1d3d15..f1d09d5aa 100644 --- a/sdks/php/templates/Configuration.mustache +++ b/sdks/php/templates/Configuration.mustache @@ -113,8 +113,8 @@ class Configuration * @var string */ protected $tempFolderPath; - {{! CUSTOM - BEGIN }} + /** * Holds any extra request options you want to send * @@ -142,8 +142,12 @@ class Configuration * * @return $this */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function setApiKey($apiKeyIdentifier, $key) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function setApiKey($apiKeyIdentifier, $key) +{{! CUSTOM - END }} { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -156,8 +160,12 @@ class Configuration * * @return null|string API key or token */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function getApiKey($apiKeyIdentifier) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function getApiKey($apiKeyIdentifier) +{{! CUSTOM - END }} { return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; } @@ -170,8 +178,12 @@ class Configuration * * @return $this */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function setApiKeyPrefix($apiKeyIdentifier, $prefix) +{{! CUSTOM - END }} { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -184,8 +196,12 @@ class Configuration * * @return null|string */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function getApiKeyPrefix($apiKeyIdentifier) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function getApiKeyPrefix($apiKeyIdentifier) +{{! CUSTOM - END }} { return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; } @@ -220,8 +236,12 @@ class Configuration * * @return $this */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function setBooleanFormatForQueryString(string $booleanFormat) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function setBooleanFormatForQueryString(string $booleanFormat) +{{! CUSTOM - END }} { $this->booleanFormatForQueryString = $booleanFormat; @@ -268,8 +288,12 @@ class Configuration * * @return $this */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function setPassword($password) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function setPassword($password) +{{! CUSTOM - END }} { $this->password = $password; return $this; @@ -280,8 +304,12 @@ class Configuration * * @return string Password for HTTP basic authentication */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function getPassword() +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function getPassword() +{{! CUSTOM - END }} { return $this->password; } @@ -458,8 +486,12 @@ class Configuration * * @return null|string API key with the prefix */ -{{! CUSTOM - public to protected }} +{{#vendorExtensions.x-ignore-block}} + public function getApiKeyWithPrefix($apiKeyIdentifier) +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} protected function getApiKeyWithPrefix($apiKeyIdentifier) +{{! CUSTOM - END }} { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -565,8 +597,8 @@ class Configuration { return self::getHostString($this->getHostSettings(), $index, $variables); } - {{! CUSTOM - BEGIN }} + public function setOptions(array $options): self { $this->options = $options; diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index 6a64ec8af..dc0fc473e 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -19,10 +19,11 @@ namespace {{invokerPackage}}; -{{! CUSTOM - add \GuzzleHttp }} -use GuzzleHttp; use GuzzleHttp\Psr7\Utils; use {{modelPackage}}\ModelInterface; +{{! CUSTOM - BEGIN }} +use GuzzleHttp; +{{! CUSTOM - END }} /** * ObjectSerializer Class Doc Comment @@ -50,8 +51,12 @@ class ObjectSerializer /** * Serialize data * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $data the data to serialize +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $data the data to serialize +{{! CUSTOM - END }} * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data * @@ -163,8 +168,12 @@ class ObjectSerializer /** * Checks if a value is empty, based on its OpenAPI type. * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $value +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $value +{{! CUSTOM - END }} * @param string $openApiType * * @return bool true if $value is empty @@ -208,8 +217,12 @@ class ObjectSerializer * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $value Parameter value +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $value Parameter value +{{! CUSTOM - END }} * @param string $paramName Parameter name * @param string $openApiType OpenAPIType eg. array or object * @param string $style Parameter serialization style @@ -343,8 +356,12 @@ class ObjectSerializer * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * -{{! CUSTOM - float|int|bool|\DateTime to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param float|int|bool|\DateTime $value the value of the parameter +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $value the value of the parameter +{{! CUSTOM - END }} * * @return string the header string */ @@ -399,8 +416,12 @@ class ObjectSerializer /** * Deserialize a JSON string into an object * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $data object or primitive to be deserialized +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $data object or primitive to be deserialized +{{! CUSTOM - END }} * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers * diff --git a/sdks/php/templates/README.mustache b/sdks/php/templates/README.mustache index a22941039..6bc7507ec 100644 --- a/sdks/php/templates/README.mustache +++ b/sdks/php/templates/README.mustache @@ -8,6 +8,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}). {{/infoUrl}} +{{! CUSTOM - BEGIN }} ## Migrating from legacy SDK This SDK is generated from our officially maintained [OpenAPI spec](https://github.com/hellosign/hellosign-openapi/blob/main/openapi.yaml). @@ -45,37 +46,97 @@ Run the following and everything is done for you: to the OAS file and/or the mustache template files _will be lost_ when you run this command. +{{! CUSTOM - END }} ## Installation & Usage ### Requirements +{{#vendorExtensions.x-ignore-block}} +PHP 7.4 and later. +Should also work with PHP 8.0. +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} PHP {{phpVersion}} and later. +{{! CUSTOM - END }} ### Composer To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: ```json +{{#vendorExtensions.x-ignore-block}} +{ + "repositories": [ + { + "type": "vcs", + "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git" + } + ], + "require": { + "{{gitUserId}}/{{gitRepoId}}": "*@dev" + } +} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} { "require": { "{{packageName}}": "{{packageVersion}}" }, "minimum-stability": "dev" } +{{! CUSTOM - END }} ``` -Then run `composer install`. +Then run `composer install` + +{{#vendorExtensions.x-ignore-block}} +### Manual Installation +Download the files and include `autoload.php`: + +```php + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // 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(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} ```php REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_PHP_CODE @@ -120,26 +181,42 @@ try { . $e->getMessage() . PHP_EOL; } ``` +{{! CUSTOM - END }} ## API Endpoints All URIs are relative to *{{basePath}}* +{{#vendorExtensions.x-ignore-block}} +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} | Class | Method | HTTP request | Description | | ---------- | ------------- | ------------- | ------------- | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| *{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +{{! CUSTOM - END }} ## Models {{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}} {{/models}} ## Authorization -{{^authMethods}} -All endpoints do not require authorization. -{{/authMethods}} +{{#vendorExtensions.x-ignore-block}} +{{^authMethods}}Endpoints do not require authorization.{{/authMethods}} +{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} +{{^authMethods}}All endpoints do not require authorization.{{/authMethods}} +{{! CUSTOM - END }} {{#authMethods}} +{{! CUSTOM - BEGIN }} {{#last}} Authentication schemes defined for the API:{{/last}} +{{! CUSTOM - END }} ### {{{name}}} {{#isApiKey}} @@ -157,6 +234,12 @@ All endpoints do not require authorization. - **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} {{/isBasicBearer}} +{{#vendorExtensions.x-ignore-block}} +{{#isHttpSignature}} + +- **Type**: HTTP signature authentication +{{/isHttpSignature}} +{{/vendorExtensions.x-ignore-block}} {{/isBasic}} {{#isOAuth}} @@ -194,4 +277,5 @@ This PHP package is automatically generated by the [OpenAPI Generator](https://o {{^hideGenerationTimestamp}} - Build date: `{{generatedDate}}` {{/hideGenerationTimestamp}} + - Generator version: `{{generatorVersion}}` - Build package: `{{generatorClass}}` diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 4db18c2e0..3717275e9 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -92,6 +92,7 @@ use Psr\Http\Message\ResponseInterface; $hostIndex = 0 ) { {{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} /** * @param Configuration $config * @param ClientInterface $client @@ -104,6 +105,7 @@ use Psr\Http\Message\ResponseInterface; HeaderSelector $selector = null, $hostIndex = 0 ) { +{{! CUSTOM - END }} $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); $this->headerSelector = $selector ?: new HeaderSelector(); @@ -114,8 +116,9 @@ use Psr\Http\Message\ResponseInterface; * Set the host index * * @param int $hostIndex Host index (required) -{{! CUSTOM - Add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated To be made private in the future +{{! CUSTOM - END }} */ public function setHostIndex($hostIndex): void { @@ -126,8 +129,9 @@ use Psr\Http\Message\ResponseInterface; * Get the host index * * @return int Host index -{{! CUSTOM - Add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated To be made private in the future +{{! CUSTOM - END }} */ public function getHostIndex() { @@ -150,8 +154,8 @@ use Psr\Http\Message\ResponseInterface; { return $this->response; } -{{! CUSTOM - END }} +{{! CUSTOM - END }} {{#operation}} /** * Operation {{{operationId}}} @@ -271,8 +275,9 @@ use Psr\Http\Message\ResponseInterface; * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) -{{! CUSTOM - Add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable +{{! CUSTOM - END }} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -285,8 +290,9 @@ use Psr\Http\Message\ResponseInterface; $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); -{{! CUSTOM - Set $this->response }} +{{! CUSTOM - BEGIN }} $this->response = $response; +{{! CUSTOM - END }} } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -475,8 +481,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface -{{! CUSTOM - add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable +{{! CUSTOM - END }} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -539,8 +546,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface -{{! CUSTOM - add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable +{{! CUSTOM - END }} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -631,8 +639,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request -{{! CUSTOM - add @deprecated }} +{{! CUSTOM - BEGIN }} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable +{{! CUSTOM - END }} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -711,7 +720,6 @@ use Psr\Http\Message\ResponseInterface; $multipart = !empty($formParams); {{/bodyParam}} {{! CUSTOM - END }} - {{#queryParams}} // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( @@ -773,16 +781,24 @@ use Psr\Http\Message\ResponseInterface; {{/formParams}} $headers = $this->headerSelector->selectHeaders( -{{! CUSTOM - ternary on $multipart }} +{{#vendorExtensions.x-ignore-block}} + [{{#produces}}'{{{mediaType}}}', {{/produces}}], +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} $multipart ? ['multipart/form-data'] : [{{#produces}}'{{{mediaType}}}', {{/produces}}], +{{! CUSTOM - END }} $contentType, $multipart ); // for model (json/xml) {{#bodyParams}} -{{! CUSTOM - count on $formParam instead of check on $paramName }} +{{#vendorExtensions.x-ignore-block}} + if (isset(${{paramName}})) { +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} if (count($formParams) === 0) { +{{! CUSTOM - END }} if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); @@ -821,7 +837,6 @@ use Psr\Http\Message\ResponseInterface; } {{/bodyParam}} {{! CUSTOM - END }} - $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { @@ -964,8 +979,8 @@ use Psr\Http\Message\ResponseInterface; return $options; } - {{! CUSTOM - BEGIN }} + /** * @return object|array|null */ diff --git a/sdks/php/templates/api_doc.mustache b/sdks/php/templates/api_doc.mustache index f42a29a8a..d15e51433 100644 --- a/sdks/php/templates/api_doc.mustache +++ b/sdks/php/templates/api_doc.mustache @@ -2,7 +2,12 @@ {{.}}{{/description}} +{{#vendorExtensions.x-ignore-block}} +All URIs are relative to {{basePath}}, except if the operation defines another base path. +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} All URIs are relative to {{basePath}}. +{{! CUSTOM - END }} | Method | HTTP request | Description | | ------------- | ------------- | ------------- | @@ -14,7 +19,23 @@ All URIs are relative to {{basePath}}. ```php {{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{.}}}{{/returnType}} ``` - +{{#vendorExtensions.x-ignore-block}} +{{#servers}} +{{#-first}} +### URI(s): +{{/-first}} +- {{{url}}} {{#description}}{{.}}{{/description}}{{#variables}} +{{#-first}} + - Variables: +{{/-first}} + - {{{name}}}: {{{description}}}{{^description}} No description provided{{/description}}{{#enumValues}} +{{#-first}} + - Allowed values: +{{/-first}} + - {{{.}}}{{/enumValues}}{{#defaultValue}} + - Default value: {{{.}}} +{{/defaultValue}}{{/variables}}{{/servers}} +{{/vendorExtensions.x-ignore-block}} {{{summary}}}{{#notes}} {{{.}}}{{/notes}} @@ -22,19 +43,73 @@ All URIs are relative to {{basePath}}. ### Example ```php +{{#vendorExtensions.x-ignore-block}} + php_doc_auth_partial}} +$apiInstance = new {{invokerPackage}}\Api\{{classname}}( + // 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(){{#hasAuthMethods}}, + $config{{/hasAuthMethods}} +); +{{^vendorExtensions.x-group-parameters}} +{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}}{{#servers}}{{#-first}} +$hostIndex = 0; +$variables = [{{#variables}} + '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}} +]; +{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}} +$associative_array = [ +{{#allParams}} '{{paramName}}' => {{{example}}}, // {{{dataType}}}{{#description}} | {{{.}}}{{/description}} +{{/allParams}} +{{#servers}}{{#-first}} + 'hostIndex' => 0, + $variables = [{{#variables}} + '{{{name}}}' => '{{{default}}}{{^default}}YOUR_VALUE{{/default}}',{{/variables}} + ], +{{/-first}}{{/servers}}]; +{{/vendorExtensions.x-group-parameters}} + +try { + {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}{{#servers}}{{#-first}}{{#allParams}}{{#-first}}, {{/-first}}{{/allParams}}$hostIndex, $variables{{/-first}}{{/servers}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associate_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} + print_r($result);{{/returnType}} +} catch (Exception $e) { + echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; +} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_PHP_CODE +{{! CUSTOM - END }} ``` ### Parameters {{#vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-ignore-block}} +Note: the input parameter is an associative array with the keys listed as the parameter names below. +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} Note: the input parameter is an associative array with the keys listed as the parameter name below. +{{! CUSTOM - END }} {{/vendorExtensions.x-group-parameters}} +{{#vendorExtensions.x-ignore-block}} +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- |{{/-last}}{{/allParams}} +{{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} | +{{/allParams}}{{#servers}}{{#-first}}| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | +| variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |{{/-first}} +{{/servers}} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} |{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}Name | Type | Description | Notes | | ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} | {{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} | {{/allParams}} +{{! CUSTOM - END }} ### Return type diff --git a/sdks/php/templates/composer.mustache b/sdks/php/templates/composer.mustache index 4c84c3cfa..be5dae780 100644 --- a/sdks/php/templates/composer.mustache +++ b/sdks/php/templates/composer.mustache @@ -27,8 +27,9 @@ { "name": "{{{developerOrganization}}}", "homepage": "{{{developerOrganizationUrl}}}", -{{! CUSTOM - add email }} +{{! CUSTOM - BEGIN }} "email": "{{{developerOrganizationEmail}}}" +{{! CUSTOM - END }} } ], "require": { @@ -42,8 +43,9 @@ "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^3.5", -{{! CUSTOM - add symfony/yaml }} +{{! CUSTOM - BEGIN }} "symfony/yaml": "^5.4" +{{! CUSTOM - END }} }, "autoload": { "psr-4": { "{{{escapedInvokerPackage}}}\\" : "{{{srcBasePath}}}/" } diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache index 43d9695b0..137daf5b5 100644 --- a/sdks/php/templates/libraries/psr-18/ApiException.mustache +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -92,8 +92,13 @@ class ApiException extends RequestException /** * Sets the deseralized response object (during deserialization) * -{{! CUSTOM - mixed to string|int|object|array|mixed }} +{{#vendorExtensions.x-ignore-block}} + * @param mixed $obj Deserialized response object +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} * @param string|int|object|array|mixed $obj Deserialized response object +{{! CUSTOM - END }} + * * @return void */ diff --git a/sdks/php/templates/model_doc.mustache b/sdks/php/templates/model_doc.mustache index 3f3578894..4b69d12c3 100644 --- a/sdks/php/templates/model_doc.mustache +++ b/sdks/php/templates/model_doc.mustache @@ -1,12 +1,20 @@ # {{#models}}{{#model}}# {{classname}} +{{! CUSTOM - BEGIN }} {{unescapedDescription}} +{{! CUSTOM - END }} ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +{{#vendorExtensions.x-ignore-block}} +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}} +{{/vars}} +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} {{#vars}}| `{{name}}`{{#required}}*_required_{{/required}} | {{#isPrimitiveType}}```{{{dataType}}}```{{/isPrimitiveType}}{{^isPrimitiveType}}[```{{{dataType}}}```]({{complexType}}.md){{/isPrimitiveType}} | REPLACE_ME_WITH_DESCRIPTION_BEGIN {{unescapedDescription}} REPLACE_ME_WITH_DESCRIPTION_END | {{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}} | {{/vars}} +{{! CUSTOM - END }} [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md){{/model}}{{/models}} diff --git a/sdks/php/templates/model_generic.mustache b/sdks/php/templates/model_generic.mustache index 88de8dfed..5bb2b5cbf 100644 --- a/sdks/php/templates/model_generic.mustache +++ b/sdks/php/templates/model_generic.mustache @@ -296,8 +296,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @param string $variableName * @param array $fields -{{! CUSTOM - mixed to string|int|object|array|mixed }} - * @param string|int|object|array|mixed $defaultValue +{{#vendorExtensions.x-ignore-block}} + * @param mixed $defaultValue +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} +* @param string|int|object|array|mixed $defaultValue +{{! CUSTOM - END }} */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { @@ -515,8 +519,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return boolean */ -{{! CUSTOM - add #[\ReturnTypeWillChange] }} +{{! CUSTOM - BEGIN }} #[\ReturnTypeWillChange] +{{! CUSTOM - END }} public function offsetExists($offset): bool { return isset($this->container[$offset]); @@ -543,8 +548,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ -{{! CUSTOM - add #[\ReturnTypeWillChange] }} +{{! CUSTOM - BEGIN }} #[\ReturnTypeWillChange] +{{! CUSTOM - END }} public function offsetSet($offset, $value): void { if (is_null($offset)) { @@ -561,8 +567,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ -{{! CUSTOM - add #[\ReturnTypeWillChange] }} +{{! CUSTOM - BEGIN }} #[\ReturnTypeWillChange] +{{! CUSTOM - END }} public function offsetUnset($offset): void { unset($this->container[$offset]); @@ -590,8 +597,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par { return json_encode( ObjectSerializer::sanitizeForSerialization($this), -{{! CUSTOM - JSON_PRETTY_PRINT to JSON_UNESCAPED_SLASHES }} +{{#vendorExtensions.x-ignore-block}} + JSON_PRETTY_PRINT +{{/vendorExtensions.x-ignore-block}} +{{! CUSTOM - BEGIN }} JSON_UNESCAPED_SLASHES +{{! CUSTOM - END }} ); } From 333461654345baf24e1925ee61f49d0f604bbab7 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Wed, 28 Aug 2024 14:00:40 -0500 Subject: [PATCH 11/19] vendorExtensions.x-ignore-block -> useCustomTemplateCode --- sdks/php/openapi-config.yaml | 1 + sdks/php/templates/ApiException.mustache | 24 ++-- sdks/php/templates/Configuration.mustache | 72 ++++++------ sdks/php/templates/ObjectSerializer.mustache | 72 ++++++------ sdks/php/templates/README.mustache | 60 +++++----- sdks/php/templates/api.mustache | 104 +++++++++--------- sdks/php/templates/api_doc.mustache | 36 +++--- sdks/php/templates/composer.mustache | 16 +-- .../libraries/psr-18/ApiException.mustache | 8 +- sdks/php/templates/model_doc.mustache | 12 +- sdks/php/templates/model_generic.mustache | 32 +++--- .../templates/php_doc_auth_partial.mustache | 12 +- 12 files changed, 225 insertions(+), 224 deletions(-) diff --git a/sdks/php/openapi-config.yaml b/sdks/php/openapi-config.yaml index 0ec7a9f82..64d102428 100644 --- a/sdks/php/openapi-config.yaml +++ b/sdks/php/openapi-config.yaml @@ -15,6 +15,7 @@ additionalProperties: developerOrganization: "Dropbox Sign" developerOrganizationUrl: "https://hellosign.com" developerOrganizationEmail: "apisupport@hellosign.com" + useCustomTemplateCode: true files: EventCallbackHelper.mustache: templateType: SupportingFiles diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index dddc9e00d..a21690240 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -47,12 +47,12 @@ class ApiException extends Exception /** * The deserialized response object * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @var \stdClass|string|null -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @var Model\ErrorResponse|string|null -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} */ protected $responseObject; @@ -94,12 +94,12 @@ class ApiException extends Exception /** * Sets the deserialized response object (during deserialization) * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $obj Deserialized response object -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $obj Deserialized response object -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * * @return void */ @@ -111,12 +111,12 @@ class ApiException extends Exception /** * Gets the deserialized response object (during deserialization) * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @return mixed the deserialized response object -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @return Model\ErrorResponse the deserialized response object -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} */ public function getResponseObject() { diff --git a/sdks/php/templates/Configuration.mustache b/sdks/php/templates/Configuration.mustache index f1d09d5aa..1dadde97c 100644 --- a/sdks/php/templates/Configuration.mustache +++ b/sdks/php/templates/Configuration.mustache @@ -113,7 +113,7 @@ class Configuration * @var string */ protected $tempFolderPath; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} /** * Holds any extra request options you want to send @@ -124,7 +124,7 @@ class Configuration /** @var ?callable */ protected $payloadHook = null; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} /** * Constructor @@ -142,12 +142,12 @@ class Configuration * * @return $this */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function setApiKey($apiKeyIdentifier, $key) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function setApiKey($apiKeyIdentifier, $key) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { $this->apiKeys[$apiKeyIdentifier] = $key; return $this; @@ -160,12 +160,12 @@ class Configuration * * @return null|string API key or token */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function getApiKey($apiKeyIdentifier) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function getApiKey($apiKeyIdentifier) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; } @@ -178,12 +178,12 @@ class Configuration * * @return $this */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function setApiKeyPrefix($apiKeyIdentifier, $prefix) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function setApiKeyPrefix($apiKeyIdentifier, $prefix) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; return $this; @@ -196,12 +196,12 @@ class Configuration * * @return null|string */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function getApiKeyPrefix($apiKeyIdentifier) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function getApiKeyPrefix($apiKeyIdentifier) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; } @@ -236,12 +236,12 @@ class Configuration * * @return $this */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function setBooleanFormatForQueryString(string $booleanFormat) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function setBooleanFormatForQueryString(string $booleanFormat) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { $this->booleanFormatForQueryString = $booleanFormat; @@ -288,12 +288,12 @@ class Configuration * * @return $this */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function setPassword($password) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function setPassword($password) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { $this->password = $password; return $this; @@ -304,12 +304,12 @@ class Configuration * * @return string Password for HTTP basic authentication */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function getPassword() -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function getPassword() -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { return $this->password; } @@ -486,12 +486,12 @@ class Configuration * * @return null|string API key with the prefix */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function getApiKeyWithPrefix($apiKeyIdentifier) -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} protected function getApiKeyWithPrefix($apiKeyIdentifier) -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} { $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); $apiKey = $this->getApiKey($apiKeyIdentifier); @@ -597,7 +597,7 @@ class Configuration { return self::getHostString($this->getHostSettings(), $index, $variables); } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} public function setOptions(array $options): self { @@ -627,5 +627,5 @@ class Configuration { return $this->payloadHook; } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index dc0fc473e..e0a00c7c1 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -21,9 +21,9 @@ namespace {{invokerPackage}}; use GuzzleHttp\Psr7\Utils; use {{modelPackage}}\ModelInterface; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} use GuzzleHttp; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} /** * ObjectSerializer Class Doc Comment @@ -51,12 +51,12 @@ class ObjectSerializer /** * Serialize data * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $data the data to serialize -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $data the data to serialize -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * @param string $type the OpenAPIToolsType of the data * @param string $format the format of the OpenAPITools type of the data * @@ -97,19 +97,19 @@ class ObjectSerializer } } } -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} if ($value !== null) { -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); } } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} } else if ($data instanceof \SplFileObject) { return (string) $data; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } else { foreach($data as $property => $value) { $values[$property] = self::sanitizeForSerialization($value); @@ -168,12 +168,12 @@ class ObjectSerializer /** * Checks if a value is empty, based on its OpenAPI type. * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $value -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $value -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * @param string $openApiType * * @return bool true if $value is empty @@ -217,12 +217,12 @@ class ObjectSerializer * Take query parameter properties and turn it into an array suitable for * native http_build_query or GuzzleHttp\Psr7\Query::build. * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $value Parameter value -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $value Parameter value -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * @param string $paramName Parameter name * @param string $openApiType OpenAPIType eg. array or object * @param string $style Parameter serialization style @@ -356,12 +356,12 @@ class ObjectSerializer * If it's a datetime object, format it in ISO8601 * If it's a boolean, convert it to "true" or "false". * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param float|int|bool|\DateTime $value the value of the parameter -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $value the value of the parameter -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * * @return string the header string */ @@ -416,12 +416,12 @@ class ObjectSerializer /** * Deserialize a JSON string into an object * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $data object or primitive to be deserialized -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $data object or primitive to be deserialized -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * @param string $class class name is passed as a string * @param string[] $httpHeaders HTTP headers * @@ -540,7 +540,7 @@ class ObjectSerializer // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} $discriminatorValue = null; if (is_object($data)) { $discriminatorValue = $data->{$discriminator} ?? null; @@ -549,18 +549,18 @@ class ObjectSerializer } $discrimnatorSubclassFound = false; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; if (is_subclass_of($subclass, $class)) { $class = $subclass; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} $discrimnatorSubclassFound = true; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} if ( !$discrimnatorSubclassFound && !empty($discriminator) @@ -578,7 +578,7 @@ class ObjectSerializer $class = $subclass; $discrimnatorSubclassFound = true; } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} /** @var ModelInterface $instance */ $instance = new $class(); @@ -668,7 +668,7 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} /** * Allows a multipart/form-data request to grab data from the typed * class created by OpenAPI. @@ -739,5 +739,5 @@ class ObjectSerializer return $hasFile ? $formParams : []; } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } diff --git a/sdks/php/templates/README.mustache b/sdks/php/templates/README.mustache index 6bc7507ec..a0f14993d 100644 --- a/sdks/php/templates/README.mustache +++ b/sdks/php/templates/README.mustache @@ -8,7 +8,7 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}). {{/infoUrl}} -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} ## Migrating from legacy SDK This SDK is generated from our officially maintained [OpenAPI spec](https://github.com/hellosign/hellosign-openapi/blob/main/openapi.yaml). @@ -46,25 +46,25 @@ Run the following and everything is done for you: to the OAS file and/or the mustache template files _will be lost_ when you run this command. -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ## Installation & Usage ### Requirements -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} PHP 7.4 and later. Should also work with PHP 8.0. -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} PHP {{phpVersion}} and later. -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ### Composer To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`: ```json -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} { "repositories": [ { @@ -76,20 +76,20 @@ To install the bindings via [Composer](https://getcomposer.org/), add the follow "{{gitUserId}}/{{gitRepoId}}": "*@dev" } } -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} { "require": { "{{packageName}}": "{{packageVersion}}" }, "minimum-stability": "dev" } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ``` Then run `composer install` -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} ### Manual Installation Download the files and include `autoload.php`: @@ -98,20 +98,20 @@ Download the files and include `autoload.php`: getMessage() . PHP_EOL; } ``` -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ## API Endpoints All URIs are relative to *{{basePath}}* -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} | Class | Method | HTTP request | Description | | ---------- | ------------- | ------------- | ------------- | {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| *{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} | {{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ## Models {{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}} {{/models}} ## Authorization -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{^authMethods}}Endpoints do not require authorization.{{/authMethods}} {{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}} -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{^authMethods}}All endpoints do not require authorization.{{/authMethods}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#authMethods}} -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{#last}} Authentication schemes defined for the API:{{/last}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ### {{{name}}} {{#isApiKey}} @@ -234,12 +234,12 @@ Class | Method | HTTP request | Description - **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} {{/isBasicBearer}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{#isHttpSignature}} - **Type**: HTTP signature authentication {{/isHttpSignature}} -{{/vendorExtensions.x-ignore-block}} +{{/useCustomTemplateCode}} {{/isBasic}} {{#isOAuth}} diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 3717275e9..7f2f65518 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -29,10 +29,10 @@ use {{invokerPackage}}\ApiException; use {{invokerPackage}}\Configuration; use {{invokerPackage}}\HeaderSelector; use {{invokerPackage}}\ObjectSerializer; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} use {{invokerPackage}}\Model; use Psr\Http\Message\ResponseInterface; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} /** * {{classname}} Class Doc Comment @@ -73,12 +73,12 @@ use Psr\Http\Message\ResponseInterface; {{/consumes}} ],{{/operation}} ]; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} /** @var ResponseInterface|null */ protected $response; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} /** * @param ClientInterface $client * @param Configuration $config @@ -91,8 +91,8 @@ use Psr\Http\Message\ResponseInterface; HeaderSelector $selector = null, $hostIndex = 0 ) { -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} /** * @param Configuration $config * @param ClientInterface $client @@ -105,7 +105,7 @@ use Psr\Http\Message\ResponseInterface; HeaderSelector $selector = null, $hostIndex = 0 ) { -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} $this->client = $client ?: new Client(); $this->config = $config ?: new Configuration(); $this->headerSelector = $selector ?: new HeaderSelector(); @@ -116,9 +116,9 @@ use Psr\Http\Message\ResponseInterface; * Set the host index * * @param int $hostIndex Host index (required) -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated To be made private in the future -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} */ public function setHostIndex($hostIndex): void { @@ -129,9 +129,9 @@ use Psr\Http\Message\ResponseInterface; * Get the host index * * @return int Host index -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated To be made private in the future -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} */ public function getHostIndex() { @@ -146,7 +146,7 @@ use Psr\Http\Message\ResponseInterface; return $this->config; } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} /** * @return ResponseInterface|null */ @@ -155,7 +155,7 @@ use Psr\Http\Message\ResponseInterface; return $this->response; } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#operation}} /** * Operation {{{operationId}}} @@ -195,7 +195,7 @@ use Psr\Http\Message\ResponseInterface; {{#allParams}} * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} {{/allParams}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{#servers}} {{#-first}} * @param null|int $hostIndex Host index. Defaults to null. If null, then the library will use $this->hostIndex instead @@ -203,7 +203,7 @@ use Psr\Http\Message\ResponseInterface; {{/-first}} {{/servers}} * @param string $contentType The value for the Content-Type header. Check self::contentTypes['{{{operationId}}}'] to see the possible values for this operation -{{/vendorExtensions.x-ignore-block}} +{{/useCustomTemplateCode}} * * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException @@ -212,18 +212,18 @@ use Psr\Http\Message\ResponseInterface; * @deprecated {{/isDeprecated}} */ -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}}{{#servers}}{{#-first}}?int $hostIndex = null, array $variables = [], {{/-first}}{{/servers}}string $contentType = self::contentTypes['{{{operationId}}}'][0]{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}, {{/allParams}}{{#servers}}{{#-first}}$hostIndex, $variables, {{/-first}}{{/servers}}$contentType{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}});{{#returnType}} return $response;{{/returnType}} -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) { {{#returnType}}list($response) = {{/returnType}}$this->{{operationId}}WithHttpInfo({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} return $response;{{/returnType}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } /** @@ -275,9 +275,9 @@ use Psr\Http\Message\ResponseInterface; * @throws \{{invokerPackage}}\ApiException on non-2xx response or if the response body is not in the expected format * @throws \InvalidArgumentException * @return array of {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}null{{/returnType}}, HTTP status code, HTTP response headers (array of strings) -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -290,9 +290,9 @@ use Psr\Http\Message\ResponseInterface; $options = $this->createHttpClientOption(); try { $response = $this->client->send($request, $options); -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} $this->response = $response; -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } catch (RequestException $e) { throw new ApiException( "[{$e->getCode()}] {$e->getMessage()}", @@ -324,7 +324,7 @@ use Psr\Http\Message\ResponseInterface; ); } {{#returnType}} -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{#responses}}{{#dataType}}{{#isRange}} $result = $this->handleRangeCodeResponse( $response, @@ -335,7 +335,7 @@ use Psr\Http\Message\ResponseInterface; return $result; } {{/isRange}}{{/dataType}}{{/responses}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#responses}} {{#-first}} @@ -409,12 +409,12 @@ use Psr\Http\Message\ResponseInterface; {{/returnType}} } catch (ApiException $e) { -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{#responses}}{{#dataType}}{{#isRange}} if ($this->handleRangeCodeException($e, '{{code}}', '{{{dataType}}}')) { throw $e; }{{/isRange}}{{/dataType}}{{/responses}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} switch ($e->getCode()) { {{#responses}} {{#dataType}} @@ -481,9 +481,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -546,9 +546,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -639,9 +639,9 @@ use Psr\Http\Message\ResponseInterface; * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} * @deprecated Prefer to use ::{{operationId}}. This method will eventually become unavailable -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -711,7 +711,7 @@ use Psr\Http\Message\ResponseInterface; $httpBody = ''; $multipart = false; -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{#bodyParam}} $formParams = ObjectSerializer::getFormParams( ${{paramName}} @@ -719,7 +719,7 @@ use Psr\Http\Message\ResponseInterface; $multipart = !empty($formParams); {{/bodyParam}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{#queryParams}} // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( @@ -781,24 +781,24 @@ use Psr\Http\Message\ResponseInterface; {{/formParams}} $headers = $this->headerSelector->selectHeaders( -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} [{{#produces}}'{{{mediaType}}}', {{/produces}}], -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} $multipart ? ['multipart/form-data'] : [{{#produces}}'{{{mediaType}}}', {{/produces}}], -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} $contentType, $multipart ); // for model (json/xml) {{#bodyParams}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} if (isset(${{paramName}})) { -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} if (count($formParams) === 0) { -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} if (stripos($headers['Content-Type'], 'application/json') !== false) { # if Content-Type contains "application/json", json_encode the body $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization(${{paramName}})); @@ -822,7 +822,7 @@ use Psr\Http\Message\ResponseInterface; } } // for HTTP post (form) -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} if (!empty($body)) { $multipartContents[] = [ 'name' => 'body', @@ -836,7 +836,7 @@ use Psr\Http\Message\ResponseInterface; $payloadHook('multipart', $multipartContents, ${{paramName}}); } {{/bodyParam}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} $httpBody = new MultipartStream($multipartContents); } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { @@ -859,14 +859,14 @@ use Psr\Http\Message\ResponseInterface; {{#isBasic}} {{#isBasicBasic}} // this endpoint requires HTTP basic authentication -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} if (!empty($this->config->getUsername())) { $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ':'); -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } {{/isBasicBasic}} {{#isBasicBearer}} @@ -979,7 +979,7 @@ use Psr\Http\Message\ResponseInterface; return $options; } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} /** * @return object|array|null @@ -1042,6 +1042,6 @@ use Psr\Http\Message\ResponseInterface; return true; } -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } {{/operations}} diff --git a/sdks/php/templates/api_doc.mustache b/sdks/php/templates/api_doc.mustache index d15e51433..6a0b0fc04 100644 --- a/sdks/php/templates/api_doc.mustache +++ b/sdks/php/templates/api_doc.mustache @@ -2,12 +2,12 @@ {{.}}{{/description}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} All URIs are relative to {{basePath}}, except if the operation defines another base path. -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} All URIs are relative to {{basePath}}. -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} | Method | HTTP request | Description | | ------------- | ------------- | ------------- | @@ -19,7 +19,7 @@ All URIs are relative to {{basePath}}. ```php {{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}}){{#returnType}}: {{{.}}}{{/returnType}} ``` -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{#servers}} {{#-first}} ### URI(s): @@ -35,7 +35,7 @@ All URIs are relative to {{basePath}}. - {{{.}}}{{/enumValues}}{{#defaultValue}} - Default value: {{{.}}} {{/defaultValue}}{{/variables}}{{/servers}} -{{/vendorExtensions.x-ignore-block}} +{{/useCustomTemplateCode}} {{{summary}}}{{#notes}} {{{.}}}{{/notes}} @@ -43,7 +43,7 @@ All URIs are relative to {{basePath}}. ### Example ```php -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{operationId}}: ', $e->getMessage(), PHP_EOL; } -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_PHP_CODE -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ``` ### Parameters {{#vendorExtensions.x-group-parameters}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} Note: the input parameter is an associative array with the keys listed as the parameter names below. -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} Note: the input parameter is an associative array with the keys listed as the parameter name below. -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{/vendorExtensions.x-group-parameters}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}| Name | Type | Description | Notes | | ------------- | ------------- | ------------- | ------------- |{{/-last}}{{/allParams}} {{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} | {{/allParams}}{{#servers}}{{#-first}}| hostIndex | null|int | Host index. Defaults to null. If null, then the library will use $this->hostIndex instead | [optional] | | variables | array | Associative array of variables to pass to the host. Defaults to empty array. | [optional] |{{/-first}} {{/servers}} -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} |{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}Name | Type | Description | Notes | | ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} | {{#allParams}}| **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**](../Model/{{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{.}}]{{/defaultValue}} | {{/allParams}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ### Return type diff --git a/sdks/php/templates/composer.mustache b/sdks/php/templates/composer.mustache index be5dae780..08469c70c 100644 --- a/sdks/php/templates/composer.mustache +++ b/sdks/php/templates/composer.mustache @@ -2,11 +2,11 @@ {{#composerPackageName}} "name": "{{{.}}}", {{/composerPackageName}} -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{#artifactVersion}} "version": "{{{.}}}", {{/artifactVersion}} -{{/vendorExtensions.x-ignore-block}} +{{/useCustomTemplateCode}} "description": "{{{appDescription}}}", "keywords": [ "openapitools", @@ -16,10 +16,10 @@ "sdk", "rest", "api", -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} "hellosign", "dropboxsign" -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ], "homepage": "{{{artifactUrl}}}", "license": "{{{licenseName}}}", @@ -27,9 +27,9 @@ { "name": "{{{developerOrganization}}}", "homepage": "{{{developerOrganizationUrl}}}", -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} "email": "{{{developerOrganizationEmail}}}" -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} } ], "require": { @@ -43,9 +43,9 @@ "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", "friendsofphp/php-cs-fixer": "^3.5", -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} "symfony/yaml": "^5.4" -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} }, "autoload": { "psr-4": { "{{{escapedInvokerPackage}}}\\" : "{{{srcBasePath}}}/" } diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache index 137daf5b5..c8a3b935b 100644 --- a/sdks/php/templates/libraries/psr-18/ApiException.mustache +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -92,12 +92,12 @@ class ApiException extends RequestException /** * Sets the deseralized response object (during deserialization) * -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $obj Deserialized response object -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $obj Deserialized response object -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} * * @return void diff --git a/sdks/php/templates/model_doc.mustache b/sdks/php/templates/model_doc.mustache index 4b69d12c3..935522686 100644 --- a/sdks/php/templates/model_doc.mustache +++ b/sdks/php/templates/model_doc.mustache @@ -1,20 +1,20 @@ # {{#models}}{{#model}}# {{classname}} -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{unescapedDescription}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} {{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} |{{^required}} [optional]{{/required}}{{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}} {{/vars}} -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} {{#vars}}| `{{name}}`{{#required}}*_required_{{/required}} | {{#isPrimitiveType}}```{{{dataType}}}```{{/isPrimitiveType}}{{^isPrimitiveType}}[```{{{dataType}}}```]({{complexType}}.md){{/isPrimitiveType}} | REPLACE_ME_WITH_DESCRIPTION_BEGIN {{unescapedDescription}} REPLACE_ME_WITH_DESCRIPTION_END | {{#isReadOnly}} [readonly]{{/isReadOnly}}{{#defaultValue}} [default to {{{.}}}]{{/defaultValue}} | {{/vars}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} [[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md){{/model}}{{/models}} diff --git a/sdks/php/templates/model_generic.mustache b/sdks/php/templates/model_generic.mustache index 5bb2b5cbf..3b213dd3b 100644 --- a/sdks/php/templates/model_generic.mustache +++ b/sdks/php/templates/model_generic.mustache @@ -250,7 +250,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par {{/discriminator}} } -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} {{^discriminator}} /** @deprecated use ::init() */ public static function fromArray(array $data): {{classname}} @@ -287,7 +287,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par return null; } {{/discriminator}} -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} /** * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName @@ -296,12 +296,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @param string $variableName * @param array $fields -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} * @param mixed $defaultValue -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} * @param string|int|object|array|mixed $defaultValue -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} */ private function setIfExists(string $variableName, array $fields, $defaultValue): void { @@ -519,9 +519,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return boolean */ -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} #[\ReturnTypeWillChange] -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} public function offsetExists($offset): bool { return isset($this->container[$offset]); @@ -548,9 +548,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} #[\ReturnTypeWillChange] -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} public function offsetSet($offset, $value): void { if (is_null($offset)) { @@ -567,9 +567,9 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par * * @return void */ -{{! CUSTOM - BEGIN }} +{{#useCustomTemplateCode}} #[\ReturnTypeWillChange] -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} public function offsetUnset($offset): void { unset($this->container[$offset]); @@ -597,12 +597,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par { return json_encode( ObjectSerializer::sanitizeForSerialization($this), -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} JSON_PRETTY_PRINT -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} JSON_UNESCAPED_SLASHES -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} ); } diff --git a/sdks/php/templates/php_doc_auth_partial.mustache b/sdks/php/templates/php_doc_auth_partial.mustache index 3208a6b04..5f2d05eaf 100644 --- a/sdks/php/templates/php_doc_auth_partial.mustache +++ b/sdks/php/templates/php_doc_auth_partial.mustache @@ -3,13 +3,13 @@ {{#isBasicBasic}} // Configure HTTP basic authorization: {{{name}}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration() -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); -{{/vendorExtensions.x-ignore-block}} -{{! CUSTOM - BEGIN }} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} ->setApiKey('YOUR_API_KEY'); -{{! CUSTOM - END }} +{{/useCustomTemplateCode}} {{/isBasicBasic}} {{#isBasicBearer}} // Configure Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authorization: {{{name}}} @@ -19,10 +19,10 @@ $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAcce {{#isApiKey}} // Configure API key authorization: {{{name}}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); -{{#vendorExtensions.x-ignore-block}} +{{^useCustomTemplateCode}} // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer'); -{{/vendorExtensions.x-ignore-block}} +{{/useCustomTemplateCode}} {{/isApiKey}} {{#isOAuth}} // Configure OAuth2 access token for authorization: {{{name}}} From 25d0b289f73a103493730ced6e3a53296169821a Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Wed, 28 Aug 2024 17:34:08 -0500 Subject: [PATCH 12/19] Updating openapi-generator for PHP to 7.8.0 --- sdks/php/README.md | 2 +- sdks/php/run-build | 4 ++-- sdks/php/src/Api/AccountApi.php | 2 +- sdks/php/src/Api/ApiAppApi.php | 2 +- sdks/php/src/Api/BulkSendJobApi.php | 2 +- sdks/php/src/Api/EmbeddedApi.php | 2 +- sdks/php/src/Api/FaxLineApi.php | 2 +- sdks/php/src/Api/OAuthApi.php | 2 +- sdks/php/src/Api/ReportApi.php | 2 +- sdks/php/src/Api/SignatureRequestApi.php | 2 +- sdks/php/src/Api/TeamApi.php | 2 +- sdks/php/src/Api/TemplateApi.php | 2 +- sdks/php/src/Api/UnclaimedDraftApi.php | 2 +- sdks/php/src/ApiException.php | 8 ++++---- sdks/php/src/Configuration.php | 2 +- sdks/php/src/EventCallbackHelper.php | 2 +- sdks/php/src/HeaderSelector.php | 2 +- sdks/php/src/Model/AccountCreateRequest.php | 2 +- sdks/php/src/Model/AccountCreateResponse.php | 2 +- sdks/php/src/Model/AccountGetResponse.php | 2 +- sdks/php/src/Model/AccountResponse.php | 2 +- sdks/php/src/Model/AccountResponseQuotas.php | 2 +- sdks/php/src/Model/AccountResponseUsage.php | 2 +- sdks/php/src/Model/AccountUpdateRequest.php | 2 +- sdks/php/src/Model/AccountVerifyRequest.php | 2 +- sdks/php/src/Model/AccountVerifyResponse.php | 2 +- .../src/Model/AccountVerifyResponseAccount.php | 2 +- sdks/php/src/Model/ApiAppCreateRequest.php | 2 +- sdks/php/src/Model/ApiAppGetResponse.php | 2 +- sdks/php/src/Model/ApiAppListResponse.php | 2 +- sdks/php/src/Model/ApiAppResponse.php | 2 +- sdks/php/src/Model/ApiAppResponseOAuth.php | 2 +- sdks/php/src/Model/ApiAppResponseOptions.php | 2 +- sdks/php/src/Model/ApiAppResponseOwnerAccount.php | 2 +- .../Model/ApiAppResponseWhiteLabelingOptions.php | 2 +- sdks/php/src/Model/ApiAppUpdateRequest.php | 2 +- sdks/php/src/Model/BulkSendJobGetResponse.php | 2 +- .../BulkSendJobGetResponseSignatureRequests.php | 2 +- sdks/php/src/Model/BulkSendJobListResponse.php | 2 +- sdks/php/src/Model/BulkSendJobResponse.php | 2 +- sdks/php/src/Model/BulkSendJobSendResponse.php | 2 +- sdks/php/src/Model/EmbeddedEditUrlRequest.php | 2 +- sdks/php/src/Model/EmbeddedEditUrlResponse.php | 2 +- .../src/Model/EmbeddedEditUrlResponseEmbedded.php | 2 +- sdks/php/src/Model/EmbeddedSignUrlResponse.php | 2 +- .../src/Model/EmbeddedSignUrlResponseEmbedded.php | 2 +- sdks/php/src/Model/ErrorResponse.php | 2 +- sdks/php/src/Model/ErrorResponseError.php | 2 +- sdks/php/src/Model/EventCallbackRequest.php | 2 +- sdks/php/src/Model/EventCallbackRequestEvent.php | 2 +- .../Model/EventCallbackRequestEventMetadata.php | 2 +- sdks/php/src/Model/FaxLineAddUserRequest.php | 2 +- .../src/Model/FaxLineAreaCodeGetCountryEnum.php | 2 +- .../src/Model/FaxLineAreaCodeGetProvinceEnum.php | 2 +- sdks/php/src/Model/FaxLineAreaCodeGetResponse.php | 2 +- .../php/src/Model/FaxLineAreaCodeGetStateEnum.php | 2 +- sdks/php/src/Model/FaxLineCreateRequest.php | 2 +- sdks/php/src/Model/FaxLineDeleteRequest.php | 2 +- sdks/php/src/Model/FaxLineListResponse.php | 2 +- sdks/php/src/Model/FaxLineRemoveUserRequest.php | 2 +- sdks/php/src/Model/FaxLineResponse.php | 2 +- sdks/php/src/Model/FaxLineResponseFaxLine.php | 2 +- sdks/php/src/Model/FileResponse.php | 2 +- sdks/php/src/Model/FileResponseDataUri.php | 2 +- sdks/php/src/Model/ListInfoResponse.php | 2 +- sdks/php/src/Model/ModelInterface.php | 2 +- sdks/php/src/Model/OAuthTokenGenerateRequest.php | 2 +- sdks/php/src/Model/OAuthTokenRefreshRequest.php | 2 +- sdks/php/src/Model/OAuthTokenResponse.php | 2 +- sdks/php/src/Model/ReportCreateRequest.php | 2 +- sdks/php/src/Model/ReportCreateResponse.php | 2 +- sdks/php/src/Model/ReportResponse.php | 2 +- ...questBulkCreateEmbeddedWithTemplateRequest.php | 2 +- ...ignatureRequestBulkSendWithTemplateRequest.php | 2 +- .../SignatureRequestCreateEmbeddedRequest.php | 2 +- ...reRequestCreateEmbeddedWithTemplateRequest.php | 2 +- .../php/src/Model/SignatureRequestGetResponse.php | 2 +- .../src/Model/SignatureRequestListResponse.php | 2 +- .../src/Model/SignatureRequestRemindRequest.php | 2 +- sdks/php/src/Model/SignatureRequestResponse.php | 2 +- .../Model/SignatureRequestResponseAttachment.php | 2 +- .../SignatureRequestResponseCustomFieldBase.php | 2 +- ...ignatureRequestResponseCustomFieldCheckbox.php | 2 +- .../SignatureRequestResponseCustomFieldText.php | 2 +- ...ignatureRequestResponseCustomFieldTypeEnum.php | 2 +- .../Model/SignatureRequestResponseDataBase.php | 2 +- .../SignatureRequestResponseDataTypeEnum.php | 2 +- .../SignatureRequestResponseDataValueCheckbox.php | 2 +- ...atureRequestResponseDataValueCheckboxMerge.php | 2 +- ...ignatureRequestResponseDataValueDateSigned.php | 2 +- .../SignatureRequestResponseDataValueDropdown.php | 2 +- .../SignatureRequestResponseDataValueInitials.php | 2 +- .../SignatureRequestResponseDataValueRadio.php | 2 +- ...SignatureRequestResponseDataValueSignature.php | 2 +- .../SignatureRequestResponseDataValueText.php | 2 +- ...SignatureRequestResponseDataValueTextMerge.php | 2 +- .../Model/SignatureRequestResponseSignatures.php | 2 +- .../php/src/Model/SignatureRequestSendRequest.php | 2 +- .../SignatureRequestSendWithTemplateRequest.php | 2 +- .../src/Model/SignatureRequestUpdateRequest.php | 2 +- sdks/php/src/Model/SubAttachment.php | 2 +- sdks/php/src/Model/SubBulkSignerList.php | 2 +- .../src/Model/SubBulkSignerListCustomField.php | 2 +- sdks/php/src/Model/SubCC.php | 2 +- sdks/php/src/Model/SubCustomField.php | 2 +- sdks/php/src/Model/SubEditorOptions.php | 2 +- sdks/php/src/Model/SubFieldOptions.php | 2 +- sdks/php/src/Model/SubFormFieldGroup.php | 2 +- sdks/php/src/Model/SubFormFieldRule.php | 2 +- sdks/php/src/Model/SubFormFieldRuleAction.php | 2 +- sdks/php/src/Model/SubFormFieldRuleTrigger.php | 2 +- .../src/Model/SubFormFieldsPerDocumentBase.php | 2 +- .../Model/SubFormFieldsPerDocumentCheckbox.php | 2 +- .../SubFormFieldsPerDocumentCheckboxMerge.php | 2 +- .../Model/SubFormFieldsPerDocumentDateSigned.php | 2 +- .../Model/SubFormFieldsPerDocumentDropdown.php | 2 +- .../Model/SubFormFieldsPerDocumentFontEnum.php | 2 +- .../Model/SubFormFieldsPerDocumentHyperlink.php | 2 +- .../Model/SubFormFieldsPerDocumentInitials.php | 2 +- .../src/Model/SubFormFieldsPerDocumentRadio.php | 2 +- .../Model/SubFormFieldsPerDocumentSignature.php | 2 +- .../src/Model/SubFormFieldsPerDocumentText.php | 2 +- .../Model/SubFormFieldsPerDocumentTextMerge.php | 2 +- .../Model/SubFormFieldsPerDocumentTypeEnum.php | 2 +- sdks/php/src/Model/SubMergeField.php | 2 +- sdks/php/src/Model/SubOAuth.php | 2 +- sdks/php/src/Model/SubOptions.php | 2 +- .../Model/SubSignatureRequestGroupedSigners.php | 2 +- sdks/php/src/Model/SubSignatureRequestSigner.php | 2 +- .../Model/SubSignatureRequestTemplateSigner.php | 2 +- sdks/php/src/Model/SubSigningOptions.php | 2 +- sdks/php/src/Model/SubTeamResponse.php | 2 +- sdks/php/src/Model/SubTemplateRole.php | 2 +- sdks/php/src/Model/SubUnclaimedDraftSigner.php | 2 +- .../src/Model/SubUnclaimedDraftTemplateSigner.php | 2 +- sdks/php/src/Model/SubWhiteLabelingOptions.php | 2 +- sdks/php/src/Model/TeamAddMemberRequest.php | 2 +- sdks/php/src/Model/TeamCreateRequest.php | 2 +- sdks/php/src/Model/TeamGetInfoResponse.php | 2 +- sdks/php/src/Model/TeamGetResponse.php | 2 +- sdks/php/src/Model/TeamInfoResponse.php | 2 +- sdks/php/src/Model/TeamInviteResponse.php | 2 +- sdks/php/src/Model/TeamInvitesResponse.php | 2 +- sdks/php/src/Model/TeamMemberResponse.php | 2 +- sdks/php/src/Model/TeamMembersResponse.php | 2 +- sdks/php/src/Model/TeamParentResponse.php | 2 +- sdks/php/src/Model/TeamRemoveMemberRequest.php | 2 +- sdks/php/src/Model/TeamResponse.php | 2 +- sdks/php/src/Model/TeamSubTeamsResponse.php | 2 +- sdks/php/src/Model/TeamUpdateRequest.php | 2 +- sdks/php/src/Model/TemplateAddUserRequest.php | 2 +- .../Model/TemplateCreateEmbeddedDraftRequest.php | 2 +- .../Model/TemplateCreateEmbeddedDraftResponse.php | 2 +- ...emplateCreateEmbeddedDraftResponseTemplate.php | 2 +- sdks/php/src/Model/TemplateCreateRequest.php | 2 +- sdks/php/src/Model/TemplateCreateResponse.php | 2 +- .../src/Model/TemplateCreateResponseTemplate.php | 2 +- sdks/php/src/Model/TemplateEditResponse.php | 2 +- sdks/php/src/Model/TemplateGetResponse.php | 2 +- sdks/php/src/Model/TemplateListResponse.php | 2 +- sdks/php/src/Model/TemplateRemoveUserRequest.php | 2 +- sdks/php/src/Model/TemplateResponse.php | 2 +- sdks/php/src/Model/TemplateResponseAccount.php | 2 +- .../src/Model/TemplateResponseAccountQuota.php | 2 +- sdks/php/src/Model/TemplateResponseCCRole.php | 2 +- sdks/php/src/Model/TemplateResponseDocument.php | 2 +- .../TemplateResponseDocumentCustomFieldBase.php | 2 +- ...emplateResponseDocumentCustomFieldCheckbox.php | 2 +- .../TemplateResponseDocumentCustomFieldText.php | 2 +- .../Model/TemplateResponseDocumentFieldGroup.php | 2 +- .../TemplateResponseDocumentFieldGroupRule.php | 2 +- .../TemplateResponseDocumentFormFieldBase.php | 2 +- .../TemplateResponseDocumentFormFieldCheckbox.php | 2 +- ...emplateResponseDocumentFormFieldDateSigned.php | 2 +- .../TemplateResponseDocumentFormFieldDropdown.php | 2 +- ...TemplateResponseDocumentFormFieldHyperlink.php | 2 +- .../TemplateResponseDocumentFormFieldInitials.php | 2 +- .../TemplateResponseDocumentFormFieldRadio.php | 2 +- ...TemplateResponseDocumentFormFieldSignature.php | 2 +- .../TemplateResponseDocumentFormFieldText.php | 2 +- .../TemplateResponseDocumentStaticFieldBase.php | 2 +- ...emplateResponseDocumentStaticFieldCheckbox.php | 2 +- ...plateResponseDocumentStaticFieldDateSigned.php | 2 +- ...emplateResponseDocumentStaticFieldDropdown.php | 2 +- ...mplateResponseDocumentStaticFieldHyperlink.php | 2 +- ...emplateResponseDocumentStaticFieldInitials.php | 2 +- .../TemplateResponseDocumentStaticFieldRadio.php | 2 +- ...mplateResponseDocumentStaticFieldSignature.php | 2 +- .../TemplateResponseDocumentStaticFieldText.php | 2 +- .../Model/TemplateResponseFieldAvgTextLength.php | 2 +- sdks/php/src/Model/TemplateResponseSignerRole.php | 2 +- sdks/php/src/Model/TemplateUpdateFilesRequest.php | 2 +- .../php/src/Model/TemplateUpdateFilesResponse.php | 2 +- .../Model/TemplateUpdateFilesResponseTemplate.php | 2 +- .../Model/UnclaimedDraftCreateEmbeddedRequest.php | 2 +- ...imedDraftCreateEmbeddedWithTemplateRequest.php | 2 +- .../php/src/Model/UnclaimedDraftCreateRequest.php | 2 +- .../src/Model/UnclaimedDraftCreateResponse.php | 2 +- .../Model/UnclaimedDraftEditAndResendRequest.php | 2 +- sdks/php/src/Model/UnclaimedDraftResponse.php | 2 +- sdks/php/src/Model/WarningResponse.php | 2 +- sdks/php/src/ObjectSerializer.php | 8 ++++++-- sdks/php/templates/ApiException.mustache | 6 +++--- sdks/php/templates/ObjectSerializer.mustache | 12 ++++++++---- sdks/php/templates/api.mustache | 2 +- sdks/php/templates/composer.mustache | 15 ++++++++++++--- .../libraries/psr-18/ApiException.mustache | 4 ++-- 207 files changed, 237 insertions(+), 220 deletions(-) diff --git a/sdks/php/README.md b/sdks/php/README.md index 7a2b727c6..8d3c17000 100644 --- a/sdks/php/README.md +++ b/sdks/php/README.md @@ -430,5 +430,5 @@ This PHP package is automatically generated by the [OpenAPI Generator](https://o - API version: `3.0.0` - Package version: `1.5-dev` - - Generator version: `7.7.0` + - Generator version: `7.8.0` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/sdks/php/run-build b/sdks/php/run-build index b847c81f4..f2d645a92 100755 --- a/sdks/php/run-build +++ b/sdks/php/run-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# see https://github.com/OpenAPITools/openapi-generator/tree/v7.7.0/modules/openapi-generator/src/main/resources/php +# see https://github.com/OpenAPITools/openapi-generator/tree/v7.8.0/modules/openapi-generator/src/main/resources/php set -e @@ -10,7 +10,7 @@ WORKING_DIR="/app/php" docker run --rm \ -v "${DIR}/:/local" \ -v "${DIR}/openapi-sdk.yaml:/local/openapi-sdk.yaml" \ - openapitools/openapi-generator-cli:v7.7.0 generate \ + openapitools/openapi-generator-cli:v7.8.0 generate \ -i "/local/openapi-sdk.yaml" \ -c "/local/openapi-config.yaml" \ -t "/local/templates" \ diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index 82c1242fe..d29b3a748 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index ecd81f2bf..2a0c3e9d0 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index 0e2639e3f..caf88f6b9 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index b01be61c3..4d1570294 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/FaxLineApi.php b/sdks/php/src/Api/FaxLineApi.php index d8dac79fa..08d8834df 100644 --- a/sdks/php/src/Api/FaxLineApi.php +++ b/sdks/php/src/Api/FaxLineApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index fadcfe7a5..a877aef65 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index f2a2f29b9..2700535db 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index 0681d7bcf..ea1ec359e 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index 9cdf1db79..fc12c18b7 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 01fffa9ed..1cefa919c 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index 32cc2a4bf..c2359c6ff 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/ApiException.php b/sdks/php/src/ApiException.php index a79ff7157..3d4a49ca7 100644 --- a/sdks/php/src/ApiException.php +++ b/sdks/php/src/ApiException.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** @@ -47,7 +47,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -63,7 +63,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct(string $message = '', int $code = 0, ?array $responseHeaders = [], $responseBody = null) @@ -76,7 +76,7 @@ public function __construct(string $message = '', int $code = 0, ?array $respons /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/sdks/php/src/Configuration.php b/sdks/php/src/Configuration.php index b1d5ec56d..1292f9dad 100644 --- a/sdks/php/src/Configuration.php +++ b/sdks/php/src/Configuration.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/EventCallbackHelper.php b/sdks/php/src/EventCallbackHelper.php index 9a45e4507..16e76ec8b 100644 --- a/sdks/php/src/EventCallbackHelper.php +++ b/sdks/php/src/EventCallbackHelper.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/HeaderSelector.php b/sdks/php/src/HeaderSelector.php index 49fb0c15c..fe1faf2c1 100644 --- a/sdks/php/src/HeaderSelector.php +++ b/sdks/php/src/HeaderSelector.php @@ -15,7 +15,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountCreateRequest.php b/sdks/php/src/Model/AccountCreateRequest.php index 963dc14ab..f4b927310 100644 --- a/sdks/php/src/Model/AccountCreateRequest.php +++ b/sdks/php/src/Model/AccountCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountCreateResponse.php b/sdks/php/src/Model/AccountCreateResponse.php index 8b4949a0a..c32d7c867 100644 --- a/sdks/php/src/Model/AccountCreateResponse.php +++ b/sdks/php/src/Model/AccountCreateResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountGetResponse.php b/sdks/php/src/Model/AccountGetResponse.php index 4dfff2638..84ef80142 100644 --- a/sdks/php/src/Model/AccountGetResponse.php +++ b/sdks/php/src/Model/AccountGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountResponse.php b/sdks/php/src/Model/AccountResponse.php index 9ada4fa7e..3fb1a1869 100644 --- a/sdks/php/src/Model/AccountResponse.php +++ b/sdks/php/src/Model/AccountResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountResponseQuotas.php b/sdks/php/src/Model/AccountResponseQuotas.php index 53d691406..3ec8d7a9e 100644 --- a/sdks/php/src/Model/AccountResponseQuotas.php +++ b/sdks/php/src/Model/AccountResponseQuotas.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountResponseUsage.php b/sdks/php/src/Model/AccountResponseUsage.php index 082817de4..94eb509e7 100644 --- a/sdks/php/src/Model/AccountResponseUsage.php +++ b/sdks/php/src/Model/AccountResponseUsage.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountUpdateRequest.php b/sdks/php/src/Model/AccountUpdateRequest.php index 89ca192dd..34a65c498 100644 --- a/sdks/php/src/Model/AccountUpdateRequest.php +++ b/sdks/php/src/Model/AccountUpdateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountVerifyRequest.php b/sdks/php/src/Model/AccountVerifyRequest.php index bf5addf20..d8731ea40 100644 --- a/sdks/php/src/Model/AccountVerifyRequest.php +++ b/sdks/php/src/Model/AccountVerifyRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountVerifyResponse.php b/sdks/php/src/Model/AccountVerifyResponse.php index ec83786d3..f8f6a65e5 100644 --- a/sdks/php/src/Model/AccountVerifyResponse.php +++ b/sdks/php/src/Model/AccountVerifyResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/AccountVerifyResponseAccount.php b/sdks/php/src/Model/AccountVerifyResponseAccount.php index 3a400dc6a..34a1de5e9 100644 --- a/sdks/php/src/Model/AccountVerifyResponseAccount.php +++ b/sdks/php/src/Model/AccountVerifyResponseAccount.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppCreateRequest.php b/sdks/php/src/Model/ApiAppCreateRequest.php index b6cb69f5d..d31444091 100644 --- a/sdks/php/src/Model/ApiAppCreateRequest.php +++ b/sdks/php/src/Model/ApiAppCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppGetResponse.php b/sdks/php/src/Model/ApiAppGetResponse.php index 4a8da0e31..0507cd879 100644 --- a/sdks/php/src/Model/ApiAppGetResponse.php +++ b/sdks/php/src/Model/ApiAppGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppListResponse.php b/sdks/php/src/Model/ApiAppListResponse.php index 2248124e7..81b33b826 100644 --- a/sdks/php/src/Model/ApiAppListResponse.php +++ b/sdks/php/src/Model/ApiAppListResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppResponse.php b/sdks/php/src/Model/ApiAppResponse.php index 02dae90f3..3e214031d 100644 --- a/sdks/php/src/Model/ApiAppResponse.php +++ b/sdks/php/src/Model/ApiAppResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppResponseOAuth.php b/sdks/php/src/Model/ApiAppResponseOAuth.php index 16bc5bb70..57a61134a 100644 --- a/sdks/php/src/Model/ApiAppResponseOAuth.php +++ b/sdks/php/src/Model/ApiAppResponseOAuth.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppResponseOptions.php b/sdks/php/src/Model/ApiAppResponseOptions.php index 746771962..99c11f02a 100644 --- a/sdks/php/src/Model/ApiAppResponseOptions.php +++ b/sdks/php/src/Model/ApiAppResponseOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php index 5bd18a67e..ffc120960 100644 --- a/sdks/php/src/Model/ApiAppResponseOwnerAccount.php +++ b/sdks/php/src/Model/ApiAppResponseOwnerAccount.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php index 1a7a2a313..95f29f5f4 100644 --- a/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php +++ b/sdks/php/src/Model/ApiAppResponseWhiteLabelingOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ApiAppUpdateRequest.php b/sdks/php/src/Model/ApiAppUpdateRequest.php index 49b018abe..456d143c2 100644 --- a/sdks/php/src/Model/ApiAppUpdateRequest.php +++ b/sdks/php/src/Model/ApiAppUpdateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/BulkSendJobGetResponse.php b/sdks/php/src/Model/BulkSendJobGetResponse.php index b8980437e..300bd887d 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponse.php +++ b/sdks/php/src/Model/BulkSendJobGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php index 90a73986a..3d30a8984 100644 --- a/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php +++ b/sdks/php/src/Model/BulkSendJobGetResponseSignatureRequests.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/BulkSendJobListResponse.php b/sdks/php/src/Model/BulkSendJobListResponse.php index ded0433c9..453f08e29 100644 --- a/sdks/php/src/Model/BulkSendJobListResponse.php +++ b/sdks/php/src/Model/BulkSendJobListResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/BulkSendJobResponse.php b/sdks/php/src/Model/BulkSendJobResponse.php index ac97f768c..fcd66e120 100644 --- a/sdks/php/src/Model/BulkSendJobResponse.php +++ b/sdks/php/src/Model/BulkSendJobResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/BulkSendJobSendResponse.php b/sdks/php/src/Model/BulkSendJobSendResponse.php index 6fb19e166..e8642fadf 100644 --- a/sdks/php/src/Model/BulkSendJobSendResponse.php +++ b/sdks/php/src/Model/BulkSendJobSendResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EmbeddedEditUrlRequest.php b/sdks/php/src/Model/EmbeddedEditUrlRequest.php index dd7390180..b4992a4c8 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlRequest.php +++ b/sdks/php/src/Model/EmbeddedEditUrlRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponse.php b/sdks/php/src/Model/EmbeddedEditUrlResponse.php index 83fa0ef6c..71a6fe19c 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php index 7a48b3e2c..0ef35374f 100644 --- a/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedEditUrlResponseEmbedded.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponse.php b/sdks/php/src/Model/EmbeddedSignUrlResponse.php index 6c3d3ced2..75774541a 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponse.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php index 61fcc34a6..f8b6619ba 100644 --- a/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php +++ b/sdks/php/src/Model/EmbeddedSignUrlResponseEmbedded.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ErrorResponse.php b/sdks/php/src/Model/ErrorResponse.php index dc237734a..081ed78c0 100644 --- a/sdks/php/src/Model/ErrorResponse.php +++ b/sdks/php/src/Model/ErrorResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ErrorResponseError.php b/sdks/php/src/Model/ErrorResponseError.php index 5369be9e1..60981920d 100644 --- a/sdks/php/src/Model/ErrorResponseError.php +++ b/sdks/php/src/Model/ErrorResponseError.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EventCallbackRequest.php b/sdks/php/src/Model/EventCallbackRequest.php index 8ac782108..35c806b2d 100644 --- a/sdks/php/src/Model/EventCallbackRequest.php +++ b/sdks/php/src/Model/EventCallbackRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EventCallbackRequestEvent.php b/sdks/php/src/Model/EventCallbackRequestEvent.php index 98a139fe1..36d99c767 100644 --- a/sdks/php/src/Model/EventCallbackRequestEvent.php +++ b/sdks/php/src/Model/EventCallbackRequestEvent.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php index fa8fad9dd..c0d665c8c 100644 --- a/sdks/php/src/Model/EventCallbackRequestEventMetadata.php +++ b/sdks/php/src/Model/EventCallbackRequestEventMetadata.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineAddUserRequest.php b/sdks/php/src/Model/FaxLineAddUserRequest.php index d1f5b3f6e..b7e2c849a 100644 --- a/sdks/php/src/Model/FaxLineAddUserRequest.php +++ b/sdks/php/src/Model/FaxLineAddUserRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php index 111c20b6d..1b96f68c7 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetCountryEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php index e81d86818..8bfde8747 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetProvinceEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php b/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php index c02f07681..60822162d 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php b/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php index ed3e29355..db4f35fd0 100644 --- a/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php +++ b/sdks/php/src/Model/FaxLineAreaCodeGetStateEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineCreateRequest.php b/sdks/php/src/Model/FaxLineCreateRequest.php index 3463881c7..a898fef9d 100644 --- a/sdks/php/src/Model/FaxLineCreateRequest.php +++ b/sdks/php/src/Model/FaxLineCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineDeleteRequest.php b/sdks/php/src/Model/FaxLineDeleteRequest.php index 2df4e4325..1fc4fa4a6 100644 --- a/sdks/php/src/Model/FaxLineDeleteRequest.php +++ b/sdks/php/src/Model/FaxLineDeleteRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineListResponse.php b/sdks/php/src/Model/FaxLineListResponse.php index 855c2c1e4..8142c27ff 100644 --- a/sdks/php/src/Model/FaxLineListResponse.php +++ b/sdks/php/src/Model/FaxLineListResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineRemoveUserRequest.php b/sdks/php/src/Model/FaxLineRemoveUserRequest.php index b876f78c4..5bec49060 100644 --- a/sdks/php/src/Model/FaxLineRemoveUserRequest.php +++ b/sdks/php/src/Model/FaxLineRemoveUserRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineResponse.php b/sdks/php/src/Model/FaxLineResponse.php index 5d0875cc5..d9b058a14 100644 --- a/sdks/php/src/Model/FaxLineResponse.php +++ b/sdks/php/src/Model/FaxLineResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FaxLineResponseFaxLine.php b/sdks/php/src/Model/FaxLineResponseFaxLine.php index 3a34a3a9a..4a3fe8fa7 100644 --- a/sdks/php/src/Model/FaxLineResponseFaxLine.php +++ b/sdks/php/src/Model/FaxLineResponseFaxLine.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FileResponse.php b/sdks/php/src/Model/FileResponse.php index 5ca196ad5..8476fad5b 100644 --- a/sdks/php/src/Model/FileResponse.php +++ b/sdks/php/src/Model/FileResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/FileResponseDataUri.php b/sdks/php/src/Model/FileResponseDataUri.php index bec55727c..9c028c39f 100644 --- a/sdks/php/src/Model/FileResponseDataUri.php +++ b/sdks/php/src/Model/FileResponseDataUri.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ListInfoResponse.php b/sdks/php/src/Model/ListInfoResponse.php index e4450d9b8..623284e41 100644 --- a/sdks/php/src/Model/ListInfoResponse.php +++ b/sdks/php/src/Model/ListInfoResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ModelInterface.php b/sdks/php/src/Model/ModelInterface.php index 493a0acf7..0bc2f212e 100644 --- a/sdks/php/src/Model/ModelInterface.php +++ b/sdks/php/src/Model/ModelInterface.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/OAuthTokenGenerateRequest.php b/sdks/php/src/Model/OAuthTokenGenerateRequest.php index c86d81af5..38a0395d1 100644 --- a/sdks/php/src/Model/OAuthTokenGenerateRequest.php +++ b/sdks/php/src/Model/OAuthTokenGenerateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/OAuthTokenRefreshRequest.php b/sdks/php/src/Model/OAuthTokenRefreshRequest.php index 2bfc2b5c9..c4c7f93be 100644 --- a/sdks/php/src/Model/OAuthTokenRefreshRequest.php +++ b/sdks/php/src/Model/OAuthTokenRefreshRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/OAuthTokenResponse.php b/sdks/php/src/Model/OAuthTokenResponse.php index bfb18ab17..8c83de78e 100644 --- a/sdks/php/src/Model/OAuthTokenResponse.php +++ b/sdks/php/src/Model/OAuthTokenResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ReportCreateRequest.php b/sdks/php/src/Model/ReportCreateRequest.php index b85af6da5..58029634b 100644 --- a/sdks/php/src/Model/ReportCreateRequest.php +++ b/sdks/php/src/Model/ReportCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ReportCreateResponse.php b/sdks/php/src/Model/ReportCreateResponse.php index e94106e89..50384baf4 100644 --- a/sdks/php/src/Model/ReportCreateResponse.php +++ b/sdks/php/src/Model/ReportCreateResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/ReportResponse.php b/sdks/php/src/Model/ReportResponse.php index e55a2c6bb..c2d024ca1 100644 --- a/sdks/php/src/Model/ReportResponse.php +++ b/sdks/php/src/Model/ReportResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php index c3361f55e..9c5947fec 100644 --- a/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkCreateEmbeddedWithTemplateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php index 6562e291a..26092eb3f 100644 --- a/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestBulkSendWithTemplateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php index d425901a2..7d14b823c 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php index e0ddf3951..b98f7b8b7 100644 --- a/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestCreateEmbeddedWithTemplateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestGetResponse.php b/sdks/php/src/Model/SignatureRequestGetResponse.php index 4d23105d6..e3c2ea574 100644 --- a/sdks/php/src/Model/SignatureRequestGetResponse.php +++ b/sdks/php/src/Model/SignatureRequestGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestListResponse.php b/sdks/php/src/Model/SignatureRequestListResponse.php index dd6d7bf23..36a043891 100644 --- a/sdks/php/src/Model/SignatureRequestListResponse.php +++ b/sdks/php/src/Model/SignatureRequestListResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestRemindRequest.php b/sdks/php/src/Model/SignatureRequestRemindRequest.php index 98bd0b2ca..5662351ef 100644 --- a/sdks/php/src/Model/SignatureRequestRemindRequest.php +++ b/sdks/php/src/Model/SignatureRequestRemindRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponse.php b/sdks/php/src/Model/SignatureRequestResponse.php index 4b93915f2..14386d427 100644 --- a/sdks/php/src/Model/SignatureRequestResponse.php +++ b/sdks/php/src/Model/SignatureRequestResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseAttachment.php b/sdks/php/src/Model/SignatureRequestResponseAttachment.php index 38905a0ac..245930a52 100644 --- a/sdks/php/src/Model/SignatureRequestResponseAttachment.php +++ b/sdks/php/src/Model/SignatureRequestResponseAttachment.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php index e6a1a591d..7c1d3a815 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php index 6604e50a6..d16c804e7 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php index 25a9241c5..4115fc171 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php b/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php index 4205be23d..c9f4ea0a2 100644 --- a/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php +++ b/sdks/php/src/Model/SignatureRequestResponseCustomFieldTypeEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataBase.php b/sdks/php/src/Model/SignatureRequestResponseDataBase.php index dc7148806..5f473fe7f 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataBase.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php b/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php index d2e30d5f4..fd4b6e268 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataTypeEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php index 709c91641..c64a1fbc7 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php index 6198d1a69..96ac1dd3e 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueCheckboxMerge.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php index a58276347..78c8794e0 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDateSigned.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php index ad38b0223..4171a5860 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueDropdown.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php index 91d4910a6..30ab1f375 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueInitials.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php index 22132dfb4..0c05b0bc9 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueRadio.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php index 66f78c0f1..458a052a7 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueSignature.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php index 875e60509..f4ddd0ff3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueText.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php index 10b88fddc..ef64d4b8e 100644 --- a/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php +++ b/sdks/php/src/Model/SignatureRequestResponseDataValueTextMerge.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestResponseSignatures.php b/sdks/php/src/Model/SignatureRequestResponseSignatures.php index 8adf50aa3..081ebb6d3 100644 --- a/sdks/php/src/Model/SignatureRequestResponseSignatures.php +++ b/sdks/php/src/Model/SignatureRequestResponseSignatures.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestSendRequest.php b/sdks/php/src/Model/SignatureRequestSendRequest.php index ea778e1a9..600ee133e 100644 --- a/sdks/php/src/Model/SignatureRequestSendRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php index 2ae0e131e..c58096632 100644 --- a/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php +++ b/sdks/php/src/Model/SignatureRequestSendWithTemplateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SignatureRequestUpdateRequest.php b/sdks/php/src/Model/SignatureRequestUpdateRequest.php index c2949d267..2a4a33dcf 100644 --- a/sdks/php/src/Model/SignatureRequestUpdateRequest.php +++ b/sdks/php/src/Model/SignatureRequestUpdateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubAttachment.php b/sdks/php/src/Model/SubAttachment.php index 2c83fb29b..d41f3459c 100644 --- a/sdks/php/src/Model/SubAttachment.php +++ b/sdks/php/src/Model/SubAttachment.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubBulkSignerList.php b/sdks/php/src/Model/SubBulkSignerList.php index 077ad47e2..d9702bb7d 100644 --- a/sdks/php/src/Model/SubBulkSignerList.php +++ b/sdks/php/src/Model/SubBulkSignerList.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubBulkSignerListCustomField.php b/sdks/php/src/Model/SubBulkSignerListCustomField.php index 0bae39d8f..17f67ac95 100644 --- a/sdks/php/src/Model/SubBulkSignerListCustomField.php +++ b/sdks/php/src/Model/SubBulkSignerListCustomField.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubCC.php b/sdks/php/src/Model/SubCC.php index 815b3c8b8..0380a3889 100644 --- a/sdks/php/src/Model/SubCC.php +++ b/sdks/php/src/Model/SubCC.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubCustomField.php b/sdks/php/src/Model/SubCustomField.php index 700759829..e853f9eb1 100644 --- a/sdks/php/src/Model/SubCustomField.php +++ b/sdks/php/src/Model/SubCustomField.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubEditorOptions.php b/sdks/php/src/Model/SubEditorOptions.php index 2f13e3a69..cd15d5965 100644 --- a/sdks/php/src/Model/SubEditorOptions.php +++ b/sdks/php/src/Model/SubEditorOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFieldOptions.php b/sdks/php/src/Model/SubFieldOptions.php index 0c5ae402f..974daa4a9 100644 --- a/sdks/php/src/Model/SubFieldOptions.php +++ b/sdks/php/src/Model/SubFieldOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldGroup.php b/sdks/php/src/Model/SubFormFieldGroup.php index 0908ddc29..2ff53e101 100644 --- a/sdks/php/src/Model/SubFormFieldGroup.php +++ b/sdks/php/src/Model/SubFormFieldGroup.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldRule.php b/sdks/php/src/Model/SubFormFieldRule.php index ff307d183..094d8217c 100644 --- a/sdks/php/src/Model/SubFormFieldRule.php +++ b/sdks/php/src/Model/SubFormFieldRule.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldRuleAction.php b/sdks/php/src/Model/SubFormFieldRuleAction.php index b7fc62de8..458b5822f 100644 --- a/sdks/php/src/Model/SubFormFieldRuleAction.php +++ b/sdks/php/src/Model/SubFormFieldRuleAction.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldRuleTrigger.php b/sdks/php/src/Model/SubFormFieldRuleTrigger.php index 2b0423131..0ab5768e0 100644 --- a/sdks/php/src/Model/SubFormFieldRuleTrigger.php +++ b/sdks/php/src/Model/SubFormFieldRuleTrigger.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php index 188d08c9e..68158bf5a 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php index 05be82299..c023916c7 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php index 95fd01315..c3924079b 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentCheckboxMerge.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php index fb0cd9657..5902025ad 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDateSigned.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php index 2c45c24c1..121c3eb48 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentDropdown.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php b/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php index 1296e1456..bc0eff196 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentFontEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php index cdbc7f56f..924429f26 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentHyperlink.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php index ba8959d13..cfddb0495 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentInitials.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php index 6c1fb48cb..b506baa56 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentRadio.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php index 80b901554..37c6e7a15 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentSignature.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php index 423225d55..fa048a12b 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentText.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php index 286d979b2..bfe22420e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentTextMerge.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php b/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php index d2e45310e..4a4294f5e 100644 --- a/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php +++ b/sdks/php/src/Model/SubFormFieldsPerDocumentTypeEnum.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubMergeField.php b/sdks/php/src/Model/SubMergeField.php index c558a42de..8631a07e4 100644 --- a/sdks/php/src/Model/SubMergeField.php +++ b/sdks/php/src/Model/SubMergeField.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubOAuth.php b/sdks/php/src/Model/SubOAuth.php index fdc6c455f..2bbf85547 100644 --- a/sdks/php/src/Model/SubOAuth.php +++ b/sdks/php/src/Model/SubOAuth.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubOptions.php b/sdks/php/src/Model/SubOptions.php index 287cf8583..b86fa5b7f 100644 --- a/sdks/php/src/Model/SubOptions.php +++ b/sdks/php/src/Model/SubOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php index 459c1265d..2d15bc241 100644 --- a/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php +++ b/sdks/php/src/Model/SubSignatureRequestGroupedSigners.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubSignatureRequestSigner.php b/sdks/php/src/Model/SubSignatureRequestSigner.php index b9669b176..64133e165 100644 --- a/sdks/php/src/Model/SubSignatureRequestSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestSigner.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php index 59e219bc6..15070e31f 100644 --- a/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php +++ b/sdks/php/src/Model/SubSignatureRequestTemplateSigner.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubSigningOptions.php b/sdks/php/src/Model/SubSigningOptions.php index 794711f70..8cbaff0f0 100644 --- a/sdks/php/src/Model/SubSigningOptions.php +++ b/sdks/php/src/Model/SubSigningOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubTeamResponse.php b/sdks/php/src/Model/SubTeamResponse.php index a148754d5..60ecc442a 100644 --- a/sdks/php/src/Model/SubTeamResponse.php +++ b/sdks/php/src/Model/SubTeamResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubTemplateRole.php b/sdks/php/src/Model/SubTemplateRole.php index 8d7e101b9..2678da93a 100644 --- a/sdks/php/src/Model/SubTemplateRole.php +++ b/sdks/php/src/Model/SubTemplateRole.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubUnclaimedDraftSigner.php b/sdks/php/src/Model/SubUnclaimedDraftSigner.php index bf5480977..acc466356 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftSigner.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php index 88f7bccad..9daffb1e4 100644 --- a/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php +++ b/sdks/php/src/Model/SubUnclaimedDraftTemplateSigner.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/SubWhiteLabelingOptions.php b/sdks/php/src/Model/SubWhiteLabelingOptions.php index 99c4d59af..4f16b4928 100644 --- a/sdks/php/src/Model/SubWhiteLabelingOptions.php +++ b/sdks/php/src/Model/SubWhiteLabelingOptions.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamAddMemberRequest.php b/sdks/php/src/Model/TeamAddMemberRequest.php index 4da7c73dc..e38abb02f 100644 --- a/sdks/php/src/Model/TeamAddMemberRequest.php +++ b/sdks/php/src/Model/TeamAddMemberRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamCreateRequest.php b/sdks/php/src/Model/TeamCreateRequest.php index 04c2da1f9..6ba37cc71 100644 --- a/sdks/php/src/Model/TeamCreateRequest.php +++ b/sdks/php/src/Model/TeamCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamGetInfoResponse.php b/sdks/php/src/Model/TeamGetInfoResponse.php index fda26c9d9..6680e9e9c 100644 --- a/sdks/php/src/Model/TeamGetInfoResponse.php +++ b/sdks/php/src/Model/TeamGetInfoResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamGetResponse.php b/sdks/php/src/Model/TeamGetResponse.php index 93fdb09c6..c26030e3e 100644 --- a/sdks/php/src/Model/TeamGetResponse.php +++ b/sdks/php/src/Model/TeamGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamInfoResponse.php b/sdks/php/src/Model/TeamInfoResponse.php index d2d6be014..3d5ad124a 100644 --- a/sdks/php/src/Model/TeamInfoResponse.php +++ b/sdks/php/src/Model/TeamInfoResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamInviteResponse.php b/sdks/php/src/Model/TeamInviteResponse.php index ce2a2f94e..d37dae050 100644 --- a/sdks/php/src/Model/TeamInviteResponse.php +++ b/sdks/php/src/Model/TeamInviteResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamInvitesResponse.php b/sdks/php/src/Model/TeamInvitesResponse.php index ff6978705..c11a3f327 100644 --- a/sdks/php/src/Model/TeamInvitesResponse.php +++ b/sdks/php/src/Model/TeamInvitesResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamMemberResponse.php b/sdks/php/src/Model/TeamMemberResponse.php index 54881ccac..ee61fbdd3 100644 --- a/sdks/php/src/Model/TeamMemberResponse.php +++ b/sdks/php/src/Model/TeamMemberResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamMembersResponse.php b/sdks/php/src/Model/TeamMembersResponse.php index 0d58fe4ee..b3ac18575 100644 --- a/sdks/php/src/Model/TeamMembersResponse.php +++ b/sdks/php/src/Model/TeamMembersResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamParentResponse.php b/sdks/php/src/Model/TeamParentResponse.php index cd6065d87..d0d447285 100644 --- a/sdks/php/src/Model/TeamParentResponse.php +++ b/sdks/php/src/Model/TeamParentResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamRemoveMemberRequest.php b/sdks/php/src/Model/TeamRemoveMemberRequest.php index 1487c285a..6d7413255 100644 --- a/sdks/php/src/Model/TeamRemoveMemberRequest.php +++ b/sdks/php/src/Model/TeamRemoveMemberRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamResponse.php b/sdks/php/src/Model/TeamResponse.php index 8786ec19e..402916a49 100644 --- a/sdks/php/src/Model/TeamResponse.php +++ b/sdks/php/src/Model/TeamResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamSubTeamsResponse.php b/sdks/php/src/Model/TeamSubTeamsResponse.php index a819daf4b..a1695e6a6 100644 --- a/sdks/php/src/Model/TeamSubTeamsResponse.php +++ b/sdks/php/src/Model/TeamSubTeamsResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TeamUpdateRequest.php b/sdks/php/src/Model/TeamUpdateRequest.php index 5b95c140b..6606b7676 100644 --- a/sdks/php/src/Model/TeamUpdateRequest.php +++ b/sdks/php/src/Model/TeamUpdateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateAddUserRequest.php b/sdks/php/src/Model/TemplateAddUserRequest.php index 177278524..ea87103ad 100644 --- a/sdks/php/src/Model/TemplateAddUserRequest.php +++ b/sdks/php/src/Model/TemplateAddUserRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php index 8ef1c9040..fe626a83a 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php index 83188f99a..6ac000d9f 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php index dc954905b..44031ce16 100644 --- a/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateEmbeddedDraftResponseTemplate.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateRequest.php b/sdks/php/src/Model/TemplateCreateRequest.php index 1bcea792f..ec6890622 100644 --- a/sdks/php/src/Model/TemplateCreateRequest.php +++ b/sdks/php/src/Model/TemplateCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateResponse.php b/sdks/php/src/Model/TemplateCreateResponse.php index d71c6f5bd..cd1be57e4 100644 --- a/sdks/php/src/Model/TemplateCreateResponse.php +++ b/sdks/php/src/Model/TemplateCreateResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateCreateResponseTemplate.php b/sdks/php/src/Model/TemplateCreateResponseTemplate.php index 87668708d..199aa3f74 100644 --- a/sdks/php/src/Model/TemplateCreateResponseTemplate.php +++ b/sdks/php/src/Model/TemplateCreateResponseTemplate.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateEditResponse.php b/sdks/php/src/Model/TemplateEditResponse.php index a4581fcea..5a888bfb2 100644 --- a/sdks/php/src/Model/TemplateEditResponse.php +++ b/sdks/php/src/Model/TemplateEditResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateGetResponse.php b/sdks/php/src/Model/TemplateGetResponse.php index 4e8648c6b..c2a087334 100644 --- a/sdks/php/src/Model/TemplateGetResponse.php +++ b/sdks/php/src/Model/TemplateGetResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateListResponse.php b/sdks/php/src/Model/TemplateListResponse.php index 5f7d1227f..45a2fe1a4 100644 --- a/sdks/php/src/Model/TemplateListResponse.php +++ b/sdks/php/src/Model/TemplateListResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateRemoveUserRequest.php b/sdks/php/src/Model/TemplateRemoveUserRequest.php index b743a937e..d7a8582f9 100644 --- a/sdks/php/src/Model/TemplateRemoveUserRequest.php +++ b/sdks/php/src/Model/TemplateRemoveUserRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponse.php b/sdks/php/src/Model/TemplateResponse.php index 97cfad906..4041f1856 100644 --- a/sdks/php/src/Model/TemplateResponse.php +++ b/sdks/php/src/Model/TemplateResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseAccount.php b/sdks/php/src/Model/TemplateResponseAccount.php index 76b0ed512..47ddefabe 100644 --- a/sdks/php/src/Model/TemplateResponseAccount.php +++ b/sdks/php/src/Model/TemplateResponseAccount.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseAccountQuota.php b/sdks/php/src/Model/TemplateResponseAccountQuota.php index a8ab59d42..46386d6ec 100644 --- a/sdks/php/src/Model/TemplateResponseAccountQuota.php +++ b/sdks/php/src/Model/TemplateResponseAccountQuota.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseCCRole.php b/sdks/php/src/Model/TemplateResponseCCRole.php index 72d1972ce..06ee33219 100644 --- a/sdks/php/src/Model/TemplateResponseCCRole.php +++ b/sdks/php/src/Model/TemplateResponseCCRole.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocument.php b/sdks/php/src/Model/TemplateResponseDocument.php index 36399a6c3..5377d4ba9 100644 --- a/sdks/php/src/Model/TemplateResponseDocument.php +++ b/sdks/php/src/Model/TemplateResponseDocument.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php index 8603877ad..011502522 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php index 2f28fd529..7ec8dc018 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php index dabdff75d..e63a73978 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentCustomFieldText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php index 3b4cc2cb6..541714841 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroup.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php index 5b17831da..1bd31bde9 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFieldGroupRule.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php index bf0347fba..33cc52c58 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php index 73f1c5702..bd03254c4 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php index c510920d8..158d8159c 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDateSigned.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php index 0a7f9a0e4..057b5d84d 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldDropdown.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php index 0010b6d31..81ffda0ce 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldHyperlink.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php index 4abd8d1f3..976a27fba 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldInitials.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php index 194b7fc4c..bd0d28e85 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldRadio.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php index 3e71160d4..9effb72b7 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldSignature.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php index 3456e9629..0684e1d67 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentFormFieldText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php index 8ed3e1084..bd18e1847 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldBase.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php index 7313a48b6..9739d2e05 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldCheckbox.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php index 33425da25..911febf8d 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDateSigned.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php index ff490a0f2..6022f9289 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldDropdown.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php index 5b87dab16..246bea450 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldHyperlink.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php index 198f8b8fe..339b3a2a5 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldInitials.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php index 197758d3f..8dc139712 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldRadio.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php index adaba8500..c86d1c9a3 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldSignature.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php index 00344871b..ec89541e3 100644 --- a/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php +++ b/sdks/php/src/Model/TemplateResponseDocumentStaticFieldText.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php index b045fbca3..9277db26a 100644 --- a/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php +++ b/sdks/php/src/Model/TemplateResponseFieldAvgTextLength.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateResponseSignerRole.php b/sdks/php/src/Model/TemplateResponseSignerRole.php index 624ee537d..98a80c6e0 100644 --- a/sdks/php/src/Model/TemplateResponseSignerRole.php +++ b/sdks/php/src/Model/TemplateResponseSignerRole.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateUpdateFilesRequest.php b/sdks/php/src/Model/TemplateUpdateFilesRequest.php index b2cd0e019..7c165ff7d 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesRequest.php +++ b/sdks/php/src/Model/TemplateUpdateFilesRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponse.php b/sdks/php/src/Model/TemplateUpdateFilesResponse.php index 9ecd376a6..c2a78f087 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponse.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php index f04835421..70d2e87dc 100644 --- a/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php +++ b/sdks/php/src/Model/TemplateUpdateFilesResponseTemplate.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php index efaa111ac..8d4a7e3e2 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php index e502d966c..df0b1df69 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateEmbeddedWithTemplateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php index ffa90ca39..1d55c2c1b 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php index 6f5df04cf..fa8831416 100644 --- a/sdks/php/src/Model/UnclaimedDraftCreateResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftCreateResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php index 441229f0d..5669e4848 100644 --- a/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php +++ b/sdks/php/src/Model/UnclaimedDraftEditAndResendRequest.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/UnclaimedDraftResponse.php b/sdks/php/src/Model/UnclaimedDraftResponse.php index 66869e5cf..da1c26359 100644 --- a/sdks/php/src/Model/UnclaimedDraftResponse.php +++ b/sdks/php/src/Model/UnclaimedDraftResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/Model/WarningResponse.php b/sdks/php/src/Model/WarningResponse.php index 51acff4f4..4c37010a0 100644 --- a/sdks/php/src/Model/WarningResponse.php +++ b/sdks/php/src/Model/WarningResponse.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** diff --git a/sdks/php/src/ObjectSerializer.php b/sdks/php/src/ObjectSerializer.php index 4642f9c92..48492d944 100644 --- a/sdks/php/src/ObjectSerializer.php +++ b/sdks/php/src/ObjectSerializer.php @@ -16,7 +16,7 @@ * The version of the OpenAPI document: 3.0.0 * Contact: apisupport@hellosign.com * Generated by: https://openapi-generator.tech - * Generator version: 7.7.0 + * Generator version: 7.8.0 */ /** @@ -266,6 +266,11 @@ public static function toQueryValue( $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -511,7 +516,6 @@ public static function deserialize($data, string $class, array $httpHeaders = nu // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; - $discriminatorValue = null; if (is_object($data)) { $discriminatorValue = $data->{$discriminator} ?? null; diff --git a/sdks/php/templates/ApiException.mustache b/sdks/php/templates/ApiException.mustache index a21690240..944d3c8a6 100644 --- a/sdks/php/templates/ApiException.mustache +++ b/sdks/php/templates/ApiException.mustache @@ -40,7 +40,7 @@ class ApiException extends Exception /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -61,7 +61,7 @@ class ApiException extends Exception * * @param string $message Error message * @param int $code HTTP status code - * @param string[]|null $responseHeaders HTTP response header + * @param string[][]|null $responseHeaders HTTP response header * @param \stdClass|string|null $responseBody HTTP decoded body of the server response either as \stdClass or string */ public function __construct($message = "", $code = 0, $responseHeaders = [], $responseBody = null) @@ -74,7 +74,7 @@ class ApiException extends Exception /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index e0a00c7c1..3e660b858 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -283,6 +283,11 @@ class ObjectSerializer $value = $flattenArray($value, $paramName); + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { return $value; } @@ -500,7 +505,7 @@ class ObjectSerializer // determine file name if ( is_array($httpHeaders) - && array_key_exists('Content-Disposition', $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]); @@ -539,7 +544,6 @@ class ObjectSerializer // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; - {{#useCustomTemplateCode}} $discriminatorValue = null; if (is_object($data)) { @@ -559,8 +563,8 @@ class ObjectSerializer {{/useCustomTemplateCode}} } } - {{#useCustomTemplateCode}} + if ( !$discrimnatorSubclassFound && !empty($discriminator) @@ -667,8 +671,8 @@ class ObjectSerializer return $qs ? (string) substr($qs, 0, -1) : ''; } - {{#useCustomTemplateCode}} + /** * Allows a multipart/form-data request to grab data from the typed * class created by OpenAPI. diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 7f2f65518..3a1db5608 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -76,8 +76,8 @@ use Psr\Http\Message\ResponseInterface; {{#useCustomTemplateCode}} /** @var ResponseInterface|null */ protected $response; -{{/useCustomTemplateCode}} +{{/useCustomTemplateCode}} {{^useCustomTemplateCode}} /** * @param ClientInterface $client diff --git a/sdks/php/templates/composer.mustache b/sdks/php/templates/composer.mustache index 08469c70c..85807e08c 100644 --- a/sdks/php/templates/composer.mustache +++ b/sdks/php/templates/composer.mustache @@ -15,8 +15,11 @@ "php", "sdk", "rest", - "api", +{{^useCustomTemplateCode}} + "api" +{{/useCustomTemplateCode}} {{#useCustomTemplateCode}} + "api", "hellosign", "dropboxsign" {{/useCustomTemplateCode}} @@ -26,8 +29,11 @@ "authors": [ { "name": "{{{developerOrganization}}}", - "homepage": "{{{developerOrganizationUrl}}}", +{{^useCustomTemplateCode}} + "homepage": "{{{developerOrganizationUrl}}}" +{{/useCustomTemplateCode}} {{#useCustomTemplateCode}} + "homepage": "{{{developerOrganizationUrl}}}", "email": "{{{developerOrganizationEmail}}}" {{/useCustomTemplateCode}} } @@ -42,8 +48,11 @@ }, "require-dev": { "phpunit/phpunit": "^8.0 || ^9.0", - "friendsofphp/php-cs-fixer": "^3.5", +{{^useCustomTemplateCode}} + "friendsofphp/php-cs-fixer": "^3.5" +{{/useCustomTemplateCode}} {{#useCustomTemplateCode}} + "friendsofphp/php-cs-fixer": "^3.5", "symfony/yaml": "^5.4" {{/useCustomTemplateCode}} }, diff --git a/sdks/php/templates/libraries/psr-18/ApiException.mustache b/sdks/php/templates/libraries/psr-18/ApiException.mustache index c8a3b935b..336d8f7c5 100644 --- a/sdks/php/templates/libraries/psr-18/ApiException.mustache +++ b/sdks/php/templates/libraries/psr-18/ApiException.mustache @@ -44,7 +44,7 @@ class ApiException extends RequestException /** * The HTTP header of the server response. * - * @var string[]|null + * @var string[][]|null */ protected $responseHeaders; @@ -72,7 +72,7 @@ class ApiException extends RequestException /** * Gets the HTTP response header * - * @return string[]|null HTTP response header + * @return string[][]|null HTTP response header */ public function getResponseHeaders() { From 44c7f3a55c7a9877f74daa86f146b3ea2eaef151 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 30 Aug 2024 11:18:51 -0500 Subject: [PATCH 13/19] ObjectSerializer::deserialize() should respect keys --- sdks/php/phpunit.xml.dist | 3 +- sdks/php/src/ObjectSerializer.php | 2 +- sdks/php/templates/ObjectSerializer.mustache | 5 ++ sdks/php/templates/phpunit.xml.mustache | 5 ++ sdks/php/test/ObjectSerializerTest.php | 49 ++++++++++++++++++++ 5 files changed, 61 insertions(+), 3 deletions(-) diff --git a/sdks/php/phpunit.xml.dist b/sdks/php/phpunit.xml.dist index b04c85f79..d53f74070 100644 --- a/sdks/php/phpunit.xml.dist +++ b/sdks/php/phpunit.xml.dist @@ -8,8 +8,7 @@ - ./test/Api - ./test/Model + ./test diff --git a/sdks/php/src/ObjectSerializer.php b/sdks/php/src/ObjectSerializer.php index 48492d944..3f1eddc39 100644 --- a/sdks/php/src/ObjectSerializer.php +++ b/sdks/php/src/ObjectSerializer.php @@ -420,7 +420,7 @@ public static function deserialize($data, string $class, array $httpHeaders = nu $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); + $values[$key] = self::deserialize($value, $subClass, null); } return $values; } diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index 3e660b858..00a16326c 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -448,7 +448,12 @@ class ObjectSerializer $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { +{{^useCustomTemplateCode}} $values[] = self::deserialize($value, $subClass, null); +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + $values[$key] = self::deserialize($value, $subClass, null); +{{/useCustomTemplateCode}} } return $values; } diff --git a/sdks/php/templates/phpunit.xml.mustache b/sdks/php/templates/phpunit.xml.mustache index 735a746ca..7f1126c45 100644 --- a/sdks/php/templates/phpunit.xml.mustache +++ b/sdks/php/templates/phpunit.xml.mustache @@ -8,8 +8,13 @@ +{{^useCustomTemplateCode}} {{apiTestPath}} {{modelTestPath}} +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + ./test +{{/useCustomTemplateCode}} diff --git a/sdks/php/test/ObjectSerializerTest.php b/sdks/php/test/ObjectSerializerTest.php index 2b27a769e..fbe788d8f 100644 --- a/sdks/php/test/ObjectSerializerTest.php +++ b/sdks/php/test/ObjectSerializerTest.php @@ -122,4 +122,53 @@ public function testValuesJsonified() $this->assertEquals($expectedOauth, $result['oauth']); } + + public function testExplicitIndexKeysAreKeptForNestedValues(): void + { + $data = [ + 'type' => 'request_signature', + 'subject' => 'unclaimed draft that should work', + 'message' => 'indeed', + 'metadata' => null, + 'test_mode' => false, + 'signers' => [ + '1' => [ + 'order' => 1, + 'email_address' => 'john@example.com', + 'name' => 'John Q Public', + ], + ], + 'form_fields_per_document' => [ + [ + 'document_index' => 0, + 'name' => null, + 'type' => 'signature', + 'x' => 530, + 'y' => 415, + 'width' => 120, + 'height' => 30, + 'required' => true, + 'signer' => 1, + ], + ], + 'client_id' => '1df877123c9b64884c86530a1c1d309d', + 'requester_email_address' => 'test-1725033846-d0e693477a@example.com', + ]; + + $obj = Model\UnclaimedDraftCreateEmbeddedRequest::init($data); + + $expected_signer_key = '1'; + $this->assertArrayHasKey($expected_signer_key, $obj->getSigners()); + $this->assertEquals( + $data['signers'][$expected_signer_key]['email_address'], + $obj->getSigners()[$expected_signer_key]->getEmailAddress(), + ); + + $expected_ffpd_key = 0; + $this->assertArrayHasKey($expected_ffpd_key, $obj->getFormFieldsPerDocument()); + $this->assertEquals( + $data['form_fields_per_document'][$expected_ffpd_key]['type'], + $obj->getFormFieldsPerDocument()[$expected_ffpd_key]->getType(), + ); + } } From 7a639bbbe2b9326fffaa5f5c7601bf42b1bda376 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 30 Aug 2024 12:45:09 -0500 Subject: [PATCH 14/19] Add test on SplFileObject passed to ::init() --- sdks/php/src/ObjectSerializer.php | 4 ++++ sdks/php/templates/ObjectSerializer.mustache | 6 ++++++ sdks/php/test/ObjectSerializerTest.php | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/sdks/php/src/ObjectSerializer.php b/sdks/php/src/ObjectSerializer.php index 3f1eddc39..958cd8e04 100644 --- a/sdks/php/src/ObjectSerializer.php +++ b/sdks/php/src/ObjectSerializer.php @@ -471,6 +471,10 @@ public static function deserialize($data, string $class, array $httpHeaders = nu } if ($class === '\SplFileObject') { + if (is_a($data, SplFileObject::class)) { + return $data; + } + $data = Utils::streamFor($data); /** @var \Psr\Http\Message\StreamInterface $data */ diff --git a/sdks/php/templates/ObjectSerializer.mustache b/sdks/php/templates/ObjectSerializer.mustache index 00a16326c..281ed61db 100644 --- a/sdks/php/templates/ObjectSerializer.mustache +++ b/sdks/php/templates/ObjectSerializer.mustache @@ -503,6 +503,12 @@ class ObjectSerializer } if ($class === '\SplFileObject') { +{{#useCustomTemplateCode}} + if (is_a($data, \SplFileObject::class)) { + return $data; + } + +{{/useCustomTemplateCode}} $data = Utils::streamFor($data); /** @var \Psr\Http\Message\StreamInterface $data */ diff --git a/sdks/php/test/ObjectSerializerTest.php b/sdks/php/test/ObjectSerializerTest.php index fbe788d8f..3f548863d 100644 --- a/sdks/php/test/ObjectSerializerTest.php +++ b/sdks/php/test/ObjectSerializerTest.php @@ -171,4 +171,24 @@ public function testExplicitIndexKeysAreKeptForNestedValues(): void $obj->getFormFieldsPerDocument()[$expected_ffpd_key]->getType(), ); } + + public function testSplFileObjectUntouched(): void + { + $requestClass = Model\SignatureRequestSendRequest::class; + $requestData = TestUtils::getFixtureData($requestClass)['default']; + unset($requestData['file_urls']); + + $filename = 'pdf-sample.pdf'; + $filepath = self::ROOT_FILE_PATH . "/{$filename}"; + + $requestData['files'] = [new SplFileObject($filepath)]; + + $obj = Model\SignatureRequestSendRequest::init($requestData); + + $file = $obj->getFiles()[0]; + + $this->assertInstanceOf(SplFileObject::class, $file); + $this->assertEquals($filename, $file->getFilename()); + $this->assertEquals($filepath, $file->getPathname()); + } } From 06c2deed9de879e7db2b761d67d1caf1612ed74a Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 30 Aug 2024 14:39:29 -0500 Subject: [PATCH 15/19] Adds initial integration tests --- sandbox/.gitignore | 4 +- sandbox/php/composer.json | 8 +- ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++ .../fixtures/SignatureRequestSendRequest.json | 163 ++++++++++++++++ sandbox/php/{ => fixtures}/pdf-sample.pdf | Bin sandbox/php/test/.env.dist | 4 + sandbox/php/test/.gitignore | 1 + sandbox/php/test/SignatureRequestTest.php | 179 ++++++++++++++++++ sdks/php/src/Api/AccountApi.php | 2 +- sdks/php/src/Api/ApiAppApi.php | 2 +- sdks/php/src/Api/BulkSendJobApi.php | 2 +- sdks/php/src/Api/EmbeddedApi.php | 2 +- sdks/php/src/Api/FaxLineApi.php | 2 +- sdks/php/src/Api/OAuthApi.php | 2 +- sdks/php/src/Api/ReportApi.php | 2 +- sdks/php/src/Api/SignatureRequestApi.php | 2 +- sdks/php/src/Api/TeamApi.php | 2 +- sdks/php/src/Api/TemplateApi.php | 2 +- sdks/php/src/Api/UnclaimedDraftApi.php | 2 +- sdks/php/templates/api.mustache | 5 + 20 files changed, 535 insertions(+), 14 deletions(-) create mode 100644 sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/php/fixtures/SignatureRequestSendRequest.json rename sandbox/php/{ => fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/php/test/.env.dist create mode 100644 sandbox/php/test/.gitignore create mode 100644 sandbox/php/test/SignatureRequestTest.php diff --git a/sandbox/.gitignore b/sandbox/.gitignore index 610051b88..0082a956e 100644 --- a/sandbox/.gitignore +++ b/sandbox/.gitignore @@ -21,8 +21,10 @@ node/* !node/package.json php/* -!php/Example.php !php/composer.json +!php/Example.php +!php/fixtures +!php/test python/* !python/Example.py diff --git a/sandbox/php/composer.json b/sandbox/php/composer.json index 0bbf9e28e..ab722a292 100644 --- a/sandbox/php/composer.json +++ b/sandbox/php/composer.json @@ -2,11 +2,15 @@ "name": "dropbox/sign-sandbox", "autoload": { "psr-4": { - "Dropbox\\Sign\\Sandbox\\": "src/" + "Dropbox\\SignSandbox\\Tests\\": "test" } }, "require": { - "dropbox/sign": "*" + "dropbox/sign": "*", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "^8.0 || ^9.0" }, "repositories": [ { diff --git a/sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/php/fixtures/SignatureRequestSendRequest.json b/sandbox/php/fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/php/fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/php/pdf-sample.pdf b/sandbox/php/fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/php/pdf-sample.pdf rename to sandbox/php/fixtures/pdf-sample.pdf diff --git a/sandbox/php/test/.env.dist b/sandbox/php/test/.env.dist new file mode 100644 index 000000000..3a1aa7762 --- /dev/null +++ b/sandbox/php/test/.env.dist @@ -0,0 +1,4 @@ +BASE_URL="https://api.hellosign.com/v3" +API_KEY="YOUR_API_KEY_HERE" +CLIENT_ID="YOUR_CLIENT_ID_HERE" +USE_XDEBUG=0 diff --git a/sandbox/php/test/.gitignore b/sandbox/php/test/.gitignore new file mode 100644 index 000000000..4c49bd78f --- /dev/null +++ b/sandbox/php/test/.gitignore @@ -0,0 +1 @@ +.env diff --git a/sandbox/php/test/SignatureRequestTest.php b/sandbox/php/test/SignatureRequestTest.php new file mode 100644 index 000000000..745cc19d4 --- /dev/null +++ b/sandbox/php/test/SignatureRequestTest.php @@ -0,0 +1,179 @@ +client_id = $env_merged['CLIENT_ID']; + + $this->config = new Sign\Configuration(); + $this->config->setUsername($env_merged['API_KEY']); + $this->config->setHost($env_merged['BASE_URL']); + + if ($env_merged['USE_XDEBUG']) { + $cookies = CookieJar::fromArray( + ['XDEBUG_SESSION' => 'xdebug'], + parse_url($env_merged['BASE_URL'], PHP_URL_HOST), + ); + + $this->config->setOptions(['cookies' => $cookies]); + } + } + + public function testSend(): void + { + $signature_request_api = new Sign\Api\SignatureRequestApi($this->config); + + $data = json_decode( + file_get_contents(self::FIXTURES_DIR . '/SignatureRequestSendRequest.json'), + true, + ); + $file = new SplFileObject(self::FIXTURES_DIR . '/pdf-sample.pdf'); + $data['files'] = [$file]; + + $request = Sign\Model\SignatureRequestSendRequest::init($data); + + try { + $response = $signature_request_api->signatureRequestSend($request); + } catch (Sign\ApiException $e) { + $this->fail( + 'Should not have thrown: ' . print_r($e->getResponseBody(), true), + ); + } + + $signature_request = $response->getSignatureRequest(); + + $this->assertEquals( + $request->getFormFieldsPerDocument()[0]->getApiId(), + $signature_request->getCustomFields()[0]->getApiId(), + ); + + $this->assertEquals( + $request->getSigners()[0]->getEmailAddress(), + $signature_request->getSignatures()[0]->getSignerEmailAddress(), + ); + $this->assertEquals( + $request->getSigners()[1]->getEmailAddress(), + $signature_request->getSignatures()[1]->getSignerEmailAddress(), + ); + $this->assertEquals( + $request->getSigners()[2]->getEmailAddress(), + $signature_request->getSignatures()[2]->getSignerEmailAddress(), + ); + + try { + $response = $signature_request_api->signatureRequestGet( + $signature_request->getSignatureRequestId(), + ); + } catch (Sign\ApiException $e) { + $this->fail( + 'Should not have thrown: ' . print_r($e->getResponseBody(), true), + ); + } + + $this->assertSame( + $signature_request->getSignatureRequestId(), + $response->getSignatureRequest()->getSignatureRequestId(), + ); + } + + public function testCreateEmbedded(): void + { + $signature_request_api = new Sign\Api\SignatureRequestApi($this->config); + + $data = json_decode( + file_get_contents(self::FIXTURES_DIR . '/SignatureRequestCreateEmbeddedRequest.json'), + true, + ); + $file = new SplFileObject(self::FIXTURES_DIR . '/pdf-sample.pdf'); + $data['files'] = [$file]; + $data['client_id'] = $this->client_id; + + $request = Sign\Model\SignatureRequestCreateEmbeddedRequest::init($data); + + try { + $response = $signature_request_api->signatureRequestCreateEmbedded($request); + } catch (Sign\ApiException $e) { + $this->fail( + 'Should not have thrown: ' . print_r($e->getResponseBody(), true), + ); + } + + $signature_request = $response->getSignatureRequest(); + + $this->assertEquals( + $request->getSigners()[0]->getEmailAddress(), + $signature_request->getSignatures()[0]->getSignerEmailAddress(), + ); + $this->assertEquals( + $request->getSigners()[1]->getEmailAddress(), + $signature_request->getSignatures()[1]->getSignerEmailAddress(), + ); + $this->assertEquals( + $request->getSigners()[2]->getEmailAddress(), + $signature_request->getSignatures()[2]->getSignerEmailAddress(), + ); + + $embedded_api = new Sign\Api\EmbeddedApi($this->config); + + try { + $response = $embedded_api->embeddedSignUrl( + $signature_request->getSignatures()[0]->getSignatureId(), + ); + + $this->assertNotEmpty($response->getEmbedded()->getSignUrl()); + } catch (Sign\ApiException $e) { + $this->fail( + 'Should not have thrown: ' . print_r($e->getResponseBody(), true), + ); + } + } + + public function testSendWithoutFileError(): void + { + $signature_request_api = new Sign\Api\SignatureRequestApi($this->config); + + $data = json_decode( + file_get_contents(self::FIXTURES_DIR . '/SignatureRequestSendRequest.json'), + true, + ); + + $request = Sign\Model\SignatureRequestSendRequest::init($data); + + try { + $response = $signature_request_api->signatureRequestSend($request); + + $this->fail('Should have thrown: ' . print_r($response, true)); + } catch (Sign\ApiException $e) { + $error = $e->getResponseObject(); + + $this->assertEquals('file', $error->getError()->getErrorPath()); + } + } +} diff --git a/sdks/php/src/Api/AccountApi.php b/sdks/php/src/Api/AccountApi.php index d29b3a748..cfdc96f11 100644 --- a/sdks/php/src/Api/AccountApi.php +++ b/sdks/php/src/Api/AccountApi.php @@ -1502,7 +1502,7 @@ public function accountVerifyRequest(Model\AccountVerifyRequest $account_verify_ */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/ApiAppApi.php b/sdks/php/src/Api/ApiAppApi.php index 2a0c3e9d0..07dd3db63 100644 --- a/sdks/php/src/Api/ApiAppApi.php +++ b/sdks/php/src/Api/ApiAppApi.php @@ -1765,7 +1765,7 @@ public function apiAppUpdateRequest(string $client_id, Model\ApiAppUpdateRequest */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/BulkSendJobApi.php b/sdks/php/src/Api/BulkSendJobApi.php index caf88f6b9..77ad055c7 100644 --- a/sdks/php/src/Api/BulkSendJobApi.php +++ b/sdks/php/src/Api/BulkSendJobApi.php @@ -840,7 +840,7 @@ public function bulkSendJobListRequest(int $page = 1, int $page_size = 20, strin */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/EmbeddedApi.php b/sdks/php/src/Api/EmbeddedApi.php index 4d1570294..364e5f7e7 100644 --- a/sdks/php/src/Api/EmbeddedApi.php +++ b/sdks/php/src/Api/EmbeddedApi.php @@ -831,7 +831,7 @@ public function embeddedSignUrlRequest(string $signature_id, string $contentType */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/FaxLineApi.php b/sdks/php/src/Api/FaxLineApi.php index 08d8834df..65cefff54 100644 --- a/sdks/php/src/Api/FaxLineApi.php +++ b/sdks/php/src/Api/FaxLineApi.php @@ -2470,7 +2470,7 @@ public function faxLineRemoveUserRequest(Model\FaxLineRemoveUserRequest $fax_lin */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/OAuthApi.php b/sdks/php/src/Api/OAuthApi.php index a877aef65..6fa77398a 100644 --- a/sdks/php/src/Api/OAuthApi.php +++ b/sdks/php/src/Api/OAuthApi.php @@ -881,7 +881,7 @@ protected function getHostSettingsForoauthTokenRefresh(): array */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/ReportApi.php b/sdks/php/src/Api/ReportApi.php index 2700535db..987fc25fe 100644 --- a/sdks/php/src/Api/ReportApi.php +++ b/sdks/php/src/Api/ReportApi.php @@ -471,7 +471,7 @@ public function reportCreateRequest(Model\ReportCreateRequest $report_create_req */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/SignatureRequestApi.php b/sdks/php/src/Api/SignatureRequestApi.php index ea1ec359e..e8da69d75 100644 --- a/sdks/php/src/Api/SignatureRequestApi.php +++ b/sdks/php/src/Api/SignatureRequestApi.php @@ -5480,7 +5480,7 @@ public function signatureRequestUpdateRequest(string $signature_request_id, Mode */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/TeamApi.php b/sdks/php/src/Api/TeamApi.php index fc12c18b7..ec599b4ac 100644 --- a/sdks/php/src/Api/TeamApi.php +++ b/sdks/php/src/Api/TeamApi.php @@ -3453,7 +3453,7 @@ public function teamUpdateRequest(Model\TeamUpdateRequest $team_update_request, */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/TemplateApi.php b/sdks/php/src/Api/TemplateApi.php index 1cefa919c..6b356fc7b 100644 --- a/sdks/php/src/Api/TemplateApi.php +++ b/sdks/php/src/Api/TemplateApi.php @@ -3905,7 +3905,7 @@ public function templateUpdateFilesRequest(string $template_id, Model\TemplateUp */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/src/Api/UnclaimedDraftApi.php b/sdks/php/src/Api/UnclaimedDraftApi.php index c2359c6ff..3886a87c5 100644 --- a/sdks/php/src/Api/UnclaimedDraftApi.php +++ b/sdks/php/src/Api/UnclaimedDraftApi.php @@ -1525,7 +1525,7 @@ public function unclaimedDraftEditAndResendRequest(string $signature_request_id, */ protected function createHttpClientOption() { - $options = []; + $options = $this->config->getOptions(); if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { diff --git a/sdks/php/templates/api.mustache b/sdks/php/templates/api.mustache index 3a1db5608..927ce19e3 100644 --- a/sdks/php/templates/api.mustache +++ b/sdks/php/templates/api.mustache @@ -969,7 +969,12 @@ use Psr\Http\Message\ResponseInterface; */ protected function createHttpClientOption() { +{{^useCustomTemplateCode}} $options = []; +{{/useCustomTemplateCode}} +{{#useCustomTemplateCode}} + $options = $this->config->getOptions(); +{{/useCustomTemplateCode}} if ($this->config->getDebug()) { $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); if (!$options[RequestOptions::DEBUG]) { From a62e386df2b68ae44ba0144d56997f992064725a Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 30 Aug 2024 15:12:02 -0500 Subject: [PATCH 16/19] Preparing other SDKs for integration tests --- sandbox/.gitignore | 14 +- ...SignatureRequestCreateEmbeddedRequest.json | 0 .../SignatureRequestSendRequest.json | 0 .../dotnet/{ => test_fixtures}/pdf-sample.pdf | Bin ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../{ => test_fixtures}/pdf-sample.pdf | Bin ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../{ => test_fixtures}/pdf-sample.pdf | Bin ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../node/{ => test_fixtures}/pdf-sample.pdf | Bin sandbox/php/test/SignatureRequestTest.php | 2 +- ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../pdf-sample.pdf | Bin ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../python/{ => test_fixtures}/pdf-sample.pdf | Bin ...SignatureRequestCreateEmbeddedRequest.json | 163 ++++++++++++++++++ .../SignatureRequestSendRequest.json | 163 ++++++++++++++++++ .../ruby/{ => test_fixtures}/pdf-sample.pdf | Bin 23 files changed, 1968 insertions(+), 4 deletions(-) rename sandbox/{php/fixtures => dotnet/test_fixtures}/SignatureRequestCreateEmbeddedRequest.json (100%) rename sandbox/{php/fixtures => dotnet/test_fixtures}/SignatureRequestSendRequest.json (100%) rename sandbox/dotnet/{ => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/java-v1/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/java-v1/test_fixtures/SignatureRequestSendRequest.json rename sandbox/java-v1/{ => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/java-v2/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/java-v2/test_fixtures/SignatureRequestSendRequest.json rename sandbox/java-v2/{ => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/node/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/node/test_fixtures/SignatureRequestSendRequest.json rename sandbox/node/{ => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/php/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/php/test_fixtures/SignatureRequestSendRequest.json rename sandbox/php/{fixtures => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/python/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/python/test_fixtures/SignatureRequestSendRequest.json rename sandbox/python/{ => test_fixtures}/pdf-sample.pdf (100%) create mode 100644 sandbox/ruby/test_fixtures/SignatureRequestCreateEmbeddedRequest.json create mode 100644 sandbox/ruby/test_fixtures/SignatureRequestSendRequest.json rename sandbox/ruby/{ => test_fixtures}/pdf-sample.pdf (100%) diff --git a/sandbox/.gitignore b/sandbox/.gitignore index 0082a956e..bf03f040f 100644 --- a/sandbox/.gitignore +++ b/sandbox/.gitignore @@ -3,35 +3,43 @@ dotnet/* !dotnet/hellosign_sandbox.csproj !dotnet/NuGet.Config !dotnet/Program.cs +!dotnet/src/Dropbox.SignSandbox.Test +!dotnet/test_fixtures java-v1/* !java-v1/pom.xml !java-v1/src java-v1/src/main/java/com/dropbox/sign_sandbox/* !java-v1/src/main/java/com/dropbox/sign_sandbox/Main.java +!java-v1/test_fixtures java-v2/* !java-v2/pom.xml !java-v2/src java-v2/src/main/java/com/dropbox/sign_sandbox/* !java-v2/src/main/java/com/dropbox/sign_sandbox/Main.java +!java-v2/test_fixtures node/* !node/Example.ts !node/package.json +!node/tests +!node/test_fixtures php/* !php/composer.json !php/Example.php -!php/fixtures !php/test +!php/test_fixtures python/* !python/Example.py !python/requirements.txt +!python/tests +!python/test_fixtures ruby/* !ruby/Example.rb !ruby/Gemfile - -!**/pdf-sample.pdf +!ruby/spec +!ruby/test_fixtures diff --git a/sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/dotnet/test_fixtures/SignatureRequestCreateEmbeddedRequest.json similarity index 100% rename from sandbox/php/fixtures/SignatureRequestCreateEmbeddedRequest.json rename to sandbox/dotnet/test_fixtures/SignatureRequestCreateEmbeddedRequest.json diff --git a/sandbox/php/fixtures/SignatureRequestSendRequest.json b/sandbox/dotnet/test_fixtures/SignatureRequestSendRequest.json similarity index 100% rename from sandbox/php/fixtures/SignatureRequestSendRequest.json rename to sandbox/dotnet/test_fixtures/SignatureRequestSendRequest.json diff --git a/sandbox/dotnet/pdf-sample.pdf b/sandbox/dotnet/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/dotnet/pdf-sample.pdf rename to sandbox/dotnet/test_fixtures/pdf-sample.pdf diff --git a/sandbox/java-v1/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/java-v1/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/java-v1/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/java-v1/test_fixtures/SignatureRequestSendRequest.json b/sandbox/java-v1/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/java-v1/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/java-v1/pdf-sample.pdf b/sandbox/java-v1/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/java-v1/pdf-sample.pdf rename to sandbox/java-v1/test_fixtures/pdf-sample.pdf diff --git a/sandbox/java-v2/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/java-v2/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/java-v2/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/java-v2/test_fixtures/SignatureRequestSendRequest.json b/sandbox/java-v2/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/java-v2/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/java-v2/pdf-sample.pdf b/sandbox/java-v2/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/java-v2/pdf-sample.pdf rename to sandbox/java-v2/test_fixtures/pdf-sample.pdf diff --git a/sandbox/node/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/node/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/node/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/node/test_fixtures/SignatureRequestSendRequest.json b/sandbox/node/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/node/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/node/pdf-sample.pdf b/sandbox/node/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/node/pdf-sample.pdf rename to sandbox/node/test_fixtures/pdf-sample.pdf diff --git a/sandbox/php/test/SignatureRequestTest.php b/sandbox/php/test/SignatureRequestTest.php index 745cc19d4..e3997258e 100644 --- a/sandbox/php/test/SignatureRequestTest.php +++ b/sandbox/php/test/SignatureRequestTest.php @@ -16,7 +16,7 @@ */ class SignatureRequestTest extends TestCase { - public const FIXTURES_DIR = __DIR__ . '/../fixtures'; + public const FIXTURES_DIR = __DIR__ . '/../test_fixtures'; private Sign\Configuration $config; diff --git a/sandbox/php/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/php/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/php/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/php/test_fixtures/SignatureRequestSendRequest.json b/sandbox/php/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/php/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/php/fixtures/pdf-sample.pdf b/sandbox/php/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/php/fixtures/pdf-sample.pdf rename to sandbox/php/test_fixtures/pdf-sample.pdf diff --git a/sandbox/python/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/python/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/python/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/python/test_fixtures/SignatureRequestSendRequest.json b/sandbox/python/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/python/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/python/pdf-sample.pdf b/sandbox/python/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/python/pdf-sample.pdf rename to sandbox/python/test_fixtures/pdf-sample.pdf diff --git a/sandbox/ruby/test_fixtures/SignatureRequestCreateEmbeddedRequest.json b/sandbox/ruby/test_fixtures/SignatureRequestCreateEmbeddedRequest.json new file mode 100644 index 000000000..f9bd157f8 --- /dev/null +++ b/sandbox/ruby/test_fixtures/SignatureRequestCreateEmbeddedRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "MM / DD / YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you have any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/ruby/test_fixtures/SignatureRequestSendRequest.json b/sandbox/ruby/test_fixtures/SignatureRequestSendRequest.json new file mode 100644 index 000000000..9560ddd52 --- /dev/null +++ b/sandbox/ruby/test_fixtures/SignatureRequestSendRequest.json @@ -0,0 +1,163 @@ +{ + "allow_decline": true, + "allow_reassign": true, + "attachments": [ + { + "name": "Attachment1", + "signer_index": 1, + "instructions": "Upload your Driver's License", + "required": true + } + ], + "cc_email_addresses": [ + "lawyer1@example.com", + "lawyer2@example.com" + ], + "field_options": { + "date_format": "DD - MM - YYYY" + }, + "form_field_groups": [ + { + "group_id": "radio_group_1", + "group_label": "Radio Group 1", + "requirement": "require_0-1" + } + ], + "form_field_rules": [ + { + "id": "rule_1", + "trigger_operator": "AND", + "triggers": [ + { + "id": "api_id_1", + "operator": "is", + "value": "foo" + } + ], + "actions": [ + { + "field_id": "api_id_2", + "hidden": true, + "type": "change-field-visibility" + } + ] + } + ], + "form_fields_per_document": [ + { + "document_index": 0, + "api_id": "api_id_1", + "name": "field_1", + "type": "text", + "x": 0, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": "0", + "page": 1, + "font_family": "roboto", + "font_size": 11 + }, + { + "document_index": 0, + "api_id": "api_id_2", + "name": "field_2", + "type": "text", + "x": 300, + "y": 0, + "width": 120, + "height": 30, + "required": true, + "signer": 0, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_3", + "name": "field_3", + "type": "dropdown", + "options": [ + "Option 1", + "Option 2", + "Option 3" + ], + "x": 0, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": 1, + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_4", + "name": "field_4", + "type": "text", + "x": 300, + "y": 200, + "width": 120, + "height": 30, + "required": true, + "signer": "1", + "page": 1, + "font_size": 12 + }, + { + "document_index": 0, + "api_id": "api_id_5", + "name": "field_5", + "type": "radio", + "group": "radio_group_1", + "is_checked": true, + "x": 0, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + }, + { + "document_index": 0, + "api_id": "api_id_6", + "name": "field_6", + "type": "radio", + "group": "radio_group_1", + "is_checked": false, + "x": 300, + "y": 400, + "width": 100, + "height": 16, + "required": false, + "signer": "2", + "page": 1 + } + ], + "message": "Please sign this NDA and then we can discuss more. Let me know if you\nhave any questions.", + "metadata": { + "custom_id": 1234, + "custom_text": "NDA #9" + }, + "signers": [ + { + "email_address": "s1@example.com", + "name": "Signer 1", + "order": 0 + }, + { + "email_address": "s2@example.com", + "name": "Signer 2", + "order": 1 + }, + { + "email_address": "s3@example.com", + "name": "Signer 3", + "order": 2 + } + ], + "test_mode": true +} diff --git a/sandbox/ruby/pdf-sample.pdf b/sandbox/ruby/test_fixtures/pdf-sample.pdf similarity index 100% rename from sandbox/ruby/pdf-sample.pdf rename to sandbox/ruby/test_fixtures/pdf-sample.pdf From 2e79452cfde6e67b24623ba31594063e7a7dca1d Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Fri, 30 Aug 2024 17:23:16 -0500 Subject: [PATCH 17/19] Version bump --- sdks/php/README.md | 2 +- sdks/php/VERSION | 2 +- sdks/php/openapi-config.yaml | 2 +- sdks/php/src/Configuration.php | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdks/php/README.md b/sdks/php/README.md index 8d3c17000..b68ace90a 100644 --- a/sdks/php/README.md +++ b/sdks/php/README.md @@ -429,6 +429,6 @@ apisupport@hellosign.com This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: `3.0.0` - - Package version: `1.5-dev` + - Package version: `1.6-dev` - Generator version: `7.8.0` - Build package: `org.openapitools.codegen.languages.PhpClientCodegen` diff --git a/sdks/php/VERSION b/sdks/php/VERSION index 6f3dd2f48..78ca9a102 100644 --- a/sdks/php/VERSION +++ b/sdks/php/VERSION @@ -1 +1 @@ -1.5-dev +1.6-dev diff --git a/sdks/php/openapi-config.yaml b/sdks/php/openapi-config.yaml index 64d102428..773838fe8 100644 --- a/sdks/php/openapi-config.yaml +++ b/sdks/php/openapi-config.yaml @@ -4,7 +4,7 @@ typeMappings: additionalProperties: packageName: dropbox/sign packageVersion: "^1.3.0" - artifactVersion: 1.5-dev + artifactVersion: 1.6-dev invokerPackage: "Dropbox\\Sign" sortModelPropertiesByRequiredFlag: true srcBasePath: src diff --git a/sdks/php/src/Configuration.php b/sdks/php/src/Configuration.php index 1292f9dad..8d4d1a042 100644 --- a/sdks/php/src/Configuration.php +++ b/sdks/php/src/Configuration.php @@ -97,7 +97,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/1.5-dev/PHP'; + protected $userAgent = 'OpenAPI-Generator/1.6-dev/PHP'; /** * Debug switch (default set to false) @@ -438,7 +438,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: 3.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 1.5-dev' . PHP_EOL; + $report .= ' SDK Package Version: 1.6-dev' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; From ea275cab48c72b4be6f4fa5307d3e889542dd7a5 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Tue, 3 Sep 2024 09:40:35 -0500 Subject: [PATCH 18/19] Rename config file --- sandbox/php/test/.config.dist.json | 6 ++++++ sandbox/php/test/.env.dist | 4 ---- sandbox/php/test/.gitignore | 2 +- sandbox/php/test/SignatureRequestTest.php | 16 ++++++++-------- 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 sandbox/php/test/.config.dist.json delete mode 100644 sandbox/php/test/.env.dist diff --git a/sandbox/php/test/.config.dist.json b/sandbox/php/test/.config.dist.json new file mode 100644 index 000000000..601c6a5f9 --- /dev/null +++ b/sandbox/php/test/.config.dist.json @@ -0,0 +1,6 @@ +{ + "BASE_URL": "https://api.hellosign.com/v3", + "API_KEY": "", + "CLIENT_ID": "", + "USE_XDEBUG": 0 +} diff --git a/sandbox/php/test/.env.dist b/sandbox/php/test/.env.dist deleted file mode 100644 index 3a1aa7762..000000000 --- a/sandbox/php/test/.env.dist +++ /dev/null @@ -1,4 +0,0 @@ -BASE_URL="https://api.hellosign.com/v3" -API_KEY="YOUR_API_KEY_HERE" -CLIENT_ID="YOUR_CLIENT_ID_HERE" -USE_XDEBUG=0 diff --git a/sandbox/php/test/.gitignore b/sandbox/php/test/.gitignore index 4c49bd78f..a9b8cc8b8 100644 --- a/sandbox/php/test/.gitignore +++ b/sandbox/php/test/.gitignore @@ -1 +1 @@ -.env +.config.json diff --git a/sandbox/php/test/SignatureRequestTest.php b/sandbox/php/test/SignatureRequestTest.php index e3997258e..ca3b5e730 100644 --- a/sandbox/php/test/SignatureRequestTest.php +++ b/sandbox/php/test/SignatureRequestTest.php @@ -26,20 +26,20 @@ public function setUp(): void { parent::setUp(); - $env = parse_ini_file(__DIR__ . '/.env'); - $env_dist = parse_ini_file(__DIR__ . '/.env.dist'); - $env_merged = array_merge($env_dist, $env); + $config_custom = json_decode(file_get_contents(__DIR__ . '/.config.json'), true); + $config_dist = json_decode(file_get_contents(__DIR__ . '/.config.dist.json'), true); + $config = array_merge($config_dist, $config_custom); - $this->client_id = $env_merged['CLIENT_ID']; + $this->client_id = $config['CLIENT_ID']; $this->config = new Sign\Configuration(); - $this->config->setUsername($env_merged['API_KEY']); - $this->config->setHost($env_merged['BASE_URL']); + $this->config->setUsername($config['API_KEY']); + $this->config->setHost($config['BASE_URL']); - if ($env_merged['USE_XDEBUG']) { + if ($config['USE_XDEBUG']) { $cookies = CookieJar::fromArray( ['XDEBUG_SESSION' => 'xdebug'], - parse_url($env_merged['BASE_URL'], PHP_URL_HOST), + parse_url($config['BASE_URL'], PHP_URL_HOST), ); $this->config->setOptions(['cookies' => $cookies]); From e1b0d6f99e109b89ff396d921b68c1e13c011591 Mon Sep 17 00:00:00 2001 From: Juan Treminio Date: Tue, 3 Sep 2024 16:51:41 -0500 Subject: [PATCH 19/19] Slight test cleanup --- sandbox/php/test/SignatureRequestTest.php | 82 ++++++++--------------- 1 file changed, 27 insertions(+), 55 deletions(-) diff --git a/sandbox/php/test/SignatureRequestTest.php b/sandbox/php/test/SignatureRequestTest.php index ca3b5e730..052808b36 100644 --- a/sandbox/php/test/SignatureRequestTest.php +++ b/sandbox/php/test/SignatureRequestTest.php @@ -57,49 +57,35 @@ public function testSend(): void $file = new SplFileObject(self::FIXTURES_DIR . '/pdf-sample.pdf'); $data['files'] = [$file]; - $request = Sign\Model\SignatureRequestSendRequest::init($data); - - try { - $response = $signature_request_api->signatureRequestSend($request); - } catch (Sign\ApiException $e) { - $this->fail( - 'Should not have thrown: ' . print_r($e->getResponseBody(), true), - ); - } + $send_request = Sign\Model\SignatureRequestSendRequest::init($data); - $signature_request = $response->getSignatureRequest(); + $send_response = $signature_request_api->signatureRequestSend($send_request); $this->assertEquals( - $request->getFormFieldsPerDocument()[0]->getApiId(), - $signature_request->getCustomFields()[0]->getApiId(), + $send_request->getFormFieldsPerDocument()[0]->getApiId(), + $send_response->getSignatureRequest()->getCustomFields()[0]->getApiId(), ); $this->assertEquals( - $request->getSigners()[0]->getEmailAddress(), - $signature_request->getSignatures()[0]->getSignerEmailAddress(), + $send_request->getSigners()[0]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[0]->getSignerEmailAddress(), ); $this->assertEquals( - $request->getSigners()[1]->getEmailAddress(), - $signature_request->getSignatures()[1]->getSignerEmailAddress(), + $send_request->getSigners()[1]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[1]->getSignerEmailAddress(), ); $this->assertEquals( - $request->getSigners()[2]->getEmailAddress(), - $signature_request->getSignatures()[2]->getSignerEmailAddress(), + $send_request->getSigners()[2]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[2]->getSignerEmailAddress(), ); - try { - $response = $signature_request_api->signatureRequestGet( - $signature_request->getSignatureRequestId(), - ); - } catch (Sign\ApiException $e) { - $this->fail( - 'Should not have thrown: ' . print_r($e->getResponseBody(), true), - ); - } + $get_response = $signature_request_api->signatureRequestGet( + $send_response->getSignatureRequest()->getSignatureRequestId(), + ); $this->assertSame( - $signature_request->getSignatureRequestId(), - $response->getSignatureRequest()->getSignatureRequestId(), + $send_response->getSignatureRequest()->getSignatureRequestId(), + $get_response->getSignatureRequest()->getSignatureRequestId(), ); } @@ -115,44 +101,30 @@ public function testCreateEmbedded(): void $data['files'] = [$file]; $data['client_id'] = $this->client_id; - $request = Sign\Model\SignatureRequestCreateEmbeddedRequest::init($data); - - try { - $response = $signature_request_api->signatureRequestCreateEmbedded($request); - } catch (Sign\ApiException $e) { - $this->fail( - 'Should not have thrown: ' . print_r($e->getResponseBody(), true), - ); - } + $send_request = Sign\Model\SignatureRequestCreateEmbeddedRequest::init($data); - $signature_request = $response->getSignatureRequest(); + $send_response = $signature_request_api->signatureRequestCreateEmbedded($send_request); $this->assertEquals( - $request->getSigners()[0]->getEmailAddress(), - $signature_request->getSignatures()[0]->getSignerEmailAddress(), + $send_request->getSigners()[0]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[0]->getSignerEmailAddress(), ); $this->assertEquals( - $request->getSigners()[1]->getEmailAddress(), - $signature_request->getSignatures()[1]->getSignerEmailAddress(), + $send_request->getSigners()[1]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[1]->getSignerEmailAddress(), ); $this->assertEquals( - $request->getSigners()[2]->getEmailAddress(), - $signature_request->getSignatures()[2]->getSignerEmailAddress(), + $send_request->getSigners()[2]->getEmailAddress(), + $send_response->getSignatureRequest()->getSignatures()[2]->getSignerEmailAddress(), ); $embedded_api = new Sign\Api\EmbeddedApi($this->config); - try { - $response = $embedded_api->embeddedSignUrl( - $signature_request->getSignatures()[0]->getSignatureId(), - ); + $get_response = $embedded_api->embeddedSignUrl( + $send_response->getSignatureRequest()->getSignatures()[0]->getSignatureId(), + ); - $this->assertNotEmpty($response->getEmbedded()->getSignUrl()); - } catch (Sign\ApiException $e) { - $this->fail( - 'Should not have thrown: ' . print_r($e->getResponseBody(), true), - ); - } + $this->assertNotEmpty($get_response->getEmbedded()->getSignUrl()); } public function testSendWithoutFileError(): void