diff --git a/CHANGELOG.md b/CHANGELOG.md index 097c463d..0dfebfec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [v2.3.1](https://github.com/fastly/fastly-php/releases/tag/release/v2.3.1) (2023-07-05) + +**Bug fixes:** + +- fix(snippet): dynamic field switched from int to string. +- fix(vcl): implement correct response models. + ## [v2.3.0](https://github.com/fastly/fastly-php/releases/tag/release/v2.3.0) (2023-06-27) **Enhancements:** diff --git a/README.md b/README.md index 08ef4503..33434941 100644 --- a/README.md +++ b/README.md @@ -529,6 +529,7 @@ The fastly-php API client currently does not support the following endpoints: - [`/customer/{customer_id}/contacts`](https://developer.fastly.com/reference/api/account/contact) (POST) - [`/metrics/domains/services/{service_id}`](https://developer.fastly.com/reference/api/metrics-stats/domain-inspector/historical) (GET) - [`/metrics/origins/services/{service_id}`](https://developer.fastly.com/reference/api/metrics-stats/origin-inspector/historical) (GET) +- [`/resources/stores/kv/{store_id}/batch`](https://developer.fastly.com/reference/api/services/resources/kv-store-item) (PUT) - [`/resources/stores/secret/client-key`](https://developer.fastly.com/reference/api/services/resources/secret-store) (POST) - [`/resources/stores/secret/signing-key`](https://developer.fastly.com/reference/api/services/resources/secret-store) (GET) - [`/resources/stores/secret/{store_id}/secrets/{secret_name}`](https://developer.fastly.com/reference/api/services/resources/secret) (DELETE, GET) diff --git a/docs/Api/SnippetApi.md b/docs/Api/SnippetApi.md index 970dc2ae..8274a0ed 100644 --- a/docs/Api/SnippetApi.md +++ b/docs/Api/SnippetApi.md @@ -35,7 +35,7 @@ Create a snippet for a particular service and version. $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. $options['version_id'] = 56; // int | Integer identifying a service version. $options['name'] = 'name_example'; // string | The name for the snippet. -$options['dynamic'] = 56; // int | Sets the snippet version. +$options['dynamic'] = 'dynamic_example'; // string | Sets the snippet version. $options['type'] = 'type_example'; // string | The location in generated VCL where the snippet should be placed. $options['content'] = 'content_example'; // string | The VCL code that specifies exactly what the snippet does. $options['priority'] = '100'; // string | Priority determines execution order. Lower numbers execute first. @@ -56,7 +56,7 @@ Name | Type | Description | Notes **service_id** | **string** | Alphanumeric string identifying the service. | **version_id** | **int** | Integer identifying a service version. | **name** | **string** | The name for the snippet. | [optional] -**dynamic** | **int** | Sets the snippet version. | [optional] [one of: 0, 1] +**dynamic** | **string** | Sets the snippet version. | [optional] [one of: '0', '1'] **type** | **string** | The location in generated VCL where the snippet should be placed. | [optional] [one of: 'init', 'recv', 'hash', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'none'] **content** | **string** | The VCL code that specifies exactly what the snippet does. | [optional] **priority** | **string** | Priority determines execution order. Lower numbers execute first. | [optional] [defaults to '100'] @@ -229,7 +229,7 @@ Update a dynamic snippet for a particular service. $options['service_id'] = 'service_id_example'; // string | Alphanumeric string identifying the service. $options['snippet_id'] = 'snippet_id_example'; // string | Alphanumeric string identifying a VCL Snippet. $options['name'] = 'name_example'; // string | The name for the snippet. -$options['dynamic'] = 56; // int | Sets the snippet version. +$options['dynamic'] = 'dynamic_example'; // string | Sets the snippet version. $options['type'] = 'type_example'; // string | The location in generated VCL where the snippet should be placed. $options['content'] = 'content_example'; // string | The VCL code that specifies exactly what the snippet does. $options['priority'] = '100'; // string | Priority determines execution order. Lower numbers execute first. @@ -250,7 +250,7 @@ Name | Type | Description | Notes **service_id** | **string** | Alphanumeric string identifying the service. | **snippet_id** | **string** | Alphanumeric string identifying a VCL Snippet. | **name** | **string** | The name for the snippet. | [optional] -**dynamic** | **int** | Sets the snippet version. | [optional] [one of: 0, 1] +**dynamic** | **string** | Sets the snippet version. | [optional] [one of: '0', '1'] **type** | **string** | The location in generated VCL where the snippet should be placed. | [optional] [one of: 'init', 'recv', 'hash', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'none'] **content** | **string** | The VCL code that specifies exactly what the snippet does. | [optional] **priority** | **string** | Priority determines execution order. Lower numbers execute first. | [optional] [defaults to '100'] diff --git a/docs/Api/VclApi.md b/docs/Api/VclApi.md index 547319a0..86fcf0d1 100644 --- a/docs/Api/VclApi.md +++ b/docs/Api/VclApi.md @@ -224,7 +224,7 @@ Name | Type | Description | Notes ## `getCustomVclGeneratedHighlighted()` ```php -getCustomVclGeneratedHighlighted($options) // Get the generated VCL with syntax highlighting +getCustomVclGeneratedHighlighted($options): \Fastly\Model\VclSyntaxHighlightingResponse // Get the generated VCL with syntax highlighting ``` Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending `lineno=true` as a request parameter. @@ -235,7 +235,7 @@ Display the content of generated VCL with HTML syntax highlighting. Include line $options['version_id'] = 56; // int | Integer identifying a service version. try { - $apiInstance->getCustomVclGeneratedHighlighted($options); + $result = $apiInstance->getCustomVclGeneratedHighlighted($options); } catch (Exception $e) { echo 'Exception when calling VclApi->getCustomVclGeneratedHighlighted: ', $e->getMessage(), PHP_EOL; } @@ -252,7 +252,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**\Fastly\Model\VclSyntaxHighlightingResponse**](../Model/VclSyntaxHighlightingResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) @@ -260,7 +260,7 @@ void (empty response body) ## `getCustomVclHighlighted()` ```php -getCustomVclHighlighted($options) // Get a custom VCL file with syntax highlighting +getCustomVclHighlighted($options): \Fastly\Model\VclSyntaxHighlightingResponse // Get a custom VCL file with syntax highlighting ``` Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending `lineno=true` as a request parameter. @@ -272,7 +272,7 @@ $options['version_id'] = 56; // int | Integer identifying a service version. $options['vcl_name'] = 'vcl_name_example'; // string | The name of this VCL. try { - $apiInstance->getCustomVclHighlighted($options); + $result = $apiInstance->getCustomVclHighlighted($options); } catch (Exception $e) { echo 'Exception when calling VclApi->getCustomVclHighlighted: ', $e->getMessage(), PHP_EOL; } @@ -290,7 +290,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**\Fastly\Model\VclSyntaxHighlightingResponse**](../Model/VclSyntaxHighlightingResponse.md) [[Back to top]](#) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/Batch.md b/docs/Model/Batch.md new file mode 100644 index 00000000..19d70603 --- /dev/null +++ b/docs/Model/Batch.md @@ -0,0 +1,12 @@ +# # Batch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **string** | A descriptor for the response of the entire batch | [optional] +**type** | **string** | If an error is present in any of the requests, this field will describe that error | [optional] +**errors** | [**\Fastly\Model\BatchErrors[]**](BatchErrors.md) | Per-key errors which failed to parse, validate, or otherwise transmit | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BatchErrors.md b/docs/Model/BatchErrors.md new file mode 100644 index 00000000..f6fc5c25 --- /dev/null +++ b/docs/Model/BatchErrors.md @@ -0,0 +1,13 @@ +# # BatchErrors + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | The key that the error corresponds to. This field will be empty if the object or one of its fields was unable to be parsed. | [optional] +**index** | **int** | The line number of the payload on which the error occurred (starting from 0 for the first line). | [optional] +**code** | **string** | The HTTP response code for the request, or a 400 if the request was not able to be completed. | [optional] +**reason** | **string** | A descriptor of this particular item's error. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/SchemasSnippetResponse.md b/docs/Model/SchemasSnippetResponse.md index 38161a69..133a7a4f 100644 --- a/docs/Model/SchemasSnippetResponse.md +++ b/docs/Model/SchemasSnippetResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | The name for the snippet. | [optional] -**dynamic** | **int** | Sets the snippet version. | [optional] [one of: 0, 1] +**dynamic** | **string** | Sets the snippet version. | [optional] [one of: '0', '1'] **type** | **string** | The location in generated VCL where the snippet should be placed. | [optional] [one of: 'init', 'recv', 'hash', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'none'] **content** | **string** | The VCL code that specifies exactly what the snippet does. | [optional] **priority** | **string** | Priority determines execution order. Lower numbers execute first. | [optional] [defaults to '100'] diff --git a/docs/Model/Snippet.md b/docs/Model/Snippet.md index 7d034dff..fc2e9afc 100644 --- a/docs/Model/Snippet.md +++ b/docs/Model/Snippet.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | The name for the snippet. | [optional] -**dynamic** | **int** | Sets the snippet version. | [optional] [one of: 0, 1] +**dynamic** | **string** | Sets the snippet version. | [optional] [one of: '0', '1'] **type** | **string** | The location in generated VCL where the snippet should be placed. | [optional] [one of: 'init', 'recv', 'hash', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'none'] **content** | **string** | The VCL code that specifies exactly what the snippet does. | [optional] **priority** | **string** | Priority determines execution order. Lower numbers execute first. | [optional] [defaults to '100'] diff --git a/docs/Model/SnippetResponse.md b/docs/Model/SnippetResponse.md index f0955033..6130f1e8 100644 --- a/docs/Model/SnippetResponse.md +++ b/docs/Model/SnippetResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **name** | **string** | The name for the snippet. | [optional] -**dynamic** | **int** | Sets the snippet version. | [optional] [one of: 0, 1] +**dynamic** | **string** | Sets the snippet version. | [optional] [one of: '0', '1'] **type** | **string** | The location in generated VCL where the snippet should be placed. | [optional] [one of: 'init', 'recv', 'hash', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'none'] **content** | **string** | The VCL code that specifies exactly what the snippet does. | [optional] **priority** | **string** | Priority determines execution order. Lower numbers execute first. | [optional] [defaults to '100'] diff --git a/docs/Model/TokensAdditionalProps.md b/docs/Model/TokensAdditionalProps.md new file mode 100644 index 00000000..eb48c6d8 --- /dev/null +++ b/docs/Model/TokensAdditionalProps.md @@ -0,0 +1,9 @@ +# # TokensAdditionalProps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidatorResult.md b/docs/Model/ValidatorResult.md index bd61d68d..c6cc3e07 100644 --- a/docs/Model/ValidatorResult.md +++ b/docs/Model/ValidatorResult.md @@ -4,11 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**msg** | **string** | | [optional] -**status** | **string** | | [optional] [one of: 'error', 'ok'] -**errors** | **string[]** | | [optional] -**warnings** | **string[]** | | [optional] -**messages** | [**\Fastly\Model\ValidatorResultMessages[]**](ValidatorResultMessages.md) | | [optional] +**data** | [**\Fastly\Model\ValidatorResultData**](ValidatorResultData.md) | | [optional] [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidatorResultData.md b/docs/Model/ValidatorResultData.md new file mode 100644 index 00000000..a479adc7 --- /dev/null +++ b/docs/Model/ValidatorResultData.md @@ -0,0 +1,12 @@ +# # ValidatorResultData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | | [optional] +**type** | **string** | | [optional] +**attributes** | [**\Fastly\Model\ValidatorResultDataAttributes**](ValidatorResultDataAttributes.md) | | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidatorResultDataAttributes.md b/docs/Model/ValidatorResultDataAttributes.md new file mode 100644 index 00000000..c6f86dcf --- /dev/null +++ b/docs/Model/ValidatorResultDataAttributes.md @@ -0,0 +1,14 @@ +# # ValidatorResultDataAttributes + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**msg** | **string** | | [optional] +**status** | **string** | | [optional] [one of: 'error', 'ok'] +**errors** | **string[]** | | [optional] +**warnings** | **string[]** | | [optional] +**messages** | [**\Fastly\Model\ValidatorResultDataAttributesMessages[]**](ValidatorResultDataAttributesMessages.md) | | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ValidatorResultMessages.md b/docs/Model/ValidatorResultDataAttributesMessages.md similarity index 69% rename from docs/Model/ValidatorResultMessages.md rename to docs/Model/ValidatorResultDataAttributesMessages.md index 5c1fab3b..f65f5a89 100644 --- a/docs/Model/ValidatorResultMessages.md +++ b/docs/Model/ValidatorResultDataAttributesMessages.md @@ -1,4 +1,4 @@ -# # ValidatorResultMessages +# # ValidatorResultDataAttributesMessages ## Properties @@ -7,7 +7,7 @@ Name | Type | Description | Notes **type** | **string** | | **warning** | **bool** | | **message** | **string** | | -**tokens** | **array<string,AnyOfStringNumber>[]** | | +**tokens** | **array<string,\Fastly\Model\TokensAdditionalProps>[]** | | [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VclSyntaxHighlightingResponse.md b/docs/Model/VclSyntaxHighlightingResponse.md new file mode 100644 index 00000000..a44fcee1 --- /dev/null +++ b/docs/Model/VclSyntaxHighlightingResponse.md @@ -0,0 +1,10 @@ +# # VclSyntaxHighlightingResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**content** | **string** | VCL with HTML syntax highlighting. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/SnippetApi.php b/lib/Api/SnippetApi.php index c03b94bb..e8740162 100644 --- a/lib/Api/SnippetApi.php +++ b/lib/Api/SnippetApi.php @@ -122,7 +122,7 @@ public function getConfig() * @param string $service_id Alphanumeric string identifying the service. (required) * @param int $version_id Integer identifying a service version. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -150,7 +150,7 @@ public function createSnippet($options) * @param string $service_id Alphanumeric string identifying the service. (required) * @param int $version_id Integer identifying a service version. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -266,7 +266,7 @@ public function createSnippetWithHttpInfo($options) * @param string $service_id Alphanumeric string identifying the service. (required) * @param int $version_id Integer identifying a service version. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -297,7 +297,7 @@ function ($response) { * @param string $service_id Alphanumeric string identifying the service. (required) * @param int $version_id Integer identifying a service version. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -354,7 +354,7 @@ function ($exception) { * @param string $service_id Alphanumeric string identifying the service. (required) * @param int $version_id Integer identifying a service version. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -1922,7 +1922,7 @@ public function listSnippetsRequest($options) * @param string $service_id Alphanumeric string identifying the service. (required) * @param string $snippet_id Alphanumeric string identifying a VCL Snippet. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -1950,7 +1950,7 @@ public function updateSnippetDynamic($options) * @param string $service_id Alphanumeric string identifying the service. (required) * @param string $snippet_id Alphanumeric string identifying a VCL Snippet. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -2066,7 +2066,7 @@ public function updateSnippetDynamicWithHttpInfo($options) * @param string $service_id Alphanumeric string identifying the service. (required) * @param string $snippet_id Alphanumeric string identifying a VCL Snippet. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -2097,7 +2097,7 @@ function ($response) { * @param string $service_id Alphanumeric string identifying the service. (required) * @param string $snippet_id Alphanumeric string identifying a VCL Snippet. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') @@ -2154,7 +2154,7 @@ function ($exception) { * @param string $service_id Alphanumeric string identifying the service. (required) * @param string $snippet_id Alphanumeric string identifying a VCL Snippet. (required) * @param string $name The name for the snippet. (optional) - * @param int $dynamic Sets the snippet version. (optional) + * @param string $dynamic Sets the snippet version. (optional) * @param string $type The location in generated VCL where the snippet should be placed. (optional) * @param string $content The VCL code that specifies exactly what the snippet does. (optional) * @param string $priority Priority determines execution order. Lower numbers execute first. (optional, default to '100') diff --git a/lib/Api/VclApi.php b/lib/Api/VclApi.php index bf1967f9..2ef42e11 100644 --- a/lib/Api/VclApi.php +++ b/lib/Api/VclApi.php @@ -1921,11 +1921,12 @@ public function getCustomVclGeneratedRequest($options) * * @throws \Fastly\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return void + * @return \Fastly\Model\VclSyntaxHighlightingResponse */ public function getCustomVclGeneratedHighlighted($options) { - $this->getCustomVclGeneratedHighlightedWithHttpInfo($options); + list($response) = $this->getCustomVclGeneratedHighlightedWithHttpInfo($options); + return $response; } /** @@ -1943,7 +1944,7 @@ public function getCustomVclGeneratedHighlighted($options) * * @throws \Fastly\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \Fastly\Model\VclSyntaxHighlightingResponse, HTTP status code, HTTP response headers (array of strings) */ public function getCustomVclGeneratedHighlightedWithHttpInfo($options) { @@ -1996,10 +1997,44 @@ public function getCustomVclGeneratedHighlightedWithHttpInfo($options) ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('\Fastly\Model\VclSyntaxHighlightingResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\VclSyntaxHighlightingResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\VclSyntaxHighlightingResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\VclSyntaxHighlightingResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } @@ -2049,14 +2084,24 @@ function ($response) { */ public function getCustomVclGeneratedHighlightedAsyncWithHttpInfo($options) { - $returnType = ''; + $returnType = '\Fastly\Model\VclSyntaxHighlightingResponse'; $request = $this->getCustomVclGeneratedHighlightedRequest($options); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -2219,11 +2264,12 @@ public function getCustomVclGeneratedHighlightedRequest($options) * * @throws \Fastly\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return void + * @return \Fastly\Model\VclSyntaxHighlightingResponse */ public function getCustomVclHighlighted($options) { - $this->getCustomVclHighlightedWithHttpInfo($options); + list($response) = $this->getCustomVclHighlightedWithHttpInfo($options); + return $response; } /** @@ -2242,7 +2288,7 @@ public function getCustomVclHighlighted($options) * * @throws \Fastly\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \Fastly\Model\VclSyntaxHighlightingResponse, HTTP status code, HTTP response headers (array of strings) */ public function getCustomVclHighlightedWithHttpInfo($options) { @@ -2295,10 +2341,44 @@ public function getCustomVclHighlightedWithHttpInfo($options) ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('\Fastly\Model\VclSyntaxHighlightingResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\VclSyntaxHighlightingResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\VclSyntaxHighlightingResponse'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Fastly\Model\VclSyntaxHighlightingResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; } throw $e; } @@ -2350,14 +2430,24 @@ function ($response) { */ public function getCustomVclHighlightedAsyncWithHttpInfo($options) { - $returnType = ''; + $returnType = '\Fastly\Model\VclSyntaxHighlightingResponse'; $request = $this->getCustomVclHighlightedRequest($options); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); diff --git a/lib/Configuration.php b/lib/Configuration.php index 433ab6b6..5d4df209 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -89,7 +89,7 @@ class Configuration * * @var string */ - protected $userAgent = 'fastly-php/2.3.0'; + protected $userAgent = 'fastly-php/2.3.1'; /** * Debug switch (default set to false) @@ -453,7 +453,7 @@ public static function toDebugReport() $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; $report .= ' The version of the schema document: 1.0.0' . PHP_EOL; - $report .= ' SDK Package Version: 2.3.0' . PHP_EOL; + $report .= ' SDK Package Version: 2.3.1' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/Batch.php b/lib/Model/Batch.php new file mode 100644 index 00000000..0c4a690c --- /dev/null +++ b/lib/Model/Batch.php @@ -0,0 +1,374 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Batch implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'batch'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'title' => 'string', + 'type' => 'string', + 'errors' => '\Fastly\Model\BatchErrors[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'title' => null, + 'type' => null, + 'errors' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'title' => 'title', + 'type' => 'type', + 'errors' => 'errors' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'title' => 'setTitle', + 'type' => 'setType', + 'errors' => 'setErrors' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'title' => 'getTitle', + 'type' => 'getType', + 'errors' => 'getErrors' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['title'] = $data['title'] ?? null; + $this->container['type'] = $data['type'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title A descriptor for the response of the entire batch + * + * @return self + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type If an error is present in any of the requests, this field will describe that error + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets errors + * + * @return \Fastly\Model\BatchErrors[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param \Fastly\Model\BatchErrors[]|null $errors Per-key errors which failed to parse, validate, or otherwise transmit + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/BatchErrors.php b/lib/Model/BatchErrors.php new file mode 100644 index 00000000..a3c306ff --- /dev/null +++ b/lib/Model/BatchErrors.php @@ -0,0 +1,404 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchErrors implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'batch_errors'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'key' => 'string', + 'index' => 'int', + 'code' => 'string', + 'reason' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'key' => null, + 'index' => null, + 'code' => null, + 'reason' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'key' => 'key', + 'index' => 'index', + 'code' => 'code', + 'reason' => 'reason' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'index' => 'setIndex', + 'code' => 'setCode', + 'reason' => 'setReason' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'index' => 'getIndex', + 'code' => 'getCode', + 'reason' => 'getReason' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['key'] = $data['key'] ?? null; + $this->container['index'] = $data['index'] ?? null; + $this->container['code'] = $data['code'] ?? null; + $this->container['reason'] = $data['reason'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets key + * + * @return string|null + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string|null $key The key that the error corresponds to. This field will be empty if the object or one of its fields was unable to be parsed. + * + * @return self + */ + public function setKey($key) + { + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets index + * + * @return int|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param int|null $index The line number of the payload on which the error occurred (starting from 0 for the first line). + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code The HTTP response code for the request, or a 400 if the request was not able to be completed. + * + * @return self + */ + public function setCode($code) + { + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets reason + * + * @return string|null + */ + public function getReason() + { + return $this->container['reason']; + } + + /** + * Sets reason + * + * @param string|null $reason A descriptor of this particular item's error. + * + * @return self + */ + public function setReason($reason) + { + $this->container['reason'] = $reason; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SchemasSnippetResponse.php b/lib/Model/SchemasSnippetResponse.php index 65e9175d..93e9ba63 100644 --- a/lib/Model/SchemasSnippetResponse.php +++ b/lib/Model/SchemasSnippetResponse.php @@ -54,7 +54,7 @@ class SchemasSnippetResponse implements ModelInterface, ArrayAccess, \JsonSerial */ protected static $fastlyTypes = [ 'name' => 'string', - 'dynamic' => 'int', + 'dynamic' => 'string', 'type' => 'string', 'content' => 'string', 'priority' => 'string', @@ -206,8 +206,8 @@ public function getModelName() return self::$fastlyModelName; } - const DYNAMIC_0 = 0; - const DYNAMIC_1 = 1; + const DYNAMIC_regular = '0'; + const DYNAMIC_dynamic = '1'; const TYPE_INIT = 'init'; const TYPE_RECV = 'recv'; const TYPE_HASH = 'hash'; @@ -228,8 +228,8 @@ public function getModelName() public function getDynamicAllowableValues() { return [ - self::DYNAMIC_0, - self::DYNAMIC_1, + self::DYNAMIC_regular, + self::DYNAMIC_dynamic, ]; } @@ -352,7 +352,7 @@ public function setName($name) /** * Gets dynamic * - * @return int|null + * @return string|null */ public function getDynamic() { @@ -362,7 +362,7 @@ public function getDynamic() /** * Sets dynamic * - * @param int|null $dynamic Sets the snippet version. + * @param string|null $dynamic Sets the snippet version. * * @return self */ diff --git a/lib/Model/Snippet.php b/lib/Model/Snippet.php index 30e29775..25c1b2d5 100644 --- a/lib/Model/Snippet.php +++ b/lib/Model/Snippet.php @@ -54,7 +54,7 @@ class Snippet implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $fastlyTypes = [ 'name' => 'string', - 'dynamic' => 'int', + 'dynamic' => 'string', 'type' => 'string', 'content' => 'string', 'priority' => 'string' @@ -176,8 +176,8 @@ public function getModelName() return self::$fastlyModelName; } - const DYNAMIC_0 = 0; - const DYNAMIC_1 = 1; + const DYNAMIC_regular = '0'; + const DYNAMIC_dynamic = '1'; const TYPE_INIT = 'init'; const TYPE_RECV = 'recv'; const TYPE_HASH = 'hash'; @@ -198,8 +198,8 @@ public function getModelName() public function getDynamicAllowableValues() { return [ - self::DYNAMIC_0, - self::DYNAMIC_1, + self::DYNAMIC_regular, + self::DYNAMIC_dynamic, ]; } @@ -316,7 +316,7 @@ public function setName($name) /** * Gets dynamic * - * @return int|null + * @return string|null */ public function getDynamic() { @@ -326,7 +326,7 @@ public function getDynamic() /** * Sets dynamic * - * @param int|null $dynamic Sets the snippet version. + * @param string|null $dynamic Sets the snippet version. * * @return self */ diff --git a/lib/Model/SnippetResponse.php b/lib/Model/SnippetResponse.php index 04601528..43abce60 100644 --- a/lib/Model/SnippetResponse.php +++ b/lib/Model/SnippetResponse.php @@ -54,7 +54,7 @@ class SnippetResponse implements ModelInterface, ArrayAccess, \JsonSerializable */ protected static $fastlyTypes = [ 'name' => 'string', - 'dynamic' => 'int', + 'dynamic' => 'string', 'type' => 'string', 'content' => 'string', 'priority' => 'string', @@ -206,8 +206,8 @@ public function getModelName() return self::$fastlyModelName; } - const DYNAMIC_0 = 0; - const DYNAMIC_1 = 1; + const DYNAMIC_regular = '0'; + const DYNAMIC_dynamic = '1'; const TYPE_INIT = 'init'; const TYPE_RECV = 'recv'; const TYPE_HASH = 'hash'; @@ -228,8 +228,8 @@ public function getModelName() public function getDynamicAllowableValues() { return [ - self::DYNAMIC_0, - self::DYNAMIC_1, + self::DYNAMIC_regular, + self::DYNAMIC_dynamic, ]; } @@ -352,7 +352,7 @@ public function setName($name) /** * Gets dynamic * - * @return int|null + * @return string|null */ public function getDynamic() { @@ -362,7 +362,7 @@ public function getDynamic() /** * Sets dynamic * - * @param int|null $dynamic Sets the snippet version. + * @param string|null $dynamic Sets the snippet version. * * @return self */ diff --git a/lib/Model/TokensAdditionalProps.php b/lib/Model/TokensAdditionalProps.php new file mode 100644 index 00000000..2820e05f --- /dev/null +++ b/lib/Model/TokensAdditionalProps.php @@ -0,0 +1,289 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class TokensAdditionalProps implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'tokens_additional_props'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ValidatorResult.php b/lib/Model/ValidatorResult.php index c53184c2..83f51e16 100644 --- a/lib/Model/ValidatorResult.php +++ b/lib/Model/ValidatorResult.php @@ -54,11 +54,7 @@ class ValidatorResult implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $fastlyTypes = [ - 'msg' => 'string', - 'status' => 'string', - 'errors' => 'string[]', - 'warnings' => 'string[]', - 'messages' => '\Fastly\Model\ValidatorResultMessages[]' + 'data' => '\Fastly\Model\ValidatorResultData' ]; /** @@ -69,11 +65,7 @@ class ValidatorResult implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $fastlyFormats = [ - 'msg' => null, - 'status' => null, - 'errors' => null, - 'warnings' => null, - 'messages' => null + 'data' => null ]; /** @@ -103,11 +95,7 @@ public static function fastlyFormats() * @var string[] */ protected static $attributeMap = [ - 'msg' => 'msg', - 'status' => 'status', - 'errors' => 'errors', - 'warnings' => 'warnings', - 'messages' => 'messages' + 'data' => 'data' ]; /** @@ -116,11 +104,7 @@ public static function fastlyFormats() * @var string[] */ protected static $setters = [ - 'msg' => 'setMsg', - 'status' => 'setStatus', - 'errors' => 'setErrors', - 'warnings' => 'setWarnings', - 'messages' => 'setMessages' + 'data' => 'setData' ]; /** @@ -129,11 +113,7 @@ public static function fastlyFormats() * @var string[] */ protected static $getters = [ - 'msg' => 'getMsg', - 'status' => 'getStatus', - 'errors' => 'getErrors', - 'warnings' => 'getWarnings', - 'messages' => 'getMessages' + 'data' => 'getData' ]; /** @@ -177,21 +157,6 @@ public function getModelName() return self::$fastlyModelName; } - const STATUS_ERROR = 'error'; - const STATUS_OK = 'ok'; - - /** - * Gets allowable values of the enum - * - * @return string[] - */ - public function getStatusAllowableValues() - { - return [ - self::STATUS_ERROR, - self::STATUS_OK, - ]; - } /** * Associative array for storing property values @@ -208,11 +173,7 @@ public function getStatusAllowableValues() */ public function __construct(array $data = null) { - $this->container['msg'] = $data['msg'] ?? null; - $this->container['status'] = $data['status'] ?? null; - $this->container['errors'] = $data['errors'] ?? null; - $this->container['warnings'] = $data['warnings'] ?? null; - $this->container['messages'] = $data['messages'] ?? null; + $this->container['data'] = $data['data'] ?? null; } /** @@ -224,15 +185,6 @@ public function listInvalidProperties() { $invalidProperties = []; - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { - $invalidProperties[] = sprintf( - "invalid value '%s' for 'status', must be one of '%s'", - $this->container['status'], - implode("', '", $allowedValues) - ); - } - return $invalidProperties; } @@ -249,131 +201,25 @@ public function valid() /** - * Gets msg - * - * @return string|null - */ - public function getMsg() - { - return $this->container['msg']; - } - - /** - * Sets msg - * - * @param string|null $msg msg - * - * @return self - */ - public function setMsg($msg) - { - $this->container['msg'] = $msg; - - return $this; - } - - /** - * Gets status - * - * @return string|null - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param string|null $status status - * - * @return self - */ - public function setStatus($status) - { - $allowedValues = $this->getStatusAllowableValues(); - if (!is_null($status) && !in_array($status, $allowedValues, true)) { - throw new \InvalidArgumentException( - sprintf( - "Invalid value '%s' for 'status', must be one of '%s'", - $status, - implode("', '", $allowedValues) - ) - ); - } - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets errors - * - * @return string[]|null - */ - public function getErrors() - { - return $this->container['errors']; - } - - /** - * Sets errors - * - * @param string[]|null $errors errors - * - * @return self - */ - public function setErrors($errors) - { - $this->container['errors'] = $errors; - - return $this; - } - - /** - * Gets warnings - * - * @return string[]|null - */ - public function getWarnings() - { - return $this->container['warnings']; - } - - /** - * Sets warnings - * - * @param string[]|null $warnings warnings - * - * @return self - */ - public function setWarnings($warnings) - { - $this->container['warnings'] = $warnings; - - return $this; - } - - /** - * Gets messages + * Gets data * - * @return \Fastly\Model\ValidatorResultMessages[]|null + * @return \Fastly\Model\ValidatorResultData|null */ - public function getMessages() + public function getData() { - return $this->container['messages']; + return $this->container['data']; } /** - * Sets messages + * Sets data * - * @param \Fastly\Model\ValidatorResultMessages[]|null $messages messages + * @param \Fastly\Model\ValidatorResultData|null $data data * * @return self */ - public function setMessages($messages) + public function setData($data) { - $this->container['messages'] = $messages; + $this->container['data'] = $data; return $this; } diff --git a/lib/Model/ValidatorResultData.php b/lib/Model/ValidatorResultData.php new file mode 100644 index 00000000..f2c2d761 --- /dev/null +++ b/lib/Model/ValidatorResultData.php @@ -0,0 +1,374 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ValidatorResultData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'validator_result_data'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'id' => 'string', + 'type' => 'string', + 'attributes' => '\Fastly\Model\ValidatorResultDataAttributes' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'id' => null, + 'type' => null, + 'attributes' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'type' => 'type', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'type' => 'setType', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'type' => 'getType', + 'attributes' => 'getAttributes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + $this->container['type'] = $data['type'] ?? null; + $this->container['attributes'] = $data['attributes'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id id + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets type + * + * @return string|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param string|null $type type + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets attributes + * + * @return \Fastly\Model\ValidatorResultDataAttributes|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \Fastly\Model\ValidatorResultDataAttributes|null $attributes attributes + * + * @return self + */ + public function setAttributes($attributes) + { + $this->container['attributes'] = $attributes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ValidatorResultDataAttributes.php b/lib/Model/ValidatorResultDataAttributes.php new file mode 100644 index 00000000..f48e0354 --- /dev/null +++ b/lib/Model/ValidatorResultDataAttributes.php @@ -0,0 +1,468 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ValidatorResultDataAttributes implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'validator_result_data_attributes'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'msg' => 'string', + 'status' => 'string', + 'errors' => 'string[]', + 'warnings' => 'string[]', + 'messages' => '\Fastly\Model\ValidatorResultDataAttributesMessages[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'msg' => null, + 'status' => null, + 'errors' => null, + 'warnings' => null, + 'messages' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'msg' => 'msg', + 'status' => 'status', + 'errors' => 'errors', + 'warnings' => 'warnings', + 'messages' => 'messages' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'msg' => 'setMsg', + 'status' => 'setStatus', + 'errors' => 'setErrors', + 'warnings' => 'setWarnings', + 'messages' => 'setMessages' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'msg' => 'getMsg', + 'status' => 'getStatus', + 'errors' => 'getErrors', + 'warnings' => 'getWarnings', + 'messages' => 'getMessages' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + const STATUS_ERROR = 'error'; + const STATUS_OK = 'ok'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_ERROR, + self::STATUS_OK, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['msg'] = $data['msg'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['errors'] = $data['errors'] ?? null; + $this->container['warnings'] = $data['warnings'] ?? null; + $this->container['messages'] = $data['messages'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets msg + * + * @return string|null + */ + public function getMsg() + { + return $this->container['msg']; + } + + /** + * Sets msg + * + * @param string|null $msg msg + * + * @return self + */ + public function setMsg($msg) + { + $this->container['msg'] = $msg; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status status + * + * @return self + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($status) && !in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets errors + * + * @return string[]|null + */ + public function getErrors() + { + return $this->container['errors']; + } + + /** + * Sets errors + * + * @param string[]|null $errors errors + * + * @return self + */ + public function setErrors($errors) + { + $this->container['errors'] = $errors; + + return $this; + } + + /** + * Gets warnings + * + * @return string[]|null + */ + public function getWarnings() + { + return $this->container['warnings']; + } + + /** + * Sets warnings + * + * @param string[]|null $warnings warnings + * + * @return self + */ + public function setWarnings($warnings) + { + $this->container['warnings'] = $warnings; + + return $this; + } + + /** + * Gets messages + * + * @return \Fastly\Model\ValidatorResultDataAttributesMessages[]|null + */ + public function getMessages() + { + return $this->container['messages']; + } + + /** + * Sets messages + * + * @param \Fastly\Model\ValidatorResultDataAttributesMessages[]|null $messages messages + * + * @return self + */ + public function setMessages($messages) + { + $this->container['messages'] = $messages; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ValidatorResultMessages.php b/lib/Model/ValidatorResultDataAttributesMessages.php similarity index 94% rename from lib/Model/ValidatorResultMessages.php rename to lib/Model/ValidatorResultDataAttributesMessages.php index 9ac7e7ed..5303342d 100644 --- a/lib/Model/ValidatorResultMessages.php +++ b/lib/Model/ValidatorResultDataAttributesMessages.php @@ -1,6 +1,6 @@ 'string', 'warning' => 'bool', 'message' => 'string', - 'tokens' => 'array[]' + 'tokens' => 'array[]' ]; /** @@ -304,7 +304,7 @@ public function setMessage($message) /** * Gets tokens * - * @return array[] + * @return array[] */ public function getTokens() { @@ -314,7 +314,7 @@ public function getTokens() /** * Sets tokens * - * @param array[] $tokens tokens + * @param array[] $tokens tokens * * @return self */ diff --git a/lib/Model/VclSyntaxHighlightingResponse.php b/lib/Model/VclSyntaxHighlightingResponse.php new file mode 100644 index 00000000..c97b5d09 --- /dev/null +++ b/lib/Model/VclSyntaxHighlightingResponse.php @@ -0,0 +1,314 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class VclSyntaxHighlightingResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'vcl_syntax_highlighting_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'content' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'content' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyTypes() + { + return self::$fastlyTypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function fastlyFormats() + { + return self::$fastlyFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'content' => 'content' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'content' => 'setContent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'content' => 'getContent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$fastlyModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['content'] = $data['content'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets content + * + * @return string|null + */ + public function getContent() + { + return $this->container['content']; + } + + /** + * Sets content + * + * @param string|null $content VCL with HTML syntax highlighting. + * + * @return self + */ + public function setContent($content) + { + $this->container['content'] = $content; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/sig.json b/sig.json index 9248d1ce..452166f5 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "4f949974", "D": "92c7d13f"} +{"G": "1737d053", "D": "d944a1e9"}