diff --git a/README.md b/README.md index b6eb74f..031a8ef 100644 --- a/README.md +++ b/README.md @@ -105,14 +105,12 @@ Class | Method | HTTP request | Description *ClientSideApi* | [**listPromotionTiersClientSide**](docs/Api/ClientSideApi.md#listpromotiontiersclientside) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) *ClientSideApi* | [**redeemStackedDiscountsClientSide**](docs/Api/ClientSideApi.md#redeemstackeddiscountsclientside) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) *ClientSideApi* | [**trackCustomEventClientSide**](docs/Api/ClientSideApi.md#trackcustomeventclientside) | **POST** /client/v1/events | Track Custom Event (client-side) -*ClientSideApi* | [**updateCustomersConsentsClientSide**](docs/Api/ClientSideApi.md#updatecustomersconsentsclientside) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) [Deprecated] *ClientSideApi* | [**validateStackedDiscountsClientSide**](docs/Api/ClientSideApi.md#validatestackeddiscountsclientside) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) *CustomersApi* | [**createCustomer**](docs/Api/CustomersApi.md#createcustomer) | **POST** /v1/customers | Create Customer *CustomersApi* | [**customerPermanentlyDeletion**](docs/Api/CustomersApi.md#customerpermanentlydeletion) | **POST** /v1/customers/{customerId}/permanent-deletion | Delete Customer Permanently *CustomersApi* | [**deleteCustomer**](docs/Api/CustomersApi.md#deletecustomer) | **DELETE** /v1/customers/{customerId} | Delete Customer *CustomersApi* | [**getCustomer**](docs/Api/CustomersApi.md#getcustomer) | **GET** /v1/customers/{customerId} | Get Customer *CustomersApi* | [**importCustomersUsingCsv**](docs/Api/CustomersApi.md#importcustomersusingcsv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV -*CustomersApi* | [**listCustomerActivities**](docs/Api/CustomersApi.md#listcustomeractivities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities [Deprecated] *CustomersApi* | [**listCustomerActivity**](docs/Api/CustomersApi.md#listcustomeractivity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity *CustomersApi* | [**listCustomerRedeemables**](docs/Api/CustomersApi.md#listcustomerredeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables *CustomersApi* | [**listCustomerSegments**](docs/Api/CustomersApi.md#listcustomersegments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments @@ -359,7 +357,6 @@ Class | Method | HTTP request | Description - [CustomerWithSummaryLoyaltyReferrals](docs/Model/CustomerWithSummaryLoyaltyReferrals.md) - [CustomerWithSummaryLoyaltyReferralsAddress](docs/Model/CustomerWithSummaryLoyaltyReferralsAddress.md) - [CustomerWithSummaryLoyaltyReferralsAssets](docs/Model/CustomerWithSummaryLoyaltyReferralsAssets.md) -- [CustomersActivitiesListResponseBody](docs/Model/CustomersActivitiesListResponseBody.md) - [CustomersActivityListResponseBody](docs/Model/CustomersActivityListResponseBody.md) - [CustomersCreateRequestBody](docs/Model/CustomersCreateRequestBody.md) - [CustomersCreateRequestBodyAddress](docs/Model/CustomersCreateRequestBodyAddress.md) diff --git a/docs/Api/ClientSideApi.md b/docs/Api/ClientSideApi.md index 78d1844..3471fd6 100644 --- a/docs/Api/ClientSideApi.md +++ b/docs/Api/ClientSideApi.md @@ -8,7 +8,6 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | [**listPromotionTiersClientSide()**](ClientSideApi.md#listPromotionTiersClientSide) | **GET** /client/v1/promotions/tiers | List Promotion Tiers (client-side) | | [**redeemStackedDiscountsClientSide()**](ClientSideApi.md#redeemStackedDiscountsClientSide) | **POST** /client/v1/redemptions | Redeem Stackable Discounts (client-side) | | [**trackCustomEventClientSide()**](ClientSideApi.md#trackCustomEventClientSide) | **POST** /client/v1/events | Track Custom Event (client-side) | -| [**updateCustomersConsentsClientSide()**](ClientSideApi.md#updateCustomersConsentsClientSide) | **PUT** /client/v1/customers/{customerId}/consents | Update Customer's consents (client-side) [Deprecated] | | [**validateStackedDiscountsClientSide()**](ClientSideApi.md#validateStackedDiscountsClientSide) | **POST** /client/v1/validations | Validate Stackable Discounts (client-side) | @@ -292,74 +291,6 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `updateCustomersConsentsClientSide()` - -```php -updateCustomersConsentsClientSide($customer_id, $body) -``` - -Update Customer's consents (client-side) [Deprecated] - -Update marketing permissions for the specified customer. ❗️ Deprecated This endpoint is deprecated. The feature of managing consents will be soon removed from Voucherify, including this endpoint. - -### Example - -```php -setApiKey('X-Client-Application-Id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Application-Id', 'Bearer'); - -// Configure API key authorization: X-Client-Token -$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Client-Token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Client-Token', 'Bearer'); - - -$apiInstance = new OpenAPI\Client\Api\ClientSideApi( - // 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 -); -$customer_id = 'customer_id_example'; // string | A Voucherify customer identifier or source_id -$body = {"cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I":true,"cnst_VCmucIvAsmDYw2PPAok6bcYy":false}; // object | Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: - -try { - $apiInstance->updateCustomersConsentsClientSide($customer_id, $body); -} catch (Exception $e) { - echo 'Exception when calling ClientSideApi->updateCustomersConsentsClientSide: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **customer_id** | **string**| A Voucherify customer identifier or source_id | | -| **body** | **object**| Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: | [optional] | - -### Return type - -void (empty response body) - -### Authorization - -[X-Client-Application-Id](../../README.md#X-Client-Application-Id), [X-Client-Token](../../README.md#X-Client-Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - ## `validateStackedDiscountsClientSide()` ```php diff --git a/docs/Api/CustomersApi.md b/docs/Api/CustomersApi.md index 4f2414e..7a05657 100644 --- a/docs/Api/CustomersApi.md +++ b/docs/Api/CustomersApi.md @@ -9,7 +9,6 @@ All URIs are relative to https://api.voucherify.io, except if the operation defi | [**deleteCustomer()**](CustomersApi.md#deleteCustomer) | **DELETE** /v1/customers/{customerId} | Delete Customer | | [**getCustomer()**](CustomersApi.md#getCustomer) | **GET** /v1/customers/{customerId} | Get Customer | | [**importCustomersUsingCsv()**](CustomersApi.md#importCustomersUsingCsv) | **POST** /v1/customers/importCSV | Import and Update Customers using CSV | -| [**listCustomerActivities()**](CustomersApi.md#listCustomerActivities) | **GET** /v1/customers/{customerId}/activities | List Customer Activities [Deprecated] | | [**listCustomerActivity()**](CustomersApi.md#listCustomerActivity) | **GET** /v1/customers/{customerId}/activity | List Customer Activity | | [**listCustomerRedeemables()**](CustomersApi.md#listCustomerRedeemables) | **GET** /v1/customers/{customerId}/redeemables | List Customer's Redeemables | | [**listCustomerSegments()**](CustomersApi.md#listCustomerSegments) | **GET** /v1/customers/{customerId}/segments | List Customer's Segments | @@ -354,91 +353,6 @@ try { [[Back to Model list]](../../README.md#models) [[Back to README]](../../README.md) -## `listCustomerActivities()` - -```php -listCustomerActivities($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date): \OpenAPI\Client\Model\CustomersActivitiesListResponseBody -``` - -List Customer Activities [Deprecated] - -> ❗️ Deprecated This endpoint represents the deprecated version of the API responsible for listing customer activities and we do not recommend using it. Developers are encouraged to migrate to the latest version to take advantage of the latest enhancements and bug fixes. No updates will be provided to the deprecated endpoint. Retrieve customer activities. - -### Example - -```php -setApiKey('X-App-Id', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); - -// Configure API key authorization: X-App-Token -$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); -// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -// $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); - - -$apiInstance = new OpenAPI\Client\Api\CustomersApi( - // 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 -); -$customer_id = 'customer_id_example'; // string | A Voucherify customers id or source ID of the customer who performed the activities. -$limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. -$order = new \OpenAPI\Client\Model\ParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. -$starting_after = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. -$starting_after_id = 'starting_after_id_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. -$campaign_type = new \OpenAPI\Client\Model\ParameterCampaignType(); // ParameterCampaignType | Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM -$campaign_id = 'campaign_id_example'; // string | By applying this parameter you request only events related to specific campaign identified by its ID. -$product_id = 'product_id_example'; // string | By applying this parameter you request only events related to specific product identified by its ID. -$start_date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. -$end_date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. - -try { - $result = $apiInstance->listCustomerActivities($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling CustomersApi->listCustomerActivities: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **customer_id** | **string**| A Voucherify customers id or source ID of the customer who performed the activities. | | -| **limit** | **int**| Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. | [optional] | -| **order** | [**ParameterOrder**](../Model/.md)| Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. | [optional] | -| **starting_after** | **\DateTime**| A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. | [optional] | -| **starting_after_id** | **string**| A cursor for pagination. It retrieves the events starting after an event with the given ID. | [optional] | -| **campaign_type** | [**ParameterCampaignType**](../Model/.md)| Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM | [optional] | -| **campaign_id** | **string**| By applying this parameter you request only events related to specific campaign identified by its ID. | [optional] | -| **product_id** | **string**| By applying this parameter you request only events related to specific product identified by its ID. | [optional] | -| **start_date** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | -| **end_date** | **\DateTime**| Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. | [optional] | - -### Return type - -[**\OpenAPI\Client\Model\CustomersActivitiesListResponseBody**](../Model/CustomersActivitiesListResponseBody.md) - -### Authorization - -[X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - ## `listCustomerActivity()` ```php diff --git a/src/Api/ClientSideApi.php b/src/Api/ClientSideApi.php index 918f210..bb6661f 100644 --- a/src/Api/ClientSideApi.php +++ b/src/Api/ClientSideApi.php @@ -84,9 +84,6 @@ class ClientSideApi 'trackCustomEventClientSide' => [ 'application/json', ], - 'updateCustomersConsentsClientSide' => [ - 'application/json', - ], 'validateStackedDiscountsClientSide' => [ 'application/json', ], @@ -1383,263 +1380,6 @@ public function trackCustomEventClientSideRequest($origin, $client_events_create ); } - /** - * Operation updateCustomersConsentsClientSide - * - * Update Customer's consents (client-side) [Deprecated] - * - * @param string $customer_id A Voucherify customer identifier or source_id (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return void - * @deprecated - */ - public function updateCustomersConsentsClientSide($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $this->updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body, $contentType); - } - - /** - * Operation updateCustomersConsentsClientSideWithHttpInfo - * - * Update Customer's consents (client-side) [Deprecated] - * - * @param string $customer_id A Voucherify customer identifier or source_id (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function updateCustomersConsentsClientSideWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation updateCustomersConsentsClientSideAsync - * - * Update Customer's consents (client-side) [Deprecated] - * - * @param string $customer_id A Voucherify customer identifier or source_id (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function updateCustomersConsentsClientSideAsync($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - return $this->updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation updateCustomersConsentsClientSideAsyncWithHttpInfo - * - * Update Customer's consents (client-side) [Deprecated] - * - * @param string $customer_id A Voucherify customer identifier or source_id (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function updateCustomersConsentsClientSideAsyncWithHttpInfo($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - $returnType = ''; - $request = $this->updateCustomersConsentsClientSideRequest($customer_id, $body, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'updateCustomersConsentsClientSide' - * - * @param string $customer_id A Voucherify customer identifier or source_id (required) - * @param object $body Key-value pairs where the key is the consent identifier and value is a boolean that identifies if a customer has given the consent or not. To deny all consents use unsubscribed as a consent identifier and true as its value. ## Examples Opt-out from all communication: (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['updateCustomersConsentsClientSide'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - * @deprecated - */ - public function updateCustomersConsentsClientSideRequest($customer_id, $body = null, string $contentType = self::contentTypes['updateCustomersConsentsClientSide'][0]) - { - - // verify the required parameter 'customer_id' is set - if ($customer_id === null || (is_array($customer_id) && count($customer_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $customer_id when calling updateCustomersConsentsClientSide' - ); - } - - - - $resourcePath = '/client/v1/customers/{customerId}/consents'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($customer_id !== null) { - $resourcePath = str_replace( - '{' . 'customerId' . '}', - ObjectSerializer::toPathValue($customer_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($body)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($body)); - } else { - $httpBody = $body; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Application-Id'); - if ($apiKey !== null) { - $headers['X-Client-Application-Id'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-Client-Token'); - if ($apiKey !== null) { - $headers['X-Client-Token'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation validateStackedDiscountsClientSide * diff --git a/src/Api/CustomersApi.php b/src/Api/CustomersApi.php index 750c94b..d1a1647 100644 --- a/src/Api/CustomersApi.php +++ b/src/Api/CustomersApi.php @@ -87,9 +87,6 @@ class CustomersApi 'importCustomersUsingCsv' => [ 'multipart/form-data', ], - 'listCustomerActivities' => [ - 'application/json', - ], 'listCustomerActivity' => [ 'application/json', ], @@ -1564,445 +1561,6 @@ public function importCustomersUsingCsvRequest($file = null, string $contentType ); } - /** - * Operation listCustomerActivities - * - * List Customer Activities [Deprecated] - * - * @param string $customer_id A Voucherify customers id or source ID of the customer who performed the activities. (required) - * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) - * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) - * @param \DateTime $starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) - * @param string $starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) - * @param ParameterCampaignType $campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM (optional) - * @param string $campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. (optional) - * @param string $product_id By applying this parameter you request only events related to specific product identified by its ID. (optional) - * @param \DateTime $start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param \DateTime $end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivities'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return \OpenAPI\Client\Model\CustomersActivitiesListResponseBody - * @deprecated - */ - public function listCustomerActivities($customer_id, $limit = null, $order = null, $starting_after = null, $starting_after_id = null, $campaign_type = null, $campaign_id = null, $product_id = null, $start_date = null, $end_date = null, string $contentType = self::contentTypes['listCustomerActivities'][0]) - { - list($response) = $this->listCustomerActivitiesWithHttpInfo($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date, $contentType); - return $response; - } - - /** - * Operation listCustomerActivitiesWithHttpInfo - * - * List Customer Activities [Deprecated] - * - * @param string $customer_id A Voucherify customers id or source ID of the customer who performed the activities. (required) - * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) - * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) - * @param \DateTime $starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) - * @param string $starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) - * @param ParameterCampaignType $campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM (optional) - * @param string $campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. (optional) - * @param string $product_id By applying this parameter you request only events related to specific product identified by its ID. (optional) - * @param \DateTime $start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param \DateTime $end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivities'] to see the possible values for this operation - * - * @throws \OpenAPI\Client\ApiException on non-2xx response - * @throws \InvalidArgumentException - * @return array of \OpenAPI\Client\Model\CustomersActivitiesListResponseBody, HTTP status code, HTTP response headers (array of strings) - * @deprecated - */ - public function listCustomerActivitiesWithHttpInfo($customer_id, $limit = null, $order = null, $starting_after = null, $starting_after_id = null, $campaign_type = null, $campaign_id = null, $product_id = null, $start_date = null, $end_date = null, string $contentType = self::contentTypes['listCustomerActivities'][0]) - { - $request = $this->listCustomerActivitiesRequest($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - switch($statusCode) { - case 200: - if ('\OpenAPI\Client\Model\CustomersActivitiesListResponseBody' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\OpenAPI\Client\Model\CustomersActivitiesListResponseBody' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\OpenAPI\Client\Model\CustomersActivitiesListResponseBody', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\OpenAPI\Client\Model\CustomersActivitiesListResponseBody'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\OpenAPI\Client\Model\CustomersActivitiesListResponseBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation listCustomerActivitiesAsync - * - * List Customer Activities [Deprecated] - * - * @param string $customer_id A Voucherify customers id or source ID of the customer who performed the activities. (required) - * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) - * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) - * @param \DateTime $starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) - * @param string $starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) - * @param ParameterCampaignType $campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM (optional) - * @param string $campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. (optional) - * @param string $product_id By applying this parameter you request only events related to specific product identified by its ID. (optional) - * @param \DateTime $start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param \DateTime $end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivities'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function listCustomerActivitiesAsync($customer_id, $limit = null, $order = null, $starting_after = null, $starting_after_id = null, $campaign_type = null, $campaign_id = null, $product_id = null, $start_date = null, $end_date = null, string $contentType = self::contentTypes['listCustomerActivities'][0]) - { - return $this->listCustomerActivitiesAsyncWithHttpInfo($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation listCustomerActivitiesAsyncWithHttpInfo - * - * List Customer Activities [Deprecated] - * - * @param string $customer_id A Voucherify customers id or source ID of the customer who performed the activities. (required) - * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) - * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) - * @param \DateTime $starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) - * @param string $starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) - * @param ParameterCampaignType $campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM (optional) - * @param string $campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. (optional) - * @param string $product_id By applying this parameter you request only events related to specific product identified by its ID. (optional) - * @param \DateTime $start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param \DateTime $end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivities'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - * @deprecated - */ - public function listCustomerActivitiesAsyncWithHttpInfo($customer_id, $limit = null, $order = null, $starting_after = null, $starting_after_id = null, $campaign_type = null, $campaign_id = null, $product_id = null, $start_date = null, $end_date = null, string $contentType = self::contentTypes['listCustomerActivities'][0]) - { - $returnType = '\OpenAPI\Client\Model\CustomersActivitiesListResponseBody'; - $request = $this->listCustomerActivitiesRequest($customer_id, $limit, $order, $starting_after, $starting_after_id, $campaign_type, $campaign_id, $product_id, $start_date, $end_date, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'listCustomerActivities' - * - * @param string $customer_id A Voucherify customers id or source ID of the customer who performed the activities. (required) - * @param int $limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. (optional) - * @param ParameterOrder $order Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. (optional) - * @param \DateTime $starting_after A cursor for pagination. starting_after is a date-time value that defines your place in the list based on created_at property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after 2020-05-24T13:43:09.024Z in order to fetch the next page of the list. (optional) - * @param string $starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. (optional) - * @param ParameterCampaignType $campaign_type Through this parameter you can control a type of campaign by which Voucherify will filter related customers activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM (optional) - * @param string $campaign_id By applying this parameter you request only events related to specific campaign identified by its ID. (optional) - * @param string $product_id By applying this parameter you request only events related to specific product identified by its ID. (optional) - * @param \DateTime $start_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param \DateTime $end_date Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. (optional) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['listCustomerActivities'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - * @deprecated - */ - public function listCustomerActivitiesRequest($customer_id, $limit = null, $order = null, $starting_after = null, $starting_after_id = null, $campaign_type = null, $campaign_id = null, $product_id = null, $start_date = null, $end_date = null, string $contentType = self::contentTypes['listCustomerActivities'][0]) - { - - // verify the required parameter 'customer_id' is set - if ($customer_id === null || (is_array($customer_id) && count($customer_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $customer_id when calling listCustomerActivities' - ); - } - - if ($limit !== null && $limit > 100) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerActivities, must be smaller than or equal to 100.'); - } - if ($limit !== null && $limit < 1) { - throw new \InvalidArgumentException('invalid value for "$limit" when calling CustomersApi.listCustomerActivities, must be bigger than or equal to 1.'); - } - - - - - - - - - - - $resourcePath = '/v1/customers/{customerId}/activities'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $order, - 'order', // param base name - 'ParameterOrder', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $starting_after, - 'starting_after', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $starting_after_id, - 'starting_after_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $campaign_type, - 'campaign_type', // param base name - 'ParameterCampaignType', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $campaign_id, - 'campaign_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $product_id, - 'product_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $start_date, - 'start_date', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end_date, - 'end_date', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - - - // path params - if ($customer_id !== null) { - $resourcePath = str_replace( - '{' . 'customerId' . '}', - ObjectSerializer::toPathValue($customer_id), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Id'); - if ($apiKey !== null) { - $headers['X-App-Id'] = $apiKey; - } - // this endpoint requires API key authentication - $apiKey = $this->config->getApiKeyWithPrefix('X-App-Token'); - if ($apiKey !== null) { - $headers['X-App-Token'] = $apiKey; - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - /** * Operation listCustomerActivity * diff --git a/src/Model/CustomersActivitiesListResponseBody.php b/src/Model/CustomersActivitiesListResponseBody.php deleted file mode 100644 index 2383dd6..0000000 --- a/src/Model/CustomersActivitiesListResponseBody.php +++ /dev/null @@ -1,541 +0,0 @@ - - */ -class CustomersActivitiesListResponseBody implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CustomersActivitiesListResponseBody'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'object' => 'string', - 'data_ref' => 'string', - 'data' => '\OpenAPI\Client\Model\CustomerActivity[]', - 'total' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'object' => null, - 'data_ref' => null, - 'data' => null, - 'total' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'object' => true, - 'data_ref' => true, - 'data' => true, - 'total' => true - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'object' => 'object', - 'data_ref' => 'data_ref', - 'data' => 'data', - 'total' => 'total' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'object' => 'setObject', - 'data_ref' => 'setDataRef', - 'data' => 'setData', - 'total' => 'setTotal' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'object' => 'getObject', - 'data_ref' => 'getDataRef', - 'data' => 'getData', - 'total' => 'getTotal' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('object', $data ?? [], 'list'); - $this->setIfExists('data_ref', $data ?? [], 'data'); - $this->setIfExists('data', $data ?? [], null); - $this->setIfExists('total', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets object - * - * @return string|null - */ - public function getObject() - { - return $this->container['object']; - } - - /** - * Sets object - * - * @param string|null $object The type of the object represented by JSON. This object stores information about customer activities in a dictionary. - * - * @return self - */ - public function setObject($object) - { - if (is_null($object)) { - array_push($this->openAPINullablesSetToNull, 'object'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('object', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['object'] = $object; - - return $this; - } - - /** - * Gets data_ref - * - * @return string|null - */ - public function getDataRef() - { - return $this->container['data_ref']; - } - - /** - * Sets data_ref - * - * @param string|null $data_ref Identifies the name of the attribute that contains the array of customer activity objects. - * - * @return self - */ - public function setDataRef($data_ref) - { - if (is_null($data_ref)) { - array_push($this->openAPINullablesSetToNull, 'data_ref'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('data_ref', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['data_ref'] = $data_ref; - - return $this; - } - - /** - * Gets data - * - * @return \OpenAPI\Client\Model\CustomerActivity[]|null - */ - public function getData() - { - return $this->container['data']; - } - - /** - * Sets data - * - * @param \OpenAPI\Client\Model\CustomerActivity[]|null $data Array of customer activity objects. - * - * @return self - */ - public function setData($data) - { - if (is_null($data)) { - array_push($this->openAPINullablesSetToNull, 'data'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('data', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['data'] = $data; - - return $this; - } - - /** - * Gets total - * - * @return int|null - */ - public function getTotal() - { - return $this->container['total']; - } - - /** - * Sets total - * - * @param int|null $total Total number of customer activities. - * - * @return self - */ - public function setTotal($total) - { - if (is_null($total)) { - array_push($this->openAPINullablesSetToNull, 'total'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('total', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['total'] = $total; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - -