diff --git a/CHANGELOG.md b/CHANGELOG.md index 6638dfe7..e56c8a60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [v2.1.0](https://github.com/fastly/fastly-php/releases/tag/release/v2.1.0) (2023-05-17) + +**Enhancements:** + +- feat(config_store): add Config Store endpoints. + ## [v2.0.0](https://github.com/fastly/fastly-php/releases/tag/release/v2.0.0) (2023-05-16) **Breaking changes:** diff --git a/README.md b/README.md index d81d337d..0acb7de6 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,20 @@ Class | Method | Description [*ConditionApi*](docs/Api/ConditionApi.md) | [**getCondition**](docs/Api/ConditionApi.md#getcondition) | Describe a condition [*ConditionApi*](docs/Api/ConditionApi.md) | [**listConditions**](docs/Api/ConditionApi.md#listconditions) | List conditions [*ConditionApi*](docs/Api/ConditionApi.md) | [**updateCondition**](docs/Api/ConditionApi.md#updatecondition) | Update a condition +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**createConfigStore**](docs/Api/ConfigStoreApi.md#createconfigstore) | Create a config store +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**deleteConfigStore**](docs/Api/ConfigStoreApi.md#deleteconfigstore) | Delete a config store +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**getConfigStore**](docs/Api/ConfigStoreApi.md#getconfigstore) | Describe a config store +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**getConfigStoreInfo**](docs/Api/ConfigStoreApi.md#getconfigstoreinfo) | Get config store metadata +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**listConfigStoreServices**](docs/Api/ConfigStoreApi.md#listconfigstoreservices) | List linked services +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**listConfigStores**](docs/Api/ConfigStoreApi.md#listconfigstores) | List config stores +[*ConfigStoreApi*](docs/Api/ConfigStoreApi.md) | [**updateConfigStore**](docs/Api/ConfigStoreApi.md#updateconfigstore) | Update a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**bulkUpdateConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#bulkupdateconfigstoreitem) | Update multiple entries in a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**createConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#createconfigstoreitem) | Create an entry in a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**deleteConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#deleteconfigstoreitem) | Delete an item from a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**getConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#getconfigstoreitem) | Get an item from a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**listConfigStoreItems**](docs/Api/ConfigStoreItemApi.md#listconfigstoreitems) | List items in a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**updateConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#updateconfigstoreitem) | Update an entry in a config store +[*ConfigStoreItemApi*](docs/Api/ConfigStoreItemApi.md) | [**upsertConfigStoreItem**](docs/Api/ConfigStoreItemApi.md#upsertconfigstoreitem) | Insert or update an entry in a config store [*ContactApi*](docs/Api/ContactApi.md) | [**deleteContact**](docs/Api/ContactApi.md#deletecontact) | Delete a contact [*ContactApi*](docs/Api/ContactApi.md) | [**listContacts**](docs/Api/ContactApi.md#listcontacts) | List contacts [*ContentApi*](docs/Api/ContentApi.md) | [**contentCheck**](docs/Api/ContentApi.md#contentcheck) | Check status of content in each POP's cache @@ -517,13 +531,6 @@ The fastly-php API client currently does not support the following endpoints: - [`/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) - [`/rate-limiters/{rate_limiter_id}`](https://developer.fastly.com/reference/api/vcl-services/rate-limiter) (PUT) -- [`/resources/stores/config/{config_store_id}/info`](https://developer.fastly.com/reference/api/services/resources/config-store) (GET) -- [`/resources/stores/config/{config_store_id}/item/{config_store_item_key}`](https://developer.fastly.com/reference/api/services/resources/config-store-item) (DELETE, GET, PATCH, PUT) -- [`/resources/stores/config/{config_store_id}/item`](https://developer.fastly.com/reference/api/services/resources/config-store-item) (POST) -- [`/resources/stores/config/{config_store_id}/items`](https://developer.fastly.com/reference/api/services/resources/config-store-item) (GET, PATCH) -- [`/resources/stores/config/{config_store_id}/services`](https://developer.fastly.com/reference/api/services/resources/config-store) (GET) -- [`/resources/stores/config/{config_store_id}`](https://developer.fastly.com/reference/api/services/resources/config-store) (DELETE, GET, PUT) -- [`/resources/stores/config`](https://developer.fastly.com/reference/api/services/resources/config-store) (GET, POST) - [`/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/ConfigStoreApi.md b/docs/Api/ConfigStoreApi.md new file mode 100644 index 00000000..9a6ce4e7 --- /dev/null +++ b/docs/Api/ConfigStoreApi.md @@ -0,0 +1,261 @@ +# Fastly\Api\ConfigStoreApi + + +```php +$apiInstance = new Fastly\Api\ConfigStoreApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +``` + +## Methods + +Method | Fastly API endpoint | Description +------------- | ------------- | ------------- +[**createConfigStore()**](ConfigStoreApi.md#createConfigStore) | **POST** /resources/stores/config | Create a config store +[**deleteConfigStore()**](ConfigStoreApi.md#deleteConfigStore) | **DELETE** /resources/stores/config/{config_store_id} | Delete a config store +[**getConfigStore()**](ConfigStoreApi.md#getConfigStore) | **GET** /resources/stores/config/{config_store_id} | Describe a config store +[**getConfigStoreInfo()**](ConfigStoreApi.md#getConfigStoreInfo) | **GET** /resources/stores/config/{config_store_id}/info | Get config store metadata +[**listConfigStoreServices()**](ConfigStoreApi.md#listConfigStoreServices) | **GET** /resources/stores/config/{config_store_id}/services | List linked services +[**listConfigStores()**](ConfigStoreApi.md#listConfigStores) | **GET** /resources/stores/config | List config stores +[**updateConfigStore()**](ConfigStoreApi.md#updateConfigStore) | **PUT** /resources/stores/config/{config_store_id} | Update a config store + + +## `createConfigStore()` + +```php +createConfigStore($options): \Fastly\Model\ConfigStoreResponse // Create a config store +``` + +Create a config store. + +### Example +```php + $options['name'] = 'name_example'; // string | The name of the config store. + +try { + $result = $apiInstance->createConfigStore($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->createConfigStore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**name** | **string** | The name of the config store. | [optional] + +### Return type + +[**\Fastly\Model\ConfigStoreResponse**](../Model/ConfigStoreResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `deleteConfigStore()` + +```php +deleteConfigStore($options): \Fastly\Model\InlineResponse200 // Delete a config store +``` + +Delete a config store. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. + +try { + $result = $apiInstance->deleteConfigStore($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->deleteConfigStore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | + +### Return type + +[**\Fastly\Model\InlineResponse200**](../Model/InlineResponse200.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `getConfigStore()` + +```php +getConfigStore($options): \Fastly\Model\ConfigStoreResponse // Describe a config store +``` + +Describe a config store by its identifier. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. + +try { + $result = $apiInstance->getConfigStore($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->getConfigStore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | + +### Return type + +[**\Fastly\Model\ConfigStoreResponse**](../Model/ConfigStoreResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `getConfigStoreInfo()` + +```php +getConfigStoreInfo($options): \Fastly\Model\ConfigStoreInfoResponse // Get config store metadata +``` + +Retrieve metadata for a single config store. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. + +try { + $result = $apiInstance->getConfigStoreInfo($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->getConfigStoreInfo: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | + +### Return type + +[**\Fastly\Model\ConfigStoreInfoResponse**](../Model/ConfigStoreInfoResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `listConfigStoreServices()` + +```php +listConfigStoreServices($options): object // List linked services +``` + +List services linked to a config store + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. + +try { + $result = $apiInstance->listConfigStoreServices($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->listConfigStoreServices: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | + +### Return type + +**object** + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `listConfigStores()` + +```php +listConfigStores($options): \Fastly\Model\ConfigStoreResponse[] // List config stores +``` + +List config stores. + +### Example +```php + +try { + $result = $apiInstance->listConfigStores($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->listConfigStores: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +This endpoint does not need any parameters. + +### Return type + +[**\Fastly\Model\ConfigStoreResponse[]**](../Model/ConfigStoreResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `updateConfigStore()` + +```php +updateConfigStore($options): \Fastly\Model\ConfigStoreResponse // Update a config store +``` + +Update a config store. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['name'] = 'name_example'; // string | The name of the config store. + +try { + $result = $apiInstance->updateConfigStore($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreApi->updateConfigStore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**name** | **string** | The name of the config store. | [optional] + +### Return type + +[**\Fastly\Model\ConfigStoreResponse**](../Model/ConfigStoreResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/Api/ConfigStoreItemApi.md b/docs/Api/ConfigStoreItemApi.md new file mode 100644 index 00000000..9e79284d --- /dev/null +++ b/docs/Api/ConfigStoreItemApi.md @@ -0,0 +1,284 @@ +# Fastly\Api\ConfigStoreItemApi + + +```php +$apiInstance = new Fastly\Api\ConfigStoreItemApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +``` + +## Methods + +Method | Fastly API endpoint | Description +------------- | ------------- | ------------- +[**bulkUpdateConfigStoreItem()**](ConfigStoreItemApi.md#bulkUpdateConfigStoreItem) | **PATCH** /resources/stores/config/{config_store_id}/items | Update multiple entries in a config store +[**createConfigStoreItem()**](ConfigStoreItemApi.md#createConfigStoreItem) | **POST** /resources/stores/config/{config_store_id}/item | Create an entry in a config store +[**deleteConfigStoreItem()**](ConfigStoreItemApi.md#deleteConfigStoreItem) | **DELETE** /resources/stores/config/{config_store_id}/item/{config_store_item_key} | Delete an item from a config store +[**getConfigStoreItem()**](ConfigStoreItemApi.md#getConfigStoreItem) | **GET** /resources/stores/config/{config_store_id}/item/{config_store_item_key} | Get an item from a config store +[**listConfigStoreItems()**](ConfigStoreItemApi.md#listConfigStoreItems) | **GET** /resources/stores/config/{config_store_id}/items | List items in a config store +[**updateConfigStoreItem()**](ConfigStoreItemApi.md#updateConfigStoreItem) | **PATCH** /resources/stores/config/{config_store_id}/item/{config_store_item_key} | Update an entry in a config store +[**upsertConfigStoreItem()**](ConfigStoreItemApi.md#upsertConfigStoreItem) | **PUT** /resources/stores/config/{config_store_id}/item/{config_store_item_key} | Insert or update an entry in a config store + + +## `bulkUpdateConfigStoreItem()` + +```php +bulkUpdateConfigStoreItem($options): \Fastly\Model\InlineResponse200 // Update multiple entries in a config store +``` + +Add multiple key-value pairs to an individual config store, specified by ID. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['bulk_update_config_store_list_request'] = {"items":[{"op":"create","item_key":"test-key","item_value":"new-value"},{"op":"update","item_key":"test-key-2","item_value":"new-value-2"},{"op":"upsert","item_key":"test-key-3","item_value":"new-value-3"},{"op":"delete","item_key":"test-key-4"}]}; // \Fastly\Model\BulkUpdateConfigStoreListRequest + +try { + $result = $apiInstance->bulkUpdateConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->bulkUpdateConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**bulk_update_config_store_list_request** | [**\Fastly\Model\BulkUpdateConfigStoreListRequest**](../Model/BulkUpdateConfigStoreListRequest.md) | | [optional] + +### Return type + +[**\Fastly\Model\InlineResponse200**](../Model/InlineResponse200.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `createConfigStoreItem()` + +```php +createConfigStoreItem($options): \Fastly\Model\ConfigStoreItemResponse // Create an entry in a config store +``` + +Add a single key-value pair to an individual config store, specified by ID. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['item_key'] = 'item_key_example'; // string | Item key, maximum 256 characters. +$options['item_value'] = 'item_value_example'; // string | Item value, maximum 8000 characters. + +try { + $result = $apiInstance->createConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->createConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] + +### Return type + +[**\Fastly\Model\ConfigStoreItemResponse**](../Model/ConfigStoreItemResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `deleteConfigStoreItem()` + +```php +deleteConfigStoreItem($options): \Fastly\Model\InlineResponse200 // Delete an item from a config store +``` + +Delete an entry in a config store given a config store ID, and item key. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['config_store_item_key'] = 'config_store_item_key_example'; // string | Item key, maximum 256 characters. + +try { + $result = $apiInstance->deleteConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->deleteConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**config_store_item_key** | **string** | Item key, maximum 256 characters. | + +### Return type + +[**\Fastly\Model\InlineResponse200**](../Model/InlineResponse200.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `getConfigStoreItem()` + +```php +getConfigStoreItem($options): \Fastly\Model\ConfigStoreItemResponse // Get an item from a config store +``` + +Retrieve a config store entry given a config store ID and item key. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['config_store_item_key'] = 'config_store_item_key_example'; // string | Item key, maximum 256 characters. + +try { + $result = $apiInstance->getConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->getConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**config_store_item_key** | **string** | Item key, maximum 256 characters. | + +### Return type + +[**\Fastly\Model\ConfigStoreItemResponse**](../Model/ConfigStoreItemResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `listConfigStoreItems()` + +```php +listConfigStoreItems($options): \Fastly\Model\ConfigStoreItemResponse[] // List items in a config store +``` + +List the key-value pairs associated with a given config store ID. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. + +try { + $result = $apiInstance->listConfigStoreItems($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->listConfigStoreItems: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | + +### Return type + +[**\Fastly\Model\ConfigStoreItemResponse[]**](../Model/ConfigStoreItemResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `updateConfigStoreItem()` + +```php +updateConfigStoreItem($options): \Fastly\Model\ConfigStoreItemResponse // Update an entry in a config store +``` + +Update an entry in a config store given a config store ID, item key, and item value. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['config_store_item_key'] = 'config_store_item_key_example'; // string | Item key, maximum 256 characters. +$options['item_key'] = 'item_key_example'; // string | Item key, maximum 256 characters. +$options['item_value'] = 'item_value_example'; // string | Item value, maximum 8000 characters. + +try { + $result = $apiInstance->updateConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->updateConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**config_store_item_key** | **string** | Item key, maximum 256 characters. | +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] + +### Return type + +[**\Fastly\Model\ConfigStoreItemResponse**](../Model/ConfigStoreItemResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) + +## `upsertConfigStoreItem()` + +```php +upsertConfigStoreItem($options): \Fastly\Model\ConfigStoreItemResponse // Insert or update an entry in a config store +``` + +Insert or update an entry in a config store given a config store ID, item key, and item value. + +### Example +```php + $options['config_store_id'] = 'config_store_id_example'; // string | An alphanumeric string identifying the config store. +$options['config_store_item_key'] = 'config_store_item_key_example'; // string | Item key, maximum 256 characters. +$options['item_key'] = 'item_key_example'; // string | Item key, maximum 256 characters. +$options['item_value'] = 'item_value_example'; // string | Item value, maximum 8000 characters. + +try { + $result = $apiInstance->upsertConfigStoreItem($options); +} catch (Exception $e) { + echo 'Exception when calling ConfigStoreItemApi->upsertConfigStoreItem: ', $e->getMessage(), PHP_EOL; +} +``` + +### Options + +Note: the input parameter is an associative array with the keys listed below. + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**config_store_id** | **string** | An alphanumeric string identifying the config store. | +**config_store_item_key** | **string** | Item key, maximum 256 characters. | +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] + +### Return type + +[**\Fastly\Model\ConfigStoreItemResponse**](../Model/ConfigStoreItemResponse.md) + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to README]](../../README.md) diff --git a/docs/Model/BulkUpdateConfigStoreItem.md b/docs/Model/BulkUpdateConfigStoreItem.md new file mode 100644 index 00000000..d1680134 --- /dev/null +++ b/docs/Model/BulkUpdateConfigStoreItem.md @@ -0,0 +1,12 @@ +# # BulkUpdateConfigStoreItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] +**op** | **string** | | [optional] [one of: 'create', 'update', 'delete', 'upsert'] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/BulkUpdateDictionaryItemAllOf.md b/docs/Model/BulkUpdateConfigStoreItemAllOf.md similarity index 88% rename from docs/Model/BulkUpdateDictionaryItemAllOf.md rename to docs/Model/BulkUpdateConfigStoreItemAllOf.md index 42ba2cb5..9a679d12 100644 --- a/docs/Model/BulkUpdateDictionaryItemAllOf.md +++ b/docs/Model/BulkUpdateConfigStoreItemAllOf.md @@ -1,4 +1,4 @@ -# # BulkUpdateDictionaryItemAllOf +# # BulkUpdateConfigStoreItemAllOf ## Properties diff --git a/docs/Model/BulkUpdateConfigStoreListRequest.md b/docs/Model/BulkUpdateConfigStoreListRequest.md new file mode 100644 index 00000000..03e76dd0 --- /dev/null +++ b/docs/Model/BulkUpdateConfigStoreListRequest.md @@ -0,0 +1,10 @@ +# # BulkUpdateConfigStoreListRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**items** | [**\Fastly\Model\BulkUpdateConfigStoreItem[]**](BulkUpdateConfigStoreItem.md) | | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStore.md b/docs/Model/ConfigStore.md new file mode 100644 index 00000000..1744b6a4 --- /dev/null +++ b/docs/Model/ConfigStore.md @@ -0,0 +1,10 @@ +# # ConfigStore + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | The name of the config store. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreInfoResponse.md b/docs/Model/ConfigStoreInfoResponse.md new file mode 100644 index 00000000..c4b05297 --- /dev/null +++ b/docs/Model/ConfigStoreInfoResponse.md @@ -0,0 +1,10 @@ +# # ConfigStoreInfoResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_count** | **int** | The number of items currently in the config store. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreItem.md b/docs/Model/ConfigStoreItem.md new file mode 100644 index 00000000..62ae8a85 --- /dev/null +++ b/docs/Model/ConfigStoreItem.md @@ -0,0 +1,11 @@ +# # ConfigStoreItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreItemResponse.md b/docs/Model/ConfigStoreItemResponse.md new file mode 100644 index 00000000..f3871962 --- /dev/null +++ b/docs/Model/ConfigStoreItemResponse.md @@ -0,0 +1,15 @@ +# # ConfigStoreItemResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**item_key** | **string** | Item key, maximum 256 characters. | [optional] +**item_value** | **string** | Item value, maximum 8000 characters. | [optional] +**created_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**deleted_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**updated_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**store_id** | **string** | | [optional] [readonly] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreItemResponseAllOf.md b/docs/Model/ConfigStoreItemResponseAllOf.md new file mode 100644 index 00000000..ab96cacb --- /dev/null +++ b/docs/Model/ConfigStoreItemResponseAllOf.md @@ -0,0 +1,10 @@ +# # ConfigStoreItemResponseAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**store_id** | **string** | | [optional] [readonly] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreResponse.md b/docs/Model/ConfigStoreResponse.md new file mode 100644 index 00000000..39e715ab --- /dev/null +++ b/docs/Model/ConfigStoreResponse.md @@ -0,0 +1,14 @@ +# # ConfigStoreResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**created_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**deleted_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**updated_at** | **\DateTime** | Date and time in ISO 8601 format. | [optional] [readonly] +**name** | **string** | The name of the config store. | [optional] +**id** | **string** | An alphanumeric string identifying the config store. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/ConfigStoreResponseAllOf.md b/docs/Model/ConfigStoreResponseAllOf.md new file mode 100644 index 00000000..1d62820e --- /dev/null +++ b/docs/Model/ConfigStoreResponseAllOf.md @@ -0,0 +1,10 @@ +# # ConfigStoreResponseAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | An alphanumeric string identifying the config store. | [optional] + + +[[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/lib/Api/ConfigStoreApi.php b/lib/Api/ConfigStoreApi.php new file mode 100644 index 00000000..a2972351 --- /dev/null +++ b/lib/Api/ConfigStoreApi.php @@ -0,0 +1,2217 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation createConfigStore + * + * Create a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $name The name of the config store. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreResponse + */ + public function createConfigStore($options) + { + list($response) = $this->createConfigStoreWithHttpInfo($options); + return $response; + } + + /** + * Operation createConfigStoreWithHttpInfo + * + * Create a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $name The name of the config store. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createConfigStoreWithHttpInfo($options) + { + $request = $this->createConfigStoreRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('POST' != 'GET' && 'POST' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreResponse'; + 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\ConfigStoreResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createConfigStoreAsync + * + * Create a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createConfigStoreAsync($options) + { + return $this->createConfigStoreAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createConfigStoreAsyncWithHttpInfo + * + * Create a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createConfigStoreAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreResponse'; + $request = $this->createConfigStoreRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createConfigStore' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createConfigStoreRequest($options) + { + // unbox the parameters from the associative array + $name = array_key_exists('name', $options) ? $options['name'] : null; + + + $resourcePath = '/resources/stores/config'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // form params + if ($name !== null) { + $formParams['name'] = ObjectSerializer::toFormValue($name); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteConfigStore + * + * Delete a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\InlineResponse200 + */ + public function deleteConfigStore($options) + { + list($response) = $this->deleteConfigStoreWithHttpInfo($options); + return $response; + } + + /** + * Operation deleteConfigStoreWithHttpInfo + * + * Delete a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteConfigStoreWithHttpInfo($options) + { + $request = $this->deleteConfigStoreRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('DELETE' != 'GET' && 'DELETE' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\InlineResponse200'; + 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\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteConfigStoreAsync + * + * Delete a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteConfigStoreAsync($options) + { + return $this->deleteConfigStoreAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteConfigStoreAsyncWithHttpInfo + * + * Delete a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteConfigStoreAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\InlineResponse200'; + $request = $this->deleteConfigStoreRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteConfigStore' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteConfigStoreRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling deleteConfigStore' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getConfigStore + * + * Describe a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreResponse + */ + public function getConfigStore($options) + { + list($response) = $this->getConfigStoreWithHttpInfo($options); + return $response; + } + + /** + * Operation getConfigStoreWithHttpInfo + * + * Describe a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getConfigStoreWithHttpInfo($options) + { + $request = $this->getConfigStoreRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreResponse'; + 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\ConfigStoreResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getConfigStoreAsync + * + * Describe a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreAsync($options) + { + return $this->getConfigStoreAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConfigStoreAsyncWithHttpInfo + * + * Describe a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreResponse'; + $request = $this->getConfigStoreRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConfigStore' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConfigStoreRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling getConfigStore' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getConfigStoreInfo + * + * Get config store metadata + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreInfoResponse + */ + public function getConfigStoreInfo($options) + { + list($response) = $this->getConfigStoreInfoWithHttpInfo($options); + return $response; + } + + /** + * Operation getConfigStoreInfoWithHttpInfo + * + * Get config store metadata + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreInfoResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getConfigStoreInfoWithHttpInfo($options) + { + $request = $this->getConfigStoreInfoRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreInfoResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreInfoResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreInfoResponse'; + 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\ConfigStoreInfoResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getConfigStoreInfoAsync + * + * Get config store metadata + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreInfoAsync($options) + { + return $this->getConfigStoreInfoAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConfigStoreInfoAsyncWithHttpInfo + * + * Get config store metadata + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreInfoAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreInfoResponse'; + $request = $this->getConfigStoreInfoRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConfigStoreInfo' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConfigStoreInfoRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling getConfigStoreInfo' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/info'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listConfigStoreServices + * + * List linked services + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return object + */ + public function listConfigStoreServices($options) + { + list($response) = $this->listConfigStoreServicesWithHttpInfo($options); + return $response; + } + + /** + * Operation listConfigStoreServicesWithHttpInfo + * + * List linked services + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of object, HTTP status code, HTTP response headers (array of strings) + */ + public function listConfigStoreServicesWithHttpInfo($options) + { + $request = $this->listConfigStoreServicesRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + 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(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listConfigStoreServicesAsync + * + * List linked services + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoreServicesAsync($options) + { + return $this->listConfigStoreServicesAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listConfigStoreServicesAsyncWithHttpInfo + * + * List linked services + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoreServicesAsyncWithHttpInfo($options) + { + $returnType = 'object'; + $request = $this->listConfigStoreServicesRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listConfigStoreServices' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listConfigStoreServicesRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling listConfigStoreServices' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/services'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listConfigStores + * + * List config stores + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreResponse[] + */ + public function listConfigStores($options) + { + list($response) = $this->listConfigStoresWithHttpInfo($options); + return $response; + } + + /** + * Operation listConfigStoresWithHttpInfo + * + * List config stores + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreResponse[], HTTP status code, HTTP response headers (array of strings) + */ + public function listConfigStoresWithHttpInfo($options) + { + $request = $this->listConfigStoresRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreResponse[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreResponse[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreResponse[]'; + 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\ConfigStoreResponse[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listConfigStoresAsync + * + * List config stores + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoresAsync($options) + { + return $this->listConfigStoresAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listConfigStoresAsyncWithHttpInfo + * + * List config stores + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoresAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreResponse[]'; + $request = $this->listConfigStoresRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listConfigStores' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listConfigStoresRequest($options) + { + // unbox the parameters from the associative array + + + $resourcePath = '/resources/stores/config'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateConfigStore + * + * Update a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $name The name of the config store. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreResponse + */ + public function updateConfigStore($options) + { + list($response) = $this->updateConfigStoreWithHttpInfo($options); + return $response; + } + + /** + * Operation updateConfigStoreWithHttpInfo + * + * Update a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $name The name of the config store. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateConfigStoreWithHttpInfo($options) + { + $request = $this->updateConfigStoreRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('PUT' != 'GET' && 'PUT' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreResponse'; + 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\ConfigStoreResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateConfigStoreAsync + * + * Update a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateConfigStoreAsync($options) + { + return $this->updateConfigStoreAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateConfigStoreAsyncWithHttpInfo + * + * Update a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateConfigStoreAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreResponse'; + $request = $this->updateConfigStoreRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateConfigStore' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $name The name of the config store. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateConfigStoreRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $name = array_key_exists('name', $options) ? $options['name'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling updateConfigStore' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + // form params + if ($name !== null) { + $formParams['name'] = ObjectSerializer::toFormValue($name); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Api/ConfigStoreItemApi.php b/lib/Api/ConfigStoreItemApi.php new file mode 100644 index 00000000..b70e8d5c --- /dev/null +++ b/lib/Api/ConfigStoreItemApi.php @@ -0,0 +1,2389 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation bulkUpdateConfigStoreItem + * + * Update multiple entries in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param \Fastly\Model\BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request bulk_update_config_store_list_request (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\InlineResponse200 + */ + public function bulkUpdateConfigStoreItem($options) + { + list($response) = $this->bulkUpdateConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation bulkUpdateConfigStoreItemWithHttpInfo + * + * Update multiple entries in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param \Fastly\Model\BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function bulkUpdateConfigStoreItemWithHttpInfo($options) + { + $request = $this->bulkUpdateConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('PATCH' != 'GET' && 'PATCH' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\InlineResponse200'; + 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\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation bulkUpdateConfigStoreItemAsync + * + * Update multiple entries in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param \Fastly\Model\BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkUpdateConfigStoreItemAsync($options) + { + return $this->bulkUpdateConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation bulkUpdateConfigStoreItemAsyncWithHttpInfo + * + * Update multiple entries in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param \Fastly\Model\BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function bulkUpdateConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\InlineResponse200'; + $request = $this->bulkUpdateConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'bulkUpdateConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param \Fastly\Model\BulkUpdateConfigStoreListRequest $bulk_update_config_store_list_request (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function bulkUpdateConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $bulk_update_config_store_list_request = array_key_exists('bulk_update_config_store_list_request', $options) ? $options['bulk_update_config_store_list_request'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling bulkUpdateConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/items'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($bulk_update_config_store_list_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($bulk_update_config_store_list_request)); + } else { + $httpBody = $bulk_update_config_store_list_request; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation createConfigStoreItem + * + * Create an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreItemResponse + */ + public function createConfigStoreItem($options) + { + list($response) = $this->createConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation createConfigStoreItemWithHttpInfo + * + * Create an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreItemResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function createConfigStoreItemWithHttpInfo($options) + { + $request = $this->createConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('POST' != 'GET' && 'POST' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreItemResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreItemResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + 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\ConfigStoreItemResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation createConfigStoreItemAsync + * + * Create an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createConfigStoreItemAsync($options) + { + return $this->createConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation createConfigStoreItemAsyncWithHttpInfo + * + * Create an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function createConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + $request = $this->createConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'createConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function createConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $item_key = array_key_exists('item_key', $options) ? $options['item_key'] : null; + $item_value = array_key_exists('item_value', $options) ? $options['item_value'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling createConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/item'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + // form params + if ($item_key !== null) { + $formParams['item_key'] = ObjectSerializer::toFormValue($item_key); + } + // form params + if ($item_value !== null) { + $formParams['item_value'] = ObjectSerializer::toFormValue($item_value); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation deleteConfigStoreItem + * + * Delete an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\InlineResponse200 + */ + public function deleteConfigStoreItem($options) + { + list($response) = $this->deleteConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation deleteConfigStoreItemWithHttpInfo + * + * Delete an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) + */ + public function deleteConfigStoreItemWithHttpInfo($options) + { + $request = $this->deleteConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('DELETE' != 'GET' && 'DELETE' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\InlineResponse200' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\InlineResponse200', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\InlineResponse200'; + 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\InlineResponse200', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation deleteConfigStoreItemAsync + * + * Delete an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteConfigStoreItemAsync($options) + { + return $this->deleteConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation deleteConfigStoreItemAsyncWithHttpInfo + * + * Delete an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function deleteConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\InlineResponse200'; + $request = $this->deleteConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'deleteConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function deleteConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $config_store_item_key = array_key_exists('config_store_item_key', $options) ? $options['config_store_item_key'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling deleteConfigStoreItem' + ); + } + // verify the required parameter 'config_store_item_key' is set + if ($config_store_item_key === null || (is_array($config_store_item_key) && count($config_store_item_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_item_key when calling deleteConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + // path params + if ($config_store_item_key !== null) { + $resourcePath = str_replace( + '{' . 'config_store_item_key' . '}', + ObjectSerializer::toPathValue($config_store_item_key), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'DELETE', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getConfigStoreItem + * + * Get an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreItemResponse + */ + public function getConfigStoreItem($options) + { + list($response) = $this->getConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation getConfigStoreItemWithHttpInfo + * + * Get an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreItemResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function getConfigStoreItemWithHttpInfo($options) + { + $request = $this->getConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreItemResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreItemResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + 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\ConfigStoreItemResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getConfigStoreItemAsync + * + * Get an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreItemAsync($options) + { + return $this->getConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getConfigStoreItemAsyncWithHttpInfo + * + * Get an item from a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + $request = $this->getConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'getConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $config_store_item_key = array_key_exists('config_store_item_key', $options) ? $options['config_store_item_key'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling getConfigStoreItem' + ); + } + // verify the required parameter 'config_store_item_key' is set + if ($config_store_item_key === null || (is_array($config_store_item_key) && count($config_store_item_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_item_key when calling getConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + // path params + if ($config_store_item_key !== null) { + $resourcePath = str_replace( + '{' . 'config_store_item_key' . '}', + ObjectSerializer::toPathValue($config_store_item_key), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listConfigStoreItems + * + * List items in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreItemResponse[] + */ + public function listConfigStoreItems($options) + { + list($response) = $this->listConfigStoreItemsWithHttpInfo($options); + return $response; + } + + /** + * Operation listConfigStoreItemsWithHttpInfo + * + * List items in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreItemResponse[], HTTP status code, HTTP response headers (array of strings) + */ + public function listConfigStoreItemsWithHttpInfo($options) + { + $request = $this->listConfigStoreItemsRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('GET' != 'GET' && 'GET' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreItemResponse[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreItemResponse[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreItemResponse[]'; + 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\ConfigStoreItemResponse[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listConfigStoreItemsAsync + * + * List items in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoreItemsAsync($options) + { + return $this->listConfigStoreItemsAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listConfigStoreItemsAsyncWithHttpInfo + * + * List items in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listConfigStoreItemsAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreItemResponse[]'; + $request = $this->listConfigStoreItemsRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'listConfigStoreItems' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listConfigStoreItemsRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling listConfigStoreItems' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/items'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateConfigStoreItem + * + * Update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreItemResponse + */ + public function updateConfigStoreItem($options) + { + list($response) = $this->updateConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation updateConfigStoreItemWithHttpInfo + * + * Update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreItemResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function updateConfigStoreItemWithHttpInfo($options) + { + $request = $this->updateConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('PATCH' != 'GET' && 'PATCH' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreItemResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreItemResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + 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\ConfigStoreItemResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateConfigStoreItemAsync + * + * Update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateConfigStoreItemAsync($options) + { + return $this->updateConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateConfigStoreItemAsyncWithHttpInfo + * + * Update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + $request = $this->updateConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'updateConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $config_store_item_key = array_key_exists('config_store_item_key', $options) ? $options['config_store_item_key'] : null; + $item_key = array_key_exists('item_key', $options) ? $options['item_key'] : null; + $item_value = array_key_exists('item_value', $options) ? $options['item_value'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling updateConfigStoreItem' + ); + } + // verify the required parameter 'config_store_item_key' is set + if ($config_store_item_key === null || (is_array($config_store_item_key) && count($config_store_item_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_item_key when calling updateConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + // path params + if ($config_store_item_key !== null) { + $resourcePath = str_replace( + '{' . 'config_store_item_key' . '}', + ObjectSerializer::toPathValue($config_store_item_key), + $resourcePath + ); + } + + // form params + if ($item_key !== null) { + $formParams['item_key'] = ObjectSerializer::toFormValue($item_key); + } + // form params + if ($item_value !== null) { + $formParams['item_value'] = ObjectSerializer::toFormValue($item_value); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upsertConfigStoreItem + * + * Insert or update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Fastly\Model\ConfigStoreItemResponse + */ + public function upsertConfigStoreItem($options) + { + list($response) = $this->upsertConfigStoreItemWithHttpInfo($options); + return $response; + } + + /** + * Operation upsertConfigStoreItemWithHttpInfo + * + * Insert or update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \Fastly\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Fastly\Model\ConfigStoreItemResponse, HTTP status code, HTTP response headers (array of strings) + */ + public function upsertConfigStoreItemWithHttpInfo($options) + { + $request = $this->upsertConfigStoreItemRequest($options); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + if ('PUT' != 'GET' && 'PUT' != 'HEAD') { + $header = $response->getHeader('Fastly-RateLimit-Remaining'); + if (count($header) > 0) { + $this->config->setRateLimitRemaining($header[0]); + } + + $header = $response->getHeader('Fastly-RateLimit-Reset'); + if (count($header) > 0) { + $this->config->setRateLimitReset($header[0]); + } + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 200: + if ('\Fastly\Model\ConfigStoreItemResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, '\Fastly\Model\ConfigStoreItemResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + 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\ConfigStoreItemResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upsertConfigStoreItemAsync + * + * Insert or update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertConfigStoreItemAsync($options) + { + return $this->upsertConfigStoreItemAsyncWithHttpInfo($options) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upsertConfigStoreItemAsyncWithHttpInfo + * + * Insert or update an entry in a config store + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upsertConfigStoreItemAsyncWithHttpInfo($options) + { + $returnType = '\Fastly\Model\ConfigStoreItemResponse'; + $request = $this->upsertConfigStoreItemRequest($options); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upsertConfigStoreItem' + * + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * + * @param string $config_store_id An alphanumeric string identifying the config store. (required) + * @param string $config_store_item_key Item key, maximum 256 characters. (required) + * @param string $item_key Item key, maximum 256 characters. (optional) + * @param string $item_value Item value, maximum 8000 characters. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function upsertConfigStoreItemRequest($options) + { + // unbox the parameters from the associative array + $config_store_id = array_key_exists('config_store_id', $options) ? $options['config_store_id'] : null; + $config_store_item_key = array_key_exists('config_store_item_key', $options) ? $options['config_store_item_key'] : null; + $item_key = array_key_exists('item_key', $options) ? $options['item_key'] : null; + $item_value = array_key_exists('item_value', $options) ? $options['item_value'] : null; + + // verify the required parameter 'config_store_id' is set + if ($config_store_id === null || (is_array($config_store_id) && count($config_store_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_id when calling upsertConfigStoreItem' + ); + } + // verify the required parameter 'config_store_item_key' is set + if ($config_store_item_key === null || (is_array($config_store_item_key) && count($config_store_item_key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $config_store_item_key when calling upsertConfigStoreItem' + ); + } + + $resourcePath = '/resources/stores/config/{config_store_id}/item/{config_store_item_key}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($config_store_id !== null) { + $resourcePath = str_replace( + '{' . 'config_store_id' . '}', + ObjectSerializer::toPathValue($config_store_id), + $resourcePath + ); + } + // path params + if ($config_store_item_key !== null) { + $resourcePath = str_replace( + '{' . 'config_store_item_key' . '}', + ObjectSerializer::toPathValue($config_store_item_key), + $resourcePath + ); + } + + // form params + if ($item_key !== null) { + $formParams['item_key'] = ObjectSerializer::toFormValue($item_key); + } + // form params + if ($item_value !== null) { + $formParams['item_value'] = ObjectSerializer::toFormValue($item_value); + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/x-www-form-urlencoded'] + ); + } + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\Query::build($formParams); + } + } + + // this endpoint requires API token authentication + $apiToken = $this->config->getApiTokenWithPrefix('Fastly-Key'); + if ($apiToken !== null) { + $headers['Fastly-Key'] = $apiToken; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php index 907bf6ff..8ba73fc8 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -89,7 +89,7 @@ class Configuration * * @var string */ - protected $userAgent = 'fastly-php/2.0.0'; + protected $userAgent = 'fastly-php/2.1.0'; /** * 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.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 2.1.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/Model/BulkUpdateConfigStoreItem.php b/lib/Model/BulkUpdateConfigStoreItem.php new file mode 100644 index 00000000..ee597a4d --- /dev/null +++ b/lib/Model/BulkUpdateConfigStoreItem.php @@ -0,0 +1,412 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BulkUpdateConfigStoreItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'bulk_update_config_store_item'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'item_key' => 'string', + 'item_value' => 'string', + 'op' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'item_key' => null, + 'item_value' => null, + 'op' => 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 = [ + 'item_key' => 'item_key', + 'item_value' => 'item_value', + 'op' => 'op' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'item_key' => 'setItemKey', + 'item_value' => 'setItemValue', + 'op' => 'setOp' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_key' => 'getItemKey', + 'item_value' => 'getItemValue', + 'op' => 'getOp' + ]; + + /** + * 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 OP_CREATE = 'create'; + const OP_UPDATE = 'update'; + const OP_DELETE = 'delete'; + const OP_UPSERT = 'upsert'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOpAllowableValues() + { + return [ + self::OP_CREATE, + self::OP_UPDATE, + self::OP_DELETE, + self::OP_UPSERT, + ]; + } + + /** + * 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['item_key'] = $data['item_key'] ?? null; + $this->container['item_value'] = $data['item_value'] ?? null; + $this->container['op'] = $data['op'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getOpAllowableValues(); + if (!is_null($this->container['op']) && !in_array($this->container['op'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'op', must be one of '%s'", + $this->container['op'], + 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 item_key + * + * @return string|null + */ + public function getItemKey() + { + return $this->container['item_key']; + } + + /** + * Sets item_key + * + * @param string|null $item_key Item key, maximum 256 characters. + * + * @return self + */ + public function setItemKey($item_key) + { + $this->container['item_key'] = $item_key; + + return $this; + } + + /** + * Gets item_value + * + * @return string|null + */ + public function getItemValue() + { + return $this->container['item_value']; + } + + /** + * Sets item_value + * + * @param string|null $item_value Item value, maximum 8000 characters. + * + * @return self + */ + public function setItemValue($item_value) + { + $this->container['item_value'] = $item_value; + + return $this; + } + + /** + * Gets op + * + * @return string|null + */ + public function getOp() + { + return $this->container['op']; + } + + /** + * Sets op + * + * @param string|null $op op + * + * @return self + */ + public function setOp($op) + { + $allowedValues = $this->getOpAllowableValues(); + if (!is_null($op) && !in_array($op, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'op', must be one of '%s'", + $op, + implode("', '", $allowedValues) + ) + ); + } + $this->container['op'] = $op; + + 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/BulkUpdateDictionaryItemAllOf.php b/lib/Model/BulkUpdateConfigStoreItemAllOf.php similarity index 96% rename from lib/Model/BulkUpdateDictionaryItemAllOf.php rename to lib/Model/BulkUpdateConfigStoreItemAllOf.php index 89145919..b8019e28 100644 --- a/lib/Model/BulkUpdateDictionaryItemAllOf.php +++ b/lib/Model/BulkUpdateConfigStoreItemAllOf.php @@ -1,6 +1,6 @@ + * @template TKey int|null + * @template TValue mixed|null + */ +class BulkUpdateConfigStoreListRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'bulk_update_config_store_list_request'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'items' => '\Fastly\Model\BulkUpdateConfigStoreItem[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'items' => 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 = [ + 'items' => 'items' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'items' => 'setItems' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'items' => 'getItems' + ]; + + /** + * 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['items'] = $data['items'] ?? 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 items + * + * @return \Fastly\Model\BulkUpdateConfigStoreItem[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Fastly\Model\BulkUpdateConfigStoreItem[]|null $items items + * + * @return self + */ + public function setItems($items) + { + $this->container['items'] = $items; + + 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/ConfigStore.php b/lib/Model/ConfigStore.php new file mode 100644 index 00000000..7f79dd81 --- /dev/null +++ b/lib/Model/ConfigStore.php @@ -0,0 +1,314 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStore implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'name' => 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 = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$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['name'] = $data['name'] ?? 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the config store. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + 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/ConfigStoreInfoResponse.php b/lib/Model/ConfigStoreInfoResponse.php new file mode 100644 index 00000000..4dacf2a2 --- /dev/null +++ b/lib/Model/ConfigStoreInfoResponse.php @@ -0,0 +1,314 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreInfoResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_info_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'item_count' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'item_count' => 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 = [ + 'item_count' => 'item_count' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'item_count' => 'setItemCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_count' => 'getItemCount' + ]; + + /** + * 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['item_count'] = $data['item_count'] ?? 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 item_count + * + * @return int|null + */ + public function getItemCount() + { + return $this->container['item_count']; + } + + /** + * Sets item_count + * + * @param int|null $item_count The number of items currently in the config store. + * + * @return self + */ + public function setItemCount($item_count) + { + $this->container['item_count'] = $item_count; + + 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/ConfigStoreItem.php b/lib/Model/ConfigStoreItem.php new file mode 100644 index 00000000..ff49b242 --- /dev/null +++ b/lib/Model/ConfigStoreItem.php @@ -0,0 +1,344 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_item'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'item_key' => 'string', + 'item_value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'item_key' => null, + 'item_value' => 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 = [ + 'item_key' => 'item_key', + 'item_value' => 'item_value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'item_key' => 'setItemKey', + 'item_value' => 'setItemValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_key' => 'getItemKey', + 'item_value' => 'getItemValue' + ]; + + /** + * 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['item_key'] = $data['item_key'] ?? null; + $this->container['item_value'] = $data['item_value'] ?? 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 item_key + * + * @return string|null + */ + public function getItemKey() + { + return $this->container['item_key']; + } + + /** + * Sets item_key + * + * @param string|null $item_key Item key, maximum 256 characters. + * + * @return self + */ + public function setItemKey($item_key) + { + $this->container['item_key'] = $item_key; + + return $this; + } + + /** + * Gets item_value + * + * @return string|null + */ + public function getItemValue() + { + return $this->container['item_value']; + } + + /** + * Sets item_value + * + * @param string|null $item_value Item value, maximum 8000 characters. + * + * @return self + */ + public function setItemValue($item_value) + { + $this->container['item_value'] = $item_value; + + 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/ConfigStoreItemResponse.php b/lib/Model/ConfigStoreItemResponse.php new file mode 100644 index 00000000..97a51ba5 --- /dev/null +++ b/lib/Model/ConfigStoreItemResponse.php @@ -0,0 +1,464 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreItemResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_item_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'item_key' => 'string', + 'item_value' => 'string', + 'created_at' => '\DateTime', + 'deleted_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'store_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'item_key' => null, + 'item_value' => null, + 'created_at' => 'date-time', + 'deleted_at' => 'date-time', + 'updated_at' => 'date-time', + 'store_id' => 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 = [ + 'item_key' => 'item_key', + 'item_value' => 'item_value', + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'updated_at' => 'updated_at', + 'store_id' => 'store_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'item_key' => 'setItemKey', + 'item_value' => 'setItemValue', + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'updated_at' => 'setUpdatedAt', + 'store_id' => 'setStoreId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'item_key' => 'getItemKey', + 'item_value' => 'getItemValue', + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'updated_at' => 'getUpdatedAt', + 'store_id' => 'getStoreId' + ]; + + /** + * 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['item_key'] = $data['item_key'] ?? null; + $this->container['item_value'] = $data['item_value'] ?? null; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['deleted_at'] = $data['deleted_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['store_id'] = $data['store_id'] ?? 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 item_key + * + * @return string|null + */ + public function getItemKey() + { + return $this->container['item_key']; + } + + /** + * Sets item_key + * + * @param string|null $item_key Item key, maximum 256 characters. + * + * @return self + */ + public function setItemKey($item_key) + { + $this->container['item_key'] = $item_key; + + return $this; + } + + /** + * Gets item_value + * + * @return string|null + */ + public function getItemValue() + { + return $this->container['item_value']; + } + + /** + * Sets item_value + * + * @param string|null $item_value Item value, maximum 8000 characters. + * + * @return self + */ + public function setItemValue($item_value) + { + $this->container['item_value'] = $item_value; + + return $this; + } + + /** + * Gets created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return \DateTime|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param \DateTime|null $deleted_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets store_id + * + * @return string|null + */ + public function getStoreId() + { + return $this->container['store_id']; + } + + /** + * Sets store_id + * + * @param string|null $store_id store_id + * + * @return self + */ + public function setStoreId($store_id) + { + $this->container['store_id'] = $store_id; + + 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/ConfigStoreItemResponseAllOf.php b/lib/Model/ConfigStoreItemResponseAllOf.php new file mode 100644 index 00000000..a7c9a1c4 --- /dev/null +++ b/lib/Model/ConfigStoreItemResponseAllOf.php @@ -0,0 +1,314 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreItemResponseAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_item_response_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'store_id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'store_id' => 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 = [ + 'store_id' => 'store_id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'store_id' => 'setStoreId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'store_id' => 'getStoreId' + ]; + + /** + * 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['store_id'] = $data['store_id'] ?? 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 store_id + * + * @return string|null + */ + public function getStoreId() + { + return $this->container['store_id']; + } + + /** + * Sets store_id + * + * @param string|null $store_id store_id + * + * @return self + */ + public function setStoreId($store_id) + { + $this->container['store_id'] = $store_id; + + 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/ConfigStoreResponse.php b/lib/Model/ConfigStoreResponse.php new file mode 100644 index 00000000..3811ff05 --- /dev/null +++ b/lib/Model/ConfigStoreResponse.php @@ -0,0 +1,434 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_response'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'created_at' => '\DateTime', + 'deleted_at' => '\DateTime', + 'updated_at' => '\DateTime', + 'name' => 'string', + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'created_at' => 'date-time', + 'deleted_at' => 'date-time', + 'updated_at' => 'date-time', + 'name' => null, + 'id' => 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 = [ + 'created_at' => 'created_at', + 'deleted_at' => 'deleted_at', + 'updated_at' => 'updated_at', + 'name' => 'name', + 'id' => 'id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'created_at' => 'setCreatedAt', + 'deleted_at' => 'setDeletedAt', + 'updated_at' => 'setUpdatedAt', + 'name' => 'setName', + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'created_at' => 'getCreatedAt', + 'deleted_at' => 'getDeletedAt', + 'updated_at' => 'getUpdatedAt', + 'name' => 'getName', + 'id' => 'getId' + ]; + + /** + * 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['created_at'] = $data['created_at'] ?? null; + $this->container['deleted_at'] = $data['deleted_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['id'] = $data['id'] ?? 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 created_at + * + * @return \DateTime|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param \DateTime|null $created_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets deleted_at + * + * @return \DateTime|null + */ + public function getDeletedAt() + { + return $this->container['deleted_at']; + } + + /** + * Sets deleted_at + * + * @param \DateTime|null $deleted_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setDeletedAt($deleted_at) + { + $this->container['deleted_at'] = $deleted_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return \DateTime|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param \DateTime|null $updated_at Date and time in ISO 8601 format. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name The name of the config store. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id An alphanumeric string identifying the config store. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + 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/ConfigStoreResponseAllOf.php b/lib/Model/ConfigStoreResponseAllOf.php new file mode 100644 index 00000000..cd05fa56 --- /dev/null +++ b/lib/Model/ConfigStoreResponseAllOf.php @@ -0,0 +1,314 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConfigStoreResponseAllOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $fastlyModelName = 'config_store_response_allOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $fastlyTypes = [ + 'id' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $fastlyFormats = [ + 'id' => 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' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * 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; + } + + /** + * 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 An alphanumeric string identifying the config store. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + 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 177da792..e6814f75 100644 --- a/sig.json +++ b/sig.json @@ -1 +1 @@ -{"G": "fe405794", "D": "07b55669"} +{"G": "4ab3cc8b", "D": "629082c8"}