diff --git a/README.md b/README.md index 8959c94..7ab61ea 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ A powerful way to send personalized messages at scale and build effective custom For more information, please visit [https://onesignal.com](https://onesignal.com). -- API version: 5.11.2 -- Package version: 5.11.2 +- API version: 5.12.0 +- Package version: 5.12.0 ## Requirements diff --git a/composer.json b/composer.json index 7d6f266..33205f8 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "onesignal/onesignal-php-api", - "version": "5.11.2", + "version": "5.12.0", "description": "A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com", "keywords": [ "onesignal", diff --git a/docs/Api/DefaultApi.md b/docs/Api/DefaultApi.md index 89335a0..800bd21 100644 --- a/docs/Api/DefaultApi.md +++ b/docs/Api/DefaultApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**createApiKey()**](DefaultApi.md#createApiKey) | **POST** /apps/{app_id}/auth/tokens | Create API key [**createApp()**](DefaultApi.md#createApp) | **POST** /apps | Create an app [**createCustomEvents()**](DefaultApi.md#createCustomEvents) | **POST** /apps/{app_id}/custom_events | Create custom events +[**createJourney()**](DefaultApi.md#createJourney) | **POST** /apps/{app_id}/journeys | Create journey [**createNotification()**](DefaultApi.md#createNotification) | **POST** /notifications | Create notification [**createSegment()**](DefaultApi.md#createSegment) | **POST** /apps/{app_id}/segments | Create Segment [**createSubscription()**](DefaultApi.md#createSubscription) | **POST** /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | @@ -18,6 +19,7 @@ Method | HTTP request | Description [**createUser()**](DefaultApi.md#createUser) | **POST** /apps/{app_id}/users | [**deleteAlias()**](DefaultApi.md#deleteAlias) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | [**deleteApiKey()**](DefaultApi.md#deleteApiKey) | **DELETE** /apps/{app_id}/auth/tokens/{token_id} | Delete API key +[**deleteJourney()**](DefaultApi.md#deleteJourney) | **DELETE** /apps/{app_id}/journeys/{journey_id} | Delete journey [**deleteSegment()**](DefaultApi.md#deleteSegment) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segment [**deleteSubscription()**](DefaultApi.md#deleteSubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | [**deleteTemplate()**](DefaultApi.md#deleteTemplate) | **DELETE** /templates/{template_id} | Delete template @@ -42,6 +44,8 @@ Method | HTTP request | Description [**unsubscribeEmailWithToken()**](DefaultApi.md#unsubscribeEmailWithToken) | **POST** /apps/{app_id}/notifications/{notification_id}/unsubscribe | Unsubscribe with token [**updateApiKey()**](DefaultApi.md#updateApiKey) | **PATCH** /apps/{app_id}/auth/tokens/{token_id} | Update API key [**updateApp()**](DefaultApi.md#updateApp) | **PUT** /apps/{app_id} | Update an app +[**updateJourney()**](DefaultApi.md#updateJourney) | **PATCH** /apps/{app_id}/journeys/{journey_id} | Update journey +[**updateJourneyNode()**](DefaultApi.md#updateJourneyNode) | **PATCH** /apps/{app_id}/journeys/{journey_id}/nodes/{node_id} | Update journey node [**updateLiveActivity()**](DefaultApi.md#updateLiveActivity) | **POST** /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push [**updateSegment()**](DefaultApi.md#updateSegment) | **PATCH** /apps/{app_id}/segments/{segment_id} | Update Segment [**updateSubscription()**](DefaultApi.md#updateSubscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id} | @@ -49,6 +53,9 @@ Method | HTTP request | Description [**updateTemplate()**](DefaultApi.md#updateTemplate) | **PATCH** /templates/{template_id} | Update template [**updateUser()**](DefaultApi.md#updateUser) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id} | [**viewApiKeys()**](DefaultApi.md#viewApiKeys) | **GET** /apps/{app_id}/auth/tokens | View API keys +[**viewJourney()**](DefaultApi.md#viewJourney) | **GET** /apps/{app_id}/journeys/{journey_id} | View journey +[**viewJourneyStats()**](DefaultApi.md#viewJourneyStats) | **GET** /apps/{app_id}/journeys/{journey_id}/stats | View journey stats +[**viewJourneys()**](DefaultApi.md#viewJourneys) | **GET** /apps/{app_id}/journeys | View journeys [**viewTemplate()**](DefaultApi.md#viewTemplate) | **GET** /templates/{template_id} | View template [**viewTemplates()**](DefaultApi.md#viewTemplates) | **GET** /templates | View templates @@ -595,6 +602,77 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) +## `createJourney()` + +```php +createJourney($app_id, $create_journey_request): \onesignal\client\model\Journey +``` + +Create journey + +The Journeys API is in beta. Endpoints and response fields can still change. Create a new journey with an audience and a node graph. Journeys are always created in the draft state. The authenticated App API key must have permission to create journeys. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$create_journey_request = new \onesignal\client\model\CreateJourneyRequest(); // \onesignal\client\model\CreateJourneyRequest + +try { + $result = $apiInstance->createJourney($app_id, $create_journey_request); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->createJourney: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->createJourney: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **create_journey_request** | [**\onesignal\client\model\CreateJourneyRequest**](../Model/CreateJourneyRequest.md)| | + +### Return type + +[**\onesignal\client\model\Journey**](../Model/Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + ## `createNotification()` ```php @@ -1182,6 +1260,77 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) +## `deleteJourney()` + +```php +deleteJourney($app_id, $journey_id): \onesignal\client\model\GenericSuccessBoolResponse +``` + +Delete journey + +The Journeys API is in beta. Endpoints and response fields can still change. Permanently delete a journey by its UUID. Returns { \"success\": true } on success. The authenticated App API key must have permission to delete journeys. Deleting a journey stops any in-flight users and cannot be undone. Archive a running journey instead if you need to keep its data. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey to delete. + +try { + $result = $apiInstance->deleteJourney($app_id, $journey_id); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->deleteJourney: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->deleteJourney: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **journey_id** | **string**| UUID of the journey to delete. | + +### Return type + +[**\onesignal\client\model\GenericSuccessBoolResponse**](../Model/GenericSuccessBoolResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + ## `deleteSegment()` ```php @@ -2929,6 +3078,154 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) +## `updateJourney()` + +```php +updateJourney($app_id, $journey_id, $update_journey_request): \onesignal\client\model\Journey +``` + +Update journey + +The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a journey using JSON Merge Patch (RFC 7396). Send only the fields you want to change; omitted fields are left unchanged. A null value clears a nullable field, and arrays such as nodes are replaced wholesale. Set state to active to activate a draft journey. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey to update. +$update_journey_request = new \onesignal\client\model\UpdateJourneyRequest(); // \onesignal\client\model\UpdateJourneyRequest + +try { + $result = $apiInstance->updateJourney($app_id, $journey_id, $update_journey_request); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->updateJourney: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->updateJourney: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **journey_id** | **string**| UUID of the journey to update. | + **update_journey_request** | [**\onesignal\client\model\UpdateJourneyRequest**](../Model/UpdateJourneyRequest.md)| | + +### Return type + +[**\onesignal\client\model\Journey**](../Model/Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + +## `updateJourneyNode()` + +```php +updateJourneyNode($app_id, $journey_id, $node_id, $update_journey_node_request): \onesignal\client\model\Journey +``` + +Update journey node + +The Journeys API is in beta. Endpoints and response fields can still change. Apply a partial update to a single node, located by its server-assigned id, using JSON Merge Patch (RFC 7396). Send only the node fields you want to change; the rest of the node and the rest of the journey graph are left untouched. Returns the full updated journey. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey that owns the node. +$node_id = 'YOUR_NODE_ID'; // string | Server-assigned UUID of the node to update, from a prior View journey fetch. +$update_journey_node_request = new \onesignal\client\model\UpdateJourneyNodeRequest(); // \onesignal\client\model\UpdateJourneyNodeRequest + +try { + $result = $apiInstance->updateJourneyNode($app_id, $journey_id, $node_id, $update_journey_node_request); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->updateJourneyNode: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **journey_id** | **string**| UUID of the journey that owns the node. | + **node_id** | **string**| Server-assigned UUID of the node to update, from a prior View journey fetch. | + **update_journey_node_request** | [**\onesignal\client\model\UpdateJourneyNodeRequest**](../Model/UpdateJourneyNodeRequest.md)| | + +### Return type + +[**\onesignal\client\model\Journey**](../Model/Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + ## `updateLiveActivity()` ```php @@ -3439,6 +3736,221 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) +## `viewJourney()` + +```php +viewJourney($app_id, $journey_id): \onesignal\client\model\Journey +``` + +View journey + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve the full configuration of a single journey by its UUID, including its audience and node graph. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey to retrieve. + +try { + $result = $apiInstance->viewJourney($app_id, $journey_id); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->viewJourney: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->viewJourney: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **journey_id** | **string**| UUID of the journey to retrieve. | + +### Return type + +[**\onesignal\client\model\Journey**](../Model/Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + +## `viewJourneyStats()` + +```php +viewJourneyStats($app_id, $journey_id): \onesignal\client\model\JourneyStats +``` + +View journey stats + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve performance stats for a single journey: journey-level entry and exit counts, per-node counts keyed by node id, per-branch counts keyed by branch id, and channel delivery stats for message-sending nodes. The response carries no definition detail, so join it by id against the journey from View journey. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$journey_id = 'YOUR_JOURNEY_ID'; // string | UUID of the journey to retrieve stats for. + +try { + $result = $apiInstance->viewJourneyStats($app_id, $journey_id); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->viewJourneyStats: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->viewJourneyStats: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **journey_id** | **string**| UUID of the journey to retrieve stats for. | + +### Return type + +[**\onesignal\client\model\JourneyStats**](../Model/JourneyStats.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + +## `viewJourneys()` + +```php +viewJourneys($app_id, $cursor, $limit): \onesignal\client\model\JourneyListResponse +``` + +View journeys + +The Journeys API is in beta. Endpoints and response fields can still change. Retrieve a paginated list of journeys for an app. Returns a summary representation of each journey; use View journey for the full configuration. Uses forward-only cursor-based pagination. + +### Example + +```php +setRestApiKeyToken('YOUR_REST_API_KEY') + ->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY'); + + + +$apiInstance = new onesignal\client\Api\DefaultApi( + // 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 +); +$app_id = 'YOUR_APP_ID'; // string | Your OneSignal App ID in UUID v4 format. +$cursor = 'cursor_example'; // string | Opaque pagination token from a previous response's next_cursor. Omit for the first page. +$limit = 50; // int | Maximum journeys to return per page. Minimum 1, maximum 50. + +try { + $result = $apiInstance->viewJourneys($app_id, $cursor, $limit); + print_r($result); +} catch (\onesignal\client\ApiException $e) { + echo 'Exception when calling DefaultApi->viewJourneys: ', $e->getMessage(), PHP_EOL; + echo 'Status Code: ', $e->getCode(), PHP_EOL; + // getErrorMessages() flattens any error-envelope shape to a string[]; + // the raw body remains on getResponseBody(). + echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL; + echo 'Response Body: ', $e->getResponseBody(), PHP_EOL; +} catch (\Exception $e) { + echo 'Exception when calling DefaultApi->viewJourneys: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **app_id** | **string**| Your OneSignal App ID in UUID v4 format. | + **cursor** | **string**| Opaque pagination token from a previous response's next_cursor. Omit for the first page. | [optional] + **limit** | **int**| Maximum journeys to return per page. Minimum 1, maximum 50. | [optional] [default to 50] + +### Return type + +[**\onesignal\client\model\JourneyListResponse**](../Model/JourneyListResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) +[[Back to README]](https://github.com/OneSignal/onesignal-php-api) + ## `viewTemplate()` ```php diff --git a/docs/Model/CreateJourneyRequest.md b/docs/Model/CreateJourneyRequest.md new file mode 100644 index 0000000..c5d8273 --- /dev/null +++ b/docs/Model/CreateJourneyRequest.md @@ -0,0 +1,15 @@ +# # CreateJourneyRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Journey name, up to 300 characters. | +**description** | **string** | Optional journey description, up to 1024 characters. | [optional] +**audience** | [**\onesignal\client\model\JourneyAudience**](JourneyAudience.md) | | [optional] +**early_exit** | [**\onesignal\client\model\JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] +**reentry_rules** | [**\onesignal\client\model\JourneyReentryRules**](JourneyReentryRules.md) | | [optional] +**schedule** | [**\onesignal\client\model\JourneySchedule**](JourneySchedule.md) | | [optional] +**nodes** | [**\onesignal\client\model\JourneyNode[]**](JourneyNode.md) | Ordered list of journey nodes. Server-assigned id fields are rejected on create. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/Journey.md b/docs/Model/Journey.md new file mode 100644 index 0000000..9e21d38 --- /dev/null +++ b/docs/Model/Journey.md @@ -0,0 +1,24 @@ +# # Journey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Journey UUID. Read-only. | [optional] +**app_id** | **string** | UUID of the app the journey belongs to. Read-only. | [optional] +**name** | **string** | Journey name, up to 300 characters. | [optional] +**description** | **string** | Journey description, up to 1024 characters. Defaults to an empty string. | [optional] +**state** | **string** | Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. | [optional] +**created_at** | **string** | ISO 8601 creation time. Read-only. | [optional] +**updated_at** | **string** | ISO 8601 last-update time. Read-only. | [optional] +**started_at** | **string** | ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued, and started_at populates once the journey finishes processing. | [optional] +**archived_at** | **string** | ISO 8601 time the journey was archived, or null. Read-only. | [optional] +**created_source** | **string** | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] +**audience** | [**\onesignal\client\model\JourneyAudience**](JourneyAudience.md) | | [optional] +**early_exit** | [**\onesignal\client\model\JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] +**reentry_rules** | [**\onesignal\client\model\JourneyReentryRules**](JourneyReentryRules.md) | | [optional] +**schedule** | [**\onesignal\client\model\JourneySchedule**](JourneySchedule.md) | | [optional] +**nodes** | [**\onesignal\client\model\JourneyNode[]**](JourneyNode.md) | Ordered list of journey nodes. | [optional] +**concurrency_key** | **string** | Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409). Send it back exactly as read; do not construct or parse it. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyAudience.md b/docs/Model/JourneyAudience.md new file mode 100644 index 0000000..b256ffb --- /dev/null +++ b/docs/Model/JourneyAudience.md @@ -0,0 +1,14 @@ +# # JourneyAudience + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **string** | Audience kind. Selects which other fields apply. | +**included_segment_ids** | **string[]** | segment audiences: Segment UUIDs whose users enter the journey. | [optional] +**excluded_segment_ids** | **string[]** | segment audiences: Segment UUIDs whose users are excluded. | [optional] +**future_additions_only** | **bool** | segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. | [optional] +**name** | **string** | event_trigger audiences: event name that triggers entry, up to 255 characters. | [optional] +**attributes** | **\onesignal\client\model\JourneyEventAttribute[][]** | Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyBranch.md b/docs/Model/JourneyBranch.md new file mode 100644 index 0000000..7488c18 --- /dev/null +++ b/docs/Model/JourneyBranch.md @@ -0,0 +1,12 @@ +# # JourneyBranch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. | [optional] +**condition** | [**\onesignal\client\model\JourneyCondition**](JourneyCondition.md) | | [optional] +**weight** | **float** | Branch weight for split_range nodes. Weights across a node's branches must sum to 100. | [optional] +**nodes** | [**\onesignal\client\model\JourneyNode[]**](JourneyNode.md) | Nodes run when this branch is taken, before flow converges to the next sibling node. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyBranchStats.md b/docs/Model/JourneyBranchStats.md new file mode 100644 index 0000000..d36b8bc --- /dev/null +++ b/docs/Model/JourneyBranchStats.md @@ -0,0 +1,9 @@ +# # JourneyBranchStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed** | **int** | Users who took this branch. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyCondition.md b/docs/Model/JourneyCondition.md new file mode 100644 index 0000000..64d582d --- /dev/null +++ b/docs/Model/JourneyCondition.md @@ -0,0 +1,17 @@ +# # JourneyCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **string** | Condition kind. Selects which other fields apply. | +**included_segment_ids** | **string[]** | segment_membership conditions: Segment UUIDs the user must belong to. | [optional] +**excluded_segment_ids** | **string[]** | segment_membership conditions: Segment UUIDs the user must not belong to. | [optional] +**action** | **string** | on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. | [optional] +**sending_node_id** | **string** | on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. | [optional] +**client_node_id** | **string** | on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. | [optional] +**name** | **string** | event_trigger conditions: event name, up to 255 characters. | [optional] +**attributes** | **\onesignal\client\model\JourneyEventAttribute[][]** | Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. | [optional] +**entry_event_match_attributes** | **object[]** | event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyEarlyExit.md b/docs/Model/JourneyEarlyExit.md new file mode 100644 index 0000000..6518187 --- /dev/null +++ b/docs/Model/JourneyEarlyExit.md @@ -0,0 +1,10 @@ +# # JourneyEarlyExit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rules** | [**\onesignal\client\model\JourneyEarlyExitRules**](JourneyEarlyExitRules.md) | | [optional] +**tag_on_early_exit** | **array** | Tag key-value pairs applied when a user exits early. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyEarlyExitRules.md b/docs/Model/JourneyEarlyExitRules.md new file mode 100644 index 0000000..06ded6a --- /dev/null +++ b/docs/Model/JourneyEarlyExitRules.md @@ -0,0 +1,12 @@ +# # JourneyEarlyExitRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**on_segment** | [**\onesignal\client\model\JourneyEarlyExitRulesOnSegment**](JourneyEarlyExitRulesOnSegment.md) | | [optional] +**when_not_in_audience** | **bool** | Exit when the user no longer matches the journey audience. Defaults to false. | [optional] +**on_session** | **bool** | Exit on a new session start. Defaults to false. | [optional] +**on_event** | [**\onesignal\client\model\JourneyEarlyExitRulesOnEvent**](JourneyEarlyExitRulesOnEvent.md) | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyEarlyExitRulesOnEvent.md b/docs/Model/JourneyEarlyExitRulesOnEvent.md new file mode 100644 index 0000000..0eaaa66 --- /dev/null +++ b/docs/Model/JourneyEarlyExitRulesOnEvent.md @@ -0,0 +1,9 @@ +# # JourneyEarlyExitRulesOnEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Exit when this event occurs. Up to 255 characters. | + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyEarlyExitRulesOnSegment.md b/docs/Model/JourneyEarlyExitRulesOnSegment.md new file mode 100644 index 0000000..34810c2 --- /dev/null +++ b/docs/Model/JourneyEarlyExitRulesOnSegment.md @@ -0,0 +1,9 @@ +# # JourneyEarlyExitRulesOnSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**included_segment_ids** | **string[]** | Exit when the user enters any of these segments. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyEventAttribute.md b/docs/Model/JourneyEventAttribute.md new file mode 100644 index 0000000..c0f438f --- /dev/null +++ b/docs/Model/JourneyEventAttribute.md @@ -0,0 +1,11 @@ +# # JourneyEventAttribute + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **string** | Event attribute key. | +**operator** | **string** | Comparison operator. | +**value** | **string** | Value to compare against. Not required for exists and not_exists. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyListAudience.md b/docs/Model/JourneyListAudience.md new file mode 100644 index 0000000..94b52fa --- /dev/null +++ b/docs/Model/JourneyListAudience.md @@ -0,0 +1,9 @@ +# # JourneyListAudience + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **string** | Audience kind. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyListItem.md b/docs/Model/JourneyListItem.md new file mode 100644 index 0000000..dc0d3c2 --- /dev/null +++ b/docs/Model/JourneyListItem.md @@ -0,0 +1,20 @@ +# # JourneyListItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Journey UUID. Read-only. | [optional] +**app_id** | **string** | UUID of the app the journey belongs to. Read-only. | [optional] +**name** | **string** | Journey name, up to 300 characters. | [optional] +**state** | **string** | Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. | [optional] +**created_at** | **string** | ISO 8601 creation time. Read-only. | [optional] +**updated_at** | **string** | ISO 8601 last-update time. Read-only. | [optional] +**started_at** | **string** | ISO 8601 time the journey was activated, or null. Read-only. | [optional] +**archived_at** | **string** | ISO 8601 time the journey was archived, or null. Read-only. | [optional] +**created_source** | **string** | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] +**schedule** | [**\onesignal\client\model\JourneySchedule**](JourneySchedule.md) | | [optional] +**audience** | [**\onesignal\client\model\JourneyListAudience**](JourneyListAudience.md) | | [optional] +**reentry_rules** | [**\onesignal\client\model\JourneyReentryRules**](JourneyReentryRules.md) | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyListResponse.md b/docs/Model/JourneyListResponse.md new file mode 100644 index 0000000..7cff9f6 --- /dev/null +++ b/docs/Model/JourneyListResponse.md @@ -0,0 +1,11 @@ +# # JourneyListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**journeys** | [**\onesignal\client\model\JourneyListItem[]**](JourneyListItem.md) | Journeys ordered by creation time, newest first. | [optional] +**has_more** | **bool** | true if more journeys exist beyond this page. | [optional] +**next_cursor** | **string** | Cursor for the next page. Present only when has_more is true. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyMessageStats.md b/docs/Model/JourneyMessageStats.md new file mode 100644 index 0000000..36aac89 --- /dev/null +++ b/docs/Model/JourneyMessageStats.md @@ -0,0 +1,9 @@ +# # JourneyMessageStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totals** | **array** | All-time totals for this node, keyed by channel-specific stat name. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyNode.md b/docs/Model/JourneyNode.md new file mode 100644 index 0000000..ebafdea --- /dev/null +++ b/docs/Model/JourneyNode.md @@ -0,0 +1,25 @@ +# # JourneyNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. | [optional] +**kind** | **string** | Node kind. Selects which other fields apply. | +**client_node_id** | **string** | Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. | [optional] +**annotation** | **string** | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] +**duration_seconds** | **int** | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] +**relative_to** | **string** | time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. | [optional] +**windows** | [**\onesignal\client\model\JourneyTimeWindow[]**](JourneyTimeWindow.md) | time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. | [optional] +**time_zone** | **string** | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] +**use_user_time_zone** | **bool** | time_window nodes: when true, uses the user's timezone if available. | [optional] +**template_id** | **string** | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] +**iam_id** | **string** | send_iam nodes: UUID of the in-app message to send. | [optional] +**user_ttl_seconds** | **int** | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] +**webhook_id** | **string** | send_webhook nodes: UUID of the webhook to send. | [optional] +**assignments** | **array** | tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. | [optional] +**randomize_on_entry** | **bool** | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] +**branches** | [**\onesignal\client\model\JourneyBranch[]**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. | [optional] +**expiration** | [**\onesignal\client\model\JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md) | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyNodeStats.md b/docs/Model/JourneyNodeStats.md new file mode 100644 index 0000000..f8c79f8 --- /dev/null +++ b/docs/Model/JourneyNodeStats.md @@ -0,0 +1,13 @@ +# # JourneyNodeStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **string** | Node kind, repeated here so stats can be read without joining against the journey definition. | [optional] +**waiting** | **int** | Users currently held at this node. | [optional] +**completed** | **int** | Users who advanced past this node normally. | [optional] +**exited_early** | **int** | Users who left the journey from this node through an early exit rule. | [optional] +**message_stats** | [**\onesignal\client\model\JourneyMessageStats**](JourneyMessageStats.md) | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyReentryRules.md b/docs/Model/JourneyReentryRules.md new file mode 100644 index 0000000..598e4d1 --- /dev/null +++ b/docs/Model/JourneyReentryRules.md @@ -0,0 +1,9 @@ +# # JourneyReentryRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration_seconds** | **int** | Minimum seconds before a user can re-enter. Must be at least 600 (10 minutes). | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneySchedule.md b/docs/Model/JourneySchedule.md new file mode 100644 index 0000000..b366670 --- /dev/null +++ b/docs/Model/JourneySchedule.md @@ -0,0 +1,11 @@ +# # JourneySchedule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_at** | **string** | ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. | [optional] +**stop_at** | **string** | ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. | [optional] +**error** | **string** | Read-only. Present when a scheduling error occurred. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyStats.md b/docs/Model/JourneyStats.md new file mode 100644 index 0000000..3f1331a --- /dev/null +++ b/docs/Model/JourneyStats.md @@ -0,0 +1,14 @@ +# # JourneyStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | UUID of the journey these stats belong to. | [optional] +**started** | **int** | Users who entered the journey. | [optional] +**completed** | **int** | Users who reached the end of the journey normally. | [optional] +**exited_early** | **int** | Users who left the journey through an early exit rule. | [optional] +**nodes** | [**array**](JourneyNodeStats.md) | Node stats keyed by node id. Includes every node in the graph, at any nesting depth. | [optional] +**branches** | [**array**](JourneyBranchStats.md) | Branch stats keyed by branch id. Empty for a journey with no branching nodes. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyTimePoint.md b/docs/Model/JourneyTimePoint.md new file mode 100644 index 0000000..8835636 --- /dev/null +++ b/docs/Model/JourneyTimePoint.md @@ -0,0 +1,10 @@ +# # JourneyTimePoint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hour** | **int** | Hour of day, 0-23. | [optional] +**minute** | **int** | Minute of hour, 0-59. Defaults to 0. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyTimeWindow.md b/docs/Model/JourneyTimeWindow.md new file mode 100644 index 0000000..2f9c08c --- /dev/null +++ b/docs/Model/JourneyTimeWindow.md @@ -0,0 +1,11 @@ +# # JourneyTimeWindow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start** | [**JourneyTimePoint**](JourneyTimePoint.md) | When the window opens. | [optional] +**end** | [**JourneyTimePoint**](JourneyTimePoint.md) | When the window closes. | [optional] +**day_of_week** | **int** | Day of week, 1 = Monday. Omit to apply the window to every day. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/JourneyWaitUntilExpiration.md b/docs/Model/JourneyWaitUntilExpiration.md new file mode 100644 index 0000000..c815ea6 --- /dev/null +++ b/docs/Model/JourneyWaitUntilExpiration.md @@ -0,0 +1,10 @@ +# # JourneyWaitUntilExpiration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration_seconds** | **int** | Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). | [optional] +**exits** | **bool** | When true, the user exits the journey when the timer fires; when false, the user continues to convergence. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/UpdateJourneyNodeRequest.md b/docs/Model/UpdateJourneyNodeRequest.md new file mode 100644 index 0000000..9da18a0 --- /dev/null +++ b/docs/Model/UpdateJourneyNodeRequest.md @@ -0,0 +1,24 @@ +# # UpdateJourneyNodeRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client_node_id** | **string** | Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. | [optional] +**annotation** | **string** | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] +**duration_seconds** | **int** | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] +**relative_to** | **string** | time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. | [optional] +**windows** | [**\onesignal\client\model\JourneyTimeWindow[]**](JourneyTimeWindow.md) | time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. | [optional] +**time_zone** | **string** | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] +**use_user_time_zone** | **bool** | time_window nodes: when true, uses the user's timezone if available. | [optional] +**template_id** | **string** | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] +**iam_id** | **string** | send_iam nodes: UUID of the in-app message to send. | [optional] +**user_ttl_seconds** | **int** | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] +**webhook_id** | **string** | send_webhook nodes: UUID of the webhook to send. | [optional] +**assignments** | **array** | tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. | [optional] +**randomize_on_entry** | **bool** | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] +**branches** | [**\onesignal\client\model\JourneyBranch[]**](JourneyBranch.md) | Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. | [optional] +**expiration** | [**\onesignal\client\model\JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md) | | [optional] +**concurrency_key** | **string** | Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. It is not merged onto the node. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/docs/Model/UpdateJourneyRequest.md b/docs/Model/UpdateJourneyRequest.md new file mode 100644 index 0000000..44c37fa --- /dev/null +++ b/docs/Model/UpdateJourneyRequest.md @@ -0,0 +1,17 @@ +# # UpdateJourneyRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Journey name. | [optional] +**description** | **string** | Journey description. Send null to clear it. | [optional] +**audience** | [**\onesignal\client\model\JourneyAudience**](JourneyAudience.md) | | [optional] +**early_exit** | [**\onesignal\client\model\JourneyEarlyExit**](JourneyEarlyExit.md) | | [optional] +**reentry_rules** | [**\onesignal\client\model\JourneyReentryRules**](JourneyReentryRules.md) | | [optional] +**schedule** | [**\onesignal\client\model\JourneySchedule**](JourneySchedule.md) | | [optional] +**nodes** | [**\onesignal\client\model\JourneyNode[]**](JourneyNode.md) | Full ordered list of nodes, which replaces the existing graph wholesale. Preserve each node's server-assigned id from a prior fetch to keep in-flight users on that node; omit id to add a new node. | [optional] +**state** | **string** | Target state. Set active to activate a draft journey, or scheduled together with a future schedule.start_at to activate it later. Set archived to stop a running journey; archiving is permanent. Only scheduled and processing journeys can return to draft. | [optional] +**concurrency_key** | **string** | Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api) diff --git a/lib/Configuration.php b/lib/Configuration.php index 53e9c44..9029bb3 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -98,7 +98,7 @@ class Configuration * * @var string */ - protected $userAgent = 'OpenAPI-Generator/5.11.2/PHP'; + protected $userAgent = 'OpenAPI-Generator/5.12.0/PHP'; /** * Debug switch (default set to false) @@ -429,7 +429,7 @@ public static function toDebugReport() $report = 'PHP SDK (onesignal\client) Debug Report:' . PHP_EOL; $report .= ' OS: ' . php_uname() . PHP_EOL; $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' SDK Package Version: 5.11.2' . PHP_EOL; + $report .= ' SDK Package Version: 5.12.0' . PHP_EOL; $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; return $report; diff --git a/lib/api/DefaultApi.php b/lib/api/DefaultApi.php index 20f5eaf..9a38595 100644 --- a/lib/api/DefaultApi.php +++ b/lib/api/DefaultApi.php @@ -481,7 +481,7 @@ public function cancelNotificationRequest($app_id, $notification_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -835,7 +835,7 @@ public function copyTemplateToAppRequest($template_id, $app_id, $copy_template_r } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -1268,7 +1268,7 @@ public function createAliasRequest($app_id, $alias_label, $alias_id, $user_ident } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -1682,7 +1682,7 @@ public function createAliasBySubscriptionRequest($app_id, $subscription_id, $use } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -2016,7 +2016,7 @@ public function createApiKeyRequest($app_id, $create_api_key_request) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -2354,7 +2354,7 @@ public function createAppRequest($app) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -2734,7 +2734,7 @@ public function createCustomEventsRequest($app_id, $custom_events_request) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -2752,36 +2752,38 @@ public function createCustomEventsRequest($app_id, $custom_events_request) } /** - * Operation createNotification + * Operation createJourney * - * Create notification + * Create journey * - * @param \onesignal\client\model\Notification $notification notification (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param \onesignal\client\model\CreateJourneyRequest $create_journey_request create_journey_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\CreateNotificationSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function createNotification($notification) + public function createJourney($app_id, $create_journey_request) { - list($response) = $this->createNotificationWithHttpInfo($notification); + list($response) = $this->createJourneyWithHttpInfo($app_id, $create_journey_request); return $response; } /** - * Operation createNotificationWithHttpInfo + * Operation createJourneyWithHttpInfo * - * Create notification + * Create journey * - * @param \onesignal\client\model\Notification $notification (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param \onesignal\client\model\CreateJourneyRequest $create_journey_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\CreateNotificationSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function createNotificationWithHttpInfo($notification) + public function createJourneyWithHttpInfo($app_id, $create_journey_request) { - $request = $this->createNotificationRequest($notification); + $request = $this->createJourneyRequest($app_id, $create_journey_request); try { $options = $this->createHttpClientOption(); @@ -2819,18 +2821,18 @@ public function createNotificationWithHttpInfo($notification) } switch($statusCode) { - case 200: - if ('\onesignal\client\model\CreateNotificationSuccessResponse' === '\SplFileObject') { + case 201: + if ('\onesignal\client\model\Journey' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\CreateNotificationSuccessResponse' !== 'string') { + if ('\onesignal\client\model\Journey' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateNotificationSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\Journey', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -2844,6 +2846,21 @@ public function createNotificationWithHttpInfo($notification) } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -2866,7 +2883,7 @@ public function createNotificationWithHttpInfo($notification) ]; } - $returnType = '\onesignal\client\model\CreateNotificationSuccessResponse'; + $returnType = '\onesignal\client\model\Journey'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -2884,10 +2901,10 @@ public function createNotificationWithHttpInfo($notification) } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\CreateNotificationSuccessResponse', + '\onesignal\client\model\Journey', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -2900,6 +2917,14 @@ public function createNotificationWithHttpInfo($notification) ); $e->setResponseObject($data); break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -2922,18 +2947,19 @@ public function createNotificationWithHttpInfo($notification) } /** - * Operation createNotificationAsync + * Operation createJourneyAsync * - * Create notification + * Create journey * - * @param \onesignal\client\model\Notification $notification (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param \onesignal\client\model\CreateJourneyRequest $create_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createNotificationAsync($notification) + public function createJourneyAsync($app_id, $create_journey_request) { - return $this->createNotificationAsyncWithHttpInfo($notification) + return $this->createJourneyAsyncWithHttpInfo($app_id, $create_journey_request) ->then( function ($response) { return $response[0]; @@ -2942,19 +2968,20 @@ function ($response) { } /** - * Operation createNotificationAsyncWithHttpInfo + * Operation createJourneyAsyncWithHttpInfo * - * Create notification + * Create journey * - * @param \onesignal\client\model\Notification $notification (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param \onesignal\client\model\CreateJourneyRequest $create_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createNotificationAsyncWithHttpInfo($notification) + public function createJourneyAsyncWithHttpInfo($app_id, $create_journey_request) { - $returnType = '\onesignal\client\model\CreateNotificationSuccessResponse'; - $request = $this->createNotificationRequest($notification); + $returnType = '\onesignal\client\model\Journey'; + $request = $this->createJourneyRequest($app_id, $create_journey_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -2993,23 +3020,30 @@ function ($exception) { } /** - * Create request for operation 'createNotification' + * Create request for operation 'createJourney' * - * @param \onesignal\client\model\Notification $notification (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param \onesignal\client\model\CreateJourneyRequest $create_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createNotificationRequest($notification) + public function createJourneyRequest($app_id, $create_journey_request) { - // verify the required parameter 'notification' is set - if ($notification === null || (is_array($notification) && count($notification) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $notification when calling createNotification' + 'Missing the required parameter $app_id when calling createJourney' + ); + } + // verify the required parameter 'create_journey_request' is set + if ($create_journey_request === null || (is_array($create_journey_request) && count($create_journey_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $create_journey_request when calling createJourney' ); } - $resourcePath = '/notifications'; + $resourcePath = '/apps/{app_id}/journeys'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3018,6 +3052,14 @@ public function createNotificationRequest($notification) + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } if ($multipart) { @@ -3032,11 +3074,11 @@ public function createNotificationRequest($notification) } // for model (json/xml) - if (isset($notification)) { + if (isset($create_journey_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($notification)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_journey_request)); } else { - $httpBody = $notification; + $httpBody = $create_journey_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -3072,7 +3114,7 @@ public function createNotificationRequest($notification) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -3090,38 +3132,36 @@ public function createNotificationRequest($notification) } /** - * Operation createSegment + * Operation createNotification * - * Create Segment + * Create notification * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param \onesignal\client\model\Segment $segment segment (optional) + * @param \onesignal\client\model\Notification $notification notification (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\CreateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\CreateSegmentConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\CreateNotificationSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function createSegment($app_id, $segment = null) + public function createNotification($notification) { - list($response) = $this->createSegmentWithHttpInfo($app_id, $segment); + list($response) = $this->createNotificationWithHttpInfo($notification); return $response; } /** - * Operation createSegmentWithHttpInfo + * Operation createNotificationWithHttpInfo * - * Create Segment + * Create notification * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param \onesignal\client\model\Segment $segment (optional) + * @param \onesignal\client\model\Notification $notification (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\CreateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\CreateSegmentConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\CreateNotificationSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function createSegmentWithHttpInfo($app_id, $segment = null) + public function createNotificationWithHttpInfo($notification) { - $request = $this->createSegmentRequest($app_id, $segment); + $request = $this->createNotificationRequest($notification); try { $options = $this->createHttpClientOption(); @@ -3159,18 +3199,18 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) } switch($statusCode) { - case 201: - if ('\onesignal\client\model\CreateSegmentSuccessResponse' === '\SplFileObject') { + case 200: + if ('\onesignal\client\model\CreateNotificationSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\CreateSegmentSuccessResponse' !== 'string') { + if ('\onesignal\client\model\CreateNotificationSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateSegmentSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateNotificationSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3189,21 +3229,6 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) $response->getStatusCode(), $response->getHeaders() ]; - case 409: - if ('\onesignal\client\model\CreateSegmentConflictResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\CreateSegmentConflictResponse' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateSegmentConflictResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; case 429: if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer @@ -3221,7 +3246,7 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) ]; } - $returnType = '\onesignal\client\model\CreateSegmentSuccessResponse'; + $returnType = '\onesignal\client\model\CreateNotificationSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -3239,10 +3264,10 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\CreateSegmentSuccessResponse', + '\onesignal\client\model\CreateNotificationSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3255,14 +3280,6 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) ); $e->setResponseObject($data); break; - case 409: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\CreateSegmentConflictResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -3285,19 +3302,18 @@ public function createSegmentWithHttpInfo($app_id, $segment = null) } /** - * Operation createSegmentAsync + * Operation createNotificationAsync * - * Create Segment + * Create notification * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param \onesignal\client\model\Segment $segment (optional) + * @param \onesignal\client\model\Notification $notification (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createSegmentAsync($app_id, $segment = null) + public function createNotificationAsync($notification) { - return $this->createSegmentAsyncWithHttpInfo($app_id, $segment) + return $this->createNotificationAsyncWithHttpInfo($notification) ->then( function ($response) { return $response[0]; @@ -3306,20 +3322,19 @@ function ($response) { } /** - * Operation createSegmentAsyncWithHttpInfo + * Operation createNotificationAsyncWithHttpInfo * - * Create Segment + * Create notification * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param \onesignal\client\model\Segment $segment (optional) + * @param \onesignal\client\model\Notification $notification (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createSegmentAsyncWithHttpInfo($app_id, $segment = null) + public function createNotificationAsyncWithHttpInfo($notification) { - $returnType = '\onesignal\client\model\CreateSegmentSuccessResponse'; - $request = $this->createSegmentRequest($app_id, $segment); + $returnType = '\onesignal\client\model\CreateNotificationSuccessResponse'; + $request = $this->createNotificationRequest($notification); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3358,24 +3373,23 @@ function ($exception) { } /** - * Create request for operation 'createSegment' + * Create request for operation 'createNotification' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param \onesignal\client\model\Segment $segment (optional) + * @param \onesignal\client\model\Notification $notification (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createSegmentRequest($app_id, $segment = null) + public function createNotificationRequest($notification) { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + // verify the required parameter 'notification' is set + if ($notification === null || (is_array($notification) && count($notification) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling createSegment' + 'Missing the required parameter $notification when calling createNotification' ); } - $resourcePath = '/apps/{app_id}/segments'; + $resourcePath = '/notifications'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3384,14 +3398,6 @@ public function createSegmentRequest($app_id, $segment = null) - // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } if ($multipart) { @@ -3406,11 +3412,11 @@ public function createSegmentRequest($app_id, $segment = null) } // for model (json/xml) - if (isset($segment)) { + if (isset($notification)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($segment)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($notification)); } else { - $httpBody = $segment; + $httpBody = $notification; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -3446,7 +3452,7 @@ public function createSegmentRequest($app_id, $segment = null) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -3464,38 +3470,38 @@ public function createSegmentRequest($app_id, $segment = null) } /** - * Operation createSubscription + * Operation createSegment * - * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) + * Create Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param \onesignal\client\model\Segment $segment segment (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\SubscriptionBody|\onesignal\client\model\SubscriptionBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\CreateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\CreateSegmentConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function createSubscription($app_id, $alias_label, $alias_id, $subscription_body) + public function createSegment($app_id, $segment = null) { - list($response) = $this->createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body); + list($response) = $this->createSegmentWithHttpInfo($app_id, $segment); return $response; } /** - * Operation createSubscriptionWithHttpInfo + * Operation createSegmentWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * Create Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param \onesignal\client\model\Segment $segment (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\SubscriptionBody|\onesignal\client\model\SubscriptionBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\CreateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\CreateSegmentConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) + public function createSegmentWithHttpInfo($app_id, $segment = null) { - $request = $this->createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body); + $request = $this->createSegmentRequest($app_id, $segment); try { $options = $this->createHttpClientOption(); @@ -3534,77 +3540,47 @@ public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, switch($statusCode) { case 201: - if ('\onesignal\client\model\SubscriptionBody' === '\SplFileObject') { + if ('\onesignal\client\model\CreateSegmentSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\SubscriptionBody' !== 'string') { + if ('\onesignal\client\model\CreateSegmentSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\SubscriptionBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateSegmentSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; - case 202: - if ('\onesignal\client\model\SubscriptionBody' === '\SplFileObject') { + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\SubscriptionBody' !== 'string') { + if ('\onesignal\client\model\GenericError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\SubscriptionBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), $response->getHeaders() ]; - case 400: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + case 409: + if ('\onesignal\client\model\CreateSegmentConflictResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\CreateSegmentConflictResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 409: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateSegmentConflictResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -3625,7 +3601,7 @@ public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, ]; } - $returnType = '\onesignal\client\model\SubscriptionBody'; + $returnType = '\onesignal\client\model\CreateSegmentSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -3646,15 +3622,7 @@ public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\SubscriptionBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\SubscriptionBody', + '\onesignal\client\model\CreateSegmentSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3667,18 +3635,10 @@ public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\CreateSegmentConflictResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -3705,19 +3665,19 @@ public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, } /** - * Operation createSubscriptionAsync + * Operation createSegmentAsync * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * Create Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param \onesignal\client\model\Segment $segment (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createSubscriptionAsync($app_id, $alias_label, $alias_id, $subscription_body) + public function createSegmentAsync($app_id, $segment = null) { - return $this->createSubscriptionAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) + return $this->createSegmentAsyncWithHttpInfo($app_id, $segment) ->then( function ($response) { return $response[0]; @@ -3726,20 +3686,20 @@ function ($response) { } /** - * Operation createSubscriptionAsyncWithHttpInfo + * Operation createSegmentAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * Create Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param \onesignal\client\model\Segment $segment (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createSubscriptionAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) + public function createSegmentAsyncWithHttpInfo($app_id, $segment = null) { - $returnType = '\onesignal\client\model\SubscriptionBody'; - $request = $this->createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body); + $returnType = '\onesignal\client\model\CreateSegmentSuccessResponse'; + $request = $this->createSegmentRequest($app_id, $segment); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -3778,44 +3738,24 @@ function ($exception) { } /** - * Create request for operation 'createSubscription' + * Create request for operation 'createSegment' * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param \onesignal\client\model\Segment $segment (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body) + public function createSegmentRequest($app_id, $segment = null) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling createSubscription' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling createSubscription' - ); - } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling createSubscription' - ); - } - // verify the required parameter 'subscription_body' is set - if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_body when calling createSubscription' + 'Missing the required parameter $app_id when calling createSegment' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions'; + $resourcePath = '/apps/{app_id}/segments'; $formParams = []; $queryParams = []; $headerParams = []; @@ -3832,22 +3772,6 @@ public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $sub $resourcePath ); } - // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { - $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), - $resourcePath - ); - } if ($multipart) { @@ -3862,11 +3786,11 @@ public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $sub } // for model (json/xml) - if (isset($subscription_body)) { + if (isset($segment)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($segment)); } else { - $httpBody = $subscription_body; + $httpBody = $segment; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -3902,7 +3826,7 @@ public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $sub } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -3920,36 +3844,38 @@ public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $sub } /** - * Operation createTemplate - * - * Create template + * Operation createSubscription * - * @param \onesignal\client\model\CreateTemplateRequest $create_template_request create_template_request (required) + * @param string $app_id app_id (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\SubscriptionBody|\onesignal\client\model\SubscriptionBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function createTemplate($create_template_request) + public function createSubscription($app_id, $alias_label, $alias_id, $subscription_body) { - list($response) = $this->createTemplateWithHttpInfo($create_template_request); + list($response) = $this->createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body); return $response; } /** - * Operation createTemplateWithHttpInfo - * - * Create template + * Operation createSubscriptionWithHttpInfo * - * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\SubscriptionBody|\onesignal\client\model\SubscriptionBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function createTemplateWithHttpInfo($create_template_request) + public function createSubscriptionWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) { - $request = $this->createTemplateRequest($create_template_request); + $request = $this->createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body); try { $options = $this->createHttpClientOption(); @@ -3987,18 +3913,33 @@ public function createTemplateWithHttpInfo($create_template_request) } switch($statusCode) { - case 200: - if ('\onesignal\client\model\TemplateResource' === '\SplFileObject') { + case 201: + if ('\onesignal\client\model\SubscriptionBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\TemplateResource' !== 'string') { + if ('\onesignal\client\model\SubscriptionBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\TemplateResource', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\SubscriptionBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 202: + if ('\onesignal\client\model\SubscriptionBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\SubscriptionBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\SubscriptionBody', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4017,7 +3958,22 @@ public function createTemplateWithHttpInfo($create_template_request) $response->getStatusCode(), $response->getHeaders() ]; - case 422: + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -4032,9 +3988,24 @@ public function createTemplateWithHttpInfo($create_template_request) $response->getStatusCode(), $response->getHeaders() ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } - $returnType = '\onesignal\client\model\TemplateResource'; + $returnType = '\onesignal\client\model\SubscriptionBody'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -4052,10 +4023,18 @@ public function createTemplateWithHttpInfo($create_template_request) } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\TemplateResource', + '\onesignal\client\model\SubscriptionBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\SubscriptionBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4068,7 +4047,15 @@ public function createTemplateWithHttpInfo($create_template_request) ); $e->setResponseObject($data); break; - case 422: + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -4076,6 +4063,14 @@ public function createTemplateWithHttpInfo($create_template_request) ); $e->setResponseObject($data); break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -4090,18 +4085,19 @@ public function createTemplateWithHttpInfo($create_template_request) } /** - * Operation createTemplateAsync - * - * Create template - * - * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) + * Operation createSubscriptionAsync + * + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createTemplateAsync($create_template_request) + public function createSubscriptionAsync($app_id, $alias_label, $alias_id, $subscription_body) { - return $this->createTemplateAsyncWithHttpInfo($create_template_request) + return $this->createSubscriptionAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) ->then( function ($response) { return $response[0]; @@ -4110,19 +4106,20 @@ function ($response) { } /** - * Operation createTemplateAsyncWithHttpInfo - * - * Create template + * Operation createSubscriptionAsyncWithHttpInfo * - * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createTemplateAsyncWithHttpInfo($create_template_request) + public function createSubscriptionAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $subscription_body) { - $returnType = '\onesignal\client\model\TemplateResource'; - $request = $this->createTemplateRequest($create_template_request); + $returnType = '\onesignal\client\model\SubscriptionBody'; + $request = $this->createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4161,23 +4158,44 @@ function ($exception) { } /** - * Create request for operation 'createTemplate' + * Create request for operation 'createSubscription' * - * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createTemplateRequest($create_template_request) + public function createSubscriptionRequest($app_id, $alias_label, $alias_id, $subscription_body) { - // verify the required parameter 'create_template_request' is set - if ($create_template_request === null || (is_array($create_template_request) && count($create_template_request) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $create_template_request when calling createTemplate' + 'Missing the required parameter $app_id when calling createSubscription' + ); + } + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_label when calling createSubscription' + ); + } + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling createSubscription' + ); + } + // verify the required parameter 'subscription_body' is set + if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_body when calling createSubscription' ); } - $resourcePath = '/templates'; + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4186,6 +4204,30 @@ public function createTemplateRequest($create_template_request) + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($alias_label !== null) { + $resourcePath = str_replace( + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } if ($multipart) { @@ -4200,11 +4242,11 @@ public function createTemplateRequest($create_template_request) } // for model (json/xml) - if (isset($create_template_request)) { + if (isset($subscription_body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_request)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); } else { - $httpBody = $create_template_request; + $httpBody = $subscription_body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -4240,7 +4282,7 @@ public function createTemplateRequest($create_template_request) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -4258,34 +4300,36 @@ public function createTemplateRequest($create_template_request) } /** - * Operation createUser + * Operation createTemplate * - * @param string $app_id app_id (required) - * @param \onesignal\client\model\User $user user (required) + * Create template + * + * @param \onesignal\client\model\CreateTemplateRequest $create_template_request create_template_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\CreateUserConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function createUser($app_id, $user) + public function createTemplate($create_template_request) { - list($response) = $this->createUserWithHttpInfo($app_id, $user); + list($response) = $this->createTemplateWithHttpInfo($create_template_request); return $response; } /** - * Operation createUserWithHttpInfo + * Operation createTemplateWithHttpInfo * - * @param string $app_id (required) - * @param \onesignal\client\model\User $user (required) + * Create template + * + * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\CreateUserConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function createUserWithHttpInfo($app_id, $user) + public function createTemplateWithHttpInfo($create_template_request) { - $request = $this->createUserRequest($app_id, $user); + $request = $this->createTemplateRequest($create_template_request); try { $options = $this->createHttpClientOption(); @@ -4324,47 +4368,17 @@ public function createUserWithHttpInfo($app_id, $user) switch($statusCode) { case 200: - if ('\onesignal\client\model\User' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\User' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 201: - if ('\onesignal\client\model\User' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\User' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 202: - if ('\onesignal\client\model\User' === '\SplFileObject') { + if ('\onesignal\client\model\TemplateResource' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\User' !== 'string') { + if ('\onesignal\client\model\TemplateResource' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\TemplateResource', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4383,39 +4397,24 @@ public function createUserWithHttpInfo($app_id, $user) $response->getStatusCode(), $response->getHeaders() ]; - case 409: - if ('\onesignal\client\model\CreateUserConflictResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\CreateUserConflictResponse' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateUserConflictResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + case 422: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { + if ('\onesignal\client\model\GenericError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\onesignal\client\model\User'; + $returnType = '\onesignal\client\model\TemplateResource'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -4436,23 +4435,7 @@ public function createUserWithHttpInfo($app_id, $user) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\User', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\User', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\User', + '\onesignal\client\model\TemplateResource', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4465,18 +4448,10 @@ public function createUserWithHttpInfo($app_id, $user) ); $e->setResponseObject($data); break; - case 409: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\CreateUserConflictResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 429: + case 422: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', + '\onesignal\client\model\GenericError', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4495,17 +4470,18 @@ public function createUserWithHttpInfo($app_id, $user) } /** - * Operation createUserAsync + * Operation createTemplateAsync * - * @param string $app_id (required) - * @param \onesignal\client\model\User $user (required) + * Create template + * + * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createUserAsync($app_id, $user) + public function createTemplateAsync($create_template_request) { - return $this->createUserAsyncWithHttpInfo($app_id, $user) + return $this->createTemplateAsyncWithHttpInfo($create_template_request) ->then( function ($response) { return $response[0]; @@ -4514,18 +4490,19 @@ function ($response) { } /** - * Operation createUserAsyncWithHttpInfo + * Operation createTemplateAsyncWithHttpInfo * - * @param string $app_id (required) - * @param \onesignal\client\model\User $user (required) + * Create template + * + * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function createUserAsyncWithHttpInfo($app_id, $user) + public function createTemplateAsyncWithHttpInfo($create_template_request) { - $returnType = '\onesignal\client\model\User'; - $request = $this->createUserRequest($app_id, $user); + $returnType = '\onesignal\client\model\TemplateResource'; + $request = $this->createTemplateRequest($create_template_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4564,30 +4541,23 @@ function ($exception) { } /** - * Create request for operation 'createUser' + * Create request for operation 'createTemplate' * - * @param string $app_id (required) - * @param \onesignal\client\model\User $user (required) + * @param \onesignal\client\model\CreateTemplateRequest $create_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function createUserRequest($app_id, $user) + public function createTemplateRequest($create_template_request) { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling createUser' - ); - } - // verify the required parameter 'user' is set - if ($user === null || (is_array($user) && count($user) === 0)) { + // verify the required parameter 'create_template_request' is set + if ($create_template_request === null || (is_array($create_template_request) && count($create_template_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $user when calling createUser' + 'Missing the required parameter $create_template_request when calling createTemplate' ); } - $resourcePath = '/apps/{app_id}/users'; + $resourcePath = '/templates'; $formParams = []; $queryParams = []; $headerParams = []; @@ -4596,14 +4566,6 @@ public function createUserRequest($app_id, $user) - // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } if ($multipart) { @@ -4618,11 +4580,11 @@ public function createUserRequest($app_id, $user) } // for model (json/xml) - if (isset($user)) { + if (isset($create_template_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($user)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($create_template_request)); } else { - $httpBody = $user; + $httpBody = $create_template_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -4658,7 +4620,7 @@ public function createUserRequest($app_id, $user) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -4676,38 +4638,34 @@ public function createUserRequest($app_id, $user) } /** - * Operation deleteAlias + * Operation createUser * * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) - * @param string $alias_label_to_delete alias_label_to_delete (required) + * @param \onesignal\client\model\User $user user (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\CreateUserConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function deleteAlias($app_id, $alias_label, $alias_id, $alias_label_to_delete) + public function createUser($app_id, $user) { - list($response) = $this->deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete); + list($response) = $this->createUserWithHttpInfo($app_id, $user); return $response; } /** - * Operation deleteAliasWithHttpInfo + * Operation createUserWithHttpInfo * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param string $alias_label_to_delete (required) + * @param \onesignal\client\model\User $user (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\CreateUserConflictResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) + public function createUserWithHttpInfo($app_id, $user) { - $request = $this->deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete); + $request = $this->createUserRequest($app_id, $user); try { $options = $this->createHttpClientOption(); @@ -4746,36 +4704,51 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias switch($statusCode) { case 200: - if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { + if ('\onesignal\client\model\User' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UserIdentityBody' !== 'string') { + if ('\onesignal\client\model\User' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), $response->getStatusCode(), $response->getHeaders() ]; - case 400: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + case 201: + if ('\onesignal\client\model\User' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\User' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), $response->getStatusCode(), $response->getHeaders() ]; - case 404: + case 202: + if ('\onesignal\client\model\User' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\User' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -4791,17 +4764,17 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias $response->getHeaders() ]; case 409: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + if ('\onesignal\client\model\CreateUserConflictResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\CreateUserConflictResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateUserConflictResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -4822,7 +4795,7 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias ]; } - $returnType = '\onesignal\client\model\UserIdentityBody'; + $returnType = '\onesignal\client\model\User'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -4843,20 +4816,28 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UserIdentityBody', + '\onesignal\client\model\User', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\User', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\User', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -4867,7 +4848,7 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\CreateUserConflictResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -4894,19 +4875,17 @@ public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias } /** - * Operation deleteAliasAsync + * Operation createUserAsync * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param string $alias_label_to_delete (required) + * @param \onesignal\client\model\User $user (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteAliasAsync($app_id, $alias_label, $alias_id, $alias_label_to_delete) + public function createUserAsync($app_id, $user) { - return $this->deleteAliasAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) + return $this->createUserAsyncWithHttpInfo($app_id, $user) ->then( function ($response) { return $response[0]; @@ -4915,20 +4894,18 @@ function ($response) { } /** - * Operation deleteAliasAsyncWithHttpInfo + * Operation createUserAsyncWithHttpInfo * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param string $alias_label_to_delete (required) + * @param \onesignal\client\model\User $user (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteAliasAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) + public function createUserAsyncWithHttpInfo($app_id, $user) { - $returnType = '\onesignal\client\model\UserIdentityBody'; - $request = $this->deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete); + $returnType = '\onesignal\client\model\User'; + $request = $this->createUserRequest($app_id, $user); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -4967,44 +4944,30 @@ function ($exception) { } /** - * Create request for operation 'deleteAlias' + * Create request for operation 'createUser' * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param string $alias_label_to_delete (required) + * @param \onesignal\client\model\User $user (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete) + public function createUserRequest($app_id, $user) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteAlias' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling deleteAlias' - ); - } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling deleteAlias' + 'Missing the required parameter $app_id when calling createUser' ); } - // verify the required parameter 'alias_label_to_delete' is set - if ($alias_label_to_delete === null || (is_array($alias_label_to_delete) && count($alias_label_to_delete) === 0)) { + // verify the required parameter 'user' is set + if ($user === null || (is_array($user) && count($user) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label_to_delete when calling deleteAlias' + 'Missing the required parameter $user when calling createUser' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}'; + $resourcePath = '/apps/{app_id}/users'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5021,30 +4984,6 @@ public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_labe $resourcePath ); } - // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { - $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), - $resourcePath - ); - } - // path params - if ($alias_label_to_delete !== null) { - $resourcePath = str_replace( - '{' . 'alias_label_to_delete' . '}', - ObjectSerializer::toPathValue($alias_label_to_delete), - $resourcePath - ); - } if ($multipart) { @@ -5054,12 +4993,18 @@ public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_labe } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($user)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($user)); + } else { + $httpBody = $user; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -5093,7 +5038,7 @@ public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_labe } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -5103,7 +5048,7 @@ public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_labe $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'DELETE', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -5111,38 +5056,38 @@ public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_labe } /** - * Operation deleteApiKey - * - * Delete API key + * Operation deleteAlias * * @param string $app_id app_id (required) - * @param string $token_id token_id (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) + * @param string $alias_label_to_delete alias_label_to_delete (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function deleteApiKey($app_id, $token_id) + public function deleteAlias($app_id, $alias_label, $alias_id, $alias_label_to_delete) { - list($response) = $this->deleteApiKeyWithHttpInfo($app_id, $token_id); + list($response) = $this->deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete); return $response; } /** - * Operation deleteApiKeyWithHttpInfo - * - * Delete API key + * Operation deleteAliasWithHttpInfo * * @param string $app_id (required) - * @param string $token_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param string $alias_label_to_delete (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function deleteApiKeyWithHttpInfo($app_id, $token_id) + public function deleteAliasWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) { - $request = $this->deleteApiKeyRequest($app_id, $token_id); + $request = $this->deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete); try { $options = $this->createHttpClientOption(); @@ -5181,17 +5126,17 @@ public function deleteApiKeyWithHttpInfo($app_id, $token_id) switch($statusCode) { case 200: - if ('object' === '\SplFileObject') { + if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('object' !== 'string') { + if ('\onesignal\client\model\UserIdentityBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, 'object', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5210,30 +5155,75 @@ public function deleteApiKeyWithHttpInfo($app_id, $token_id) $response->getStatusCode(), $response->getHeaders() ]; - } - - $returnType = 'object'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'object', + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\UserIdentityBody'; + 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(), + '\onesignal\client\model\UserIdentityBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5246,6 +5236,30 @@ public function deleteApiKeyWithHttpInfo($app_id, $token_id) ); $e->setResponseObject($data); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -5260,19 +5274,19 @@ public function deleteApiKeyWithHttpInfo($app_id, $token_id) } /** - * Operation deleteApiKeyAsync - * - * Delete API key + * Operation deleteAliasAsync * * @param string $app_id (required) - * @param string $token_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param string $alias_label_to_delete (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteApiKeyAsync($app_id, $token_id) + public function deleteAliasAsync($app_id, $alias_label, $alias_id, $alias_label_to_delete) { - return $this->deleteApiKeyAsyncWithHttpInfo($app_id, $token_id) + return $this->deleteAliasAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) ->then( function ($response) { return $response[0]; @@ -5281,20 +5295,20 @@ function ($response) { } /** - * Operation deleteApiKeyAsyncWithHttpInfo - * - * Delete API key + * Operation deleteAliasAsyncWithHttpInfo * * @param string $app_id (required) - * @param string $token_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param string $alias_label_to_delete (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteApiKeyAsyncWithHttpInfo($app_id, $token_id) + public function deleteAliasAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $alias_label_to_delete) { - $returnType = 'object'; - $request = $this->deleteApiKeyRequest($app_id, $token_id); + $returnType = '\onesignal\client\model\UserIdentityBody'; + $request = $this->deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5333,30 +5347,44 @@ function ($exception) { } /** - * Create request for operation 'deleteApiKey' + * Create request for operation 'deleteAlias' * * @param string $app_id (required) - * @param string $token_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param string $alias_label_to_delete (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteApiKeyRequest($app_id, $token_id) + public function deleteAliasRequest($app_id, $alias_label, $alias_id, $alias_label_to_delete) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteApiKey' + 'Missing the required parameter $app_id when calling deleteAlias' ); } - // verify the required parameter 'token_id' is set - if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $token_id when calling deleteApiKey' + 'Missing the required parameter $alias_label when calling deleteAlias' + ); + } + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling deleteAlias' + ); + } + // verify the required parameter 'alias_label_to_delete' is set + if ($alias_label_to_delete === null || (is_array($alias_label_to_delete) && count($alias_label_to_delete) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_label_to_delete when calling deleteAlias' ); } - $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}'; + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5374,10 +5402,26 @@ public function deleteApiKeyRequest($app_id, $token_id) ); } // path params - if ($token_id !== null) { + if ($alias_label !== null) { $resourcePath = str_replace( - '{' . 'token_id' . '}', - ObjectSerializer::toPathValue($token_id), + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } + // path params + if ($alias_label_to_delete !== null) { + $resourcePath = str_replace( + '{' . 'alias_label_to_delete' . '}', + ObjectSerializer::toPathValue($alias_label_to_delete), $resourcePath ); } @@ -5419,8 +5463,8 @@ public function deleteApiKeyRequest($app_id, $token_id) } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -5429,7 +5473,7 @@ public function deleteApiKeyRequest($app_id, $token_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -5447,38 +5491,38 @@ public function deleteApiKeyRequest($app_id, $token_id) } /** - * Operation deleteSegment + * Operation deleteApiKey * - * Delete Segment + * Delete API key * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) + * @param string $app_id app_id (required) + * @param string $token_id token_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function deleteSegment($app_id, $segment_id) + public function deleteApiKey($app_id, $token_id) { - list($response) = $this->deleteSegmentWithHttpInfo($app_id, $segment_id); + list($response) = $this->deleteApiKeyWithHttpInfo($app_id, $token_id); return $response; } /** - * Operation deleteSegmentWithHttpInfo + * Operation deleteApiKeyWithHttpInfo * - * Delete Segment + * Delete API key * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) + * @param string $app_id (required) + * @param string $token_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function deleteSegmentWithHttpInfo($app_id, $segment_id) + public function deleteApiKeyWithHttpInfo($app_id, $token_id) { - $request = $this->deleteSegmentRequest($app_id, $segment_id); + $request = $this->deleteApiKeyRequest($app_id, $token_id); try { $options = $this->createHttpClientOption(); @@ -5517,17 +5561,17 @@ public function deleteSegmentWithHttpInfo($app_id, $segment_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { + if ('object' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { + if ('object' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), + ObjectSerializer::deserialize($content, 'object', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -5546,39 +5590,9 @@ public function deleteSegmentWithHttpInfo($app_id, $segment_id) $response->getStatusCode(), $response->getHeaders() ]; - case 404: - if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; } - $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + $returnType = 'object'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -5599,7 +5613,7 @@ public function deleteSegmentWithHttpInfo($app_id, $segment_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericSuccessBoolResponse', + 'object', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -5612,22 +5626,6 @@ public function deleteSegmentWithHttpInfo($app_id, $segment_id) ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericSuccessBoolResponse', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 429: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -5642,19 +5640,19 @@ public function deleteSegmentWithHttpInfo($app_id, $segment_id) } /** - * Operation deleteSegmentAsync + * Operation deleteApiKeyAsync * - * Delete Segment + * Delete API key * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) + * @param string $app_id (required) + * @param string $token_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSegmentAsync($app_id, $segment_id) + public function deleteApiKeyAsync($app_id, $token_id) { - return $this->deleteSegmentAsyncWithHttpInfo($app_id, $segment_id) + return $this->deleteApiKeyAsyncWithHttpInfo($app_id, $token_id) ->then( function ($response) { return $response[0]; @@ -5663,20 +5661,20 @@ function ($response) { } /** - * Operation deleteSegmentAsyncWithHttpInfo + * Operation deleteApiKeyAsyncWithHttpInfo * - * Delete Segment + * Delete API key * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) + * @param string $app_id (required) + * @param string $token_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSegmentAsyncWithHttpInfo($app_id, $segment_id) + public function deleteApiKeyAsyncWithHttpInfo($app_id, $token_id) { - $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; - $request = $this->deleteSegmentRequest($app_id, $segment_id); + $returnType = 'object'; + $request = $this->deleteApiKeyRequest($app_id, $token_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -5715,30 +5713,30 @@ function ($exception) { } /** - * Create request for operation 'deleteSegment' + * Create request for operation 'deleteApiKey' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) + * @param string $app_id (required) + * @param string $token_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteSegmentRequest($app_id, $segment_id) + public function deleteApiKeyRequest($app_id, $token_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteSegment' + 'Missing the required parameter $app_id when calling deleteApiKey' ); } - // verify the required parameter 'segment_id' is set - if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { + // verify the required parameter 'token_id' is set + if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $segment_id when calling deleteSegment' + 'Missing the required parameter $token_id when calling deleteApiKey' ); } - $resourcePath = '/apps/{app_id}/segments/{segment_id}'; + $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -5756,10 +5754,10 @@ public function deleteSegmentRequest($app_id, $segment_id) ); } // path params - if ($segment_id !== null) { + if ($token_id !== null) { $resourcePath = str_replace( - '{' . 'segment_id' . '}', - ObjectSerializer::toPathValue($segment_id), + '{' . 'token_id' . '}', + ObjectSerializer::toPathValue($token_id), $resourcePath ); } @@ -5801,8 +5799,8 @@ public function deleteSegmentRequest($app_id, $segment_id) } } - if (!empty($this->config->getRestApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); } $defaultHeaders = []; @@ -5811,7 +5809,7 @@ public function deleteSegmentRequest($app_id, $segment_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -5829,33 +5827,38 @@ public function deleteSegmentRequest($app_id, $segment_id) } /** - * Operation deleteSubscription + * Operation deleteJourney * - * @param string $app_id app_id (required) - * @param string $subscription_id subscription_id (required) + * Delete journey + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to delete. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return void + * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function deleteSubscription($app_id, $subscription_id) + public function deleteJourney($app_id, $journey_id) { - $this->deleteSubscriptionWithHttpInfo($app_id, $subscription_id); + list($response) = $this->deleteJourneyWithHttpInfo($app_id, $journey_id); + return $response; } /** - * Operation deleteSubscriptionWithHttpInfo + * Operation deleteJourneyWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Delete journey + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to delete. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function deleteSubscriptionWithHttpInfo($app_id, $subscription_id) + public function deleteJourneyWithHttpInfo($app_id, $journey_id) { - $request = $this->deleteSubscriptionRequest($app_id, $subscription_id); + $request = $this->deleteJourneyRequest($app_id, $journey_id); try { $options = $this->createHttpClientOption(); @@ -5892,19 +5895,96 @@ public function deleteSubscriptionWithHttpInfo($app_id, $subscription_id) ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 200: + if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + 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 400: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\GenericSuccessBoolResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 403: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -5912,7 +5992,7 @@ public function deleteSubscriptionWithHttpInfo($app_id, $subscription_id) ); $e->setResponseObject($data); break; - case 409: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -5942,17 +6022,19 @@ public function deleteSubscriptionWithHttpInfo($app_id, $subscription_id) } /** - * Operation deleteSubscriptionAsync + * Operation deleteJourneyAsync * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Delete journey + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to delete. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSubscriptionAsync($app_id, $subscription_id) + public function deleteJourneyAsync($app_id, $journey_id) { - return $this->deleteSubscriptionAsyncWithHttpInfo($app_id, $subscription_id) + return $this->deleteJourneyAsyncWithHttpInfo($app_id, $journey_id) ->then( function ($response) { return $response[0]; @@ -5961,24 +6043,39 @@ function ($response) { } /** - * Operation deleteSubscriptionAsyncWithHttpInfo + * Operation deleteJourneyAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Delete journey + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to delete. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteSubscriptionAsyncWithHttpInfo($app_id, $subscription_id) + public function deleteJourneyAsyncWithHttpInfo($app_id, $journey_id) { - $returnType = ''; - $request = $this->deleteSubscriptionRequest($app_id, $subscription_id); + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + $request = $this->deleteJourneyRequest($app_id, $journey_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -5998,30 +6095,30 @@ function ($exception) { } /** - * Create request for operation 'deleteSubscription' + * Create request for operation 'deleteJourney' * - * @param string $app_id (required) - * @param string $subscription_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to delete. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteSubscriptionRequest($app_id, $subscription_id) + public function deleteJourneyRequest($app_id, $journey_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteSubscription' + 'Missing the required parameter $app_id when calling deleteJourney' ); } - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + // verify the required parameter 'journey_id' is set + if ($journey_id === null || (is_array($journey_id) && count($journey_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling deleteSubscription' + 'Missing the required parameter $journey_id when calling deleteJourney' ); } - $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}'; + $resourcePath = '/apps/{app_id}/journeys/{journey_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6039,10 +6136,10 @@ public function deleteSubscriptionRequest($app_id, $subscription_id) ); } // path params - if ($subscription_id !== null) { + if ($journey_id !== null) { $resourcePath = str_replace( - '{' . 'subscription_id' . '}', - ObjectSerializer::toPathValue($subscription_id), + '{' . 'journey_id' . '}', + ObjectSerializer::toPathValue($journey_id), $resourcePath ); } @@ -6094,7 +6191,7 @@ public function deleteSubscriptionRequest($app_id, $subscription_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -6112,38 +6209,38 @@ public function deleteSubscriptionRequest($app_id, $subscription_id) } /** - * Operation deleteTemplate + * Operation deleteSegment * - * Delete template + * Delete Segment * - * @param string $template_id template_id (required) - * @param string $app_id app_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function deleteTemplate($template_id, $app_id) + public function deleteSegment($app_id, $segment_id) { - list($response) = $this->deleteTemplateWithHttpInfo($template_id, $app_id); + list($response) = $this->deleteSegmentWithHttpInfo($app_id, $segment_id); return $response; } /** - * Operation deleteTemplateWithHttpInfo + * Operation deleteSegmentWithHttpInfo * - * Delete template + * Delete Segment * - * @param string $template_id (required) - * @param string $app_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function deleteTemplateWithHttpInfo($template_id, $app_id) + public function deleteSegmentWithHttpInfo($app_id, $segment_id) { - $request = $this->deleteTemplateRequest($template_id, $app_id); + $request = $this->deleteSegmentRequest($app_id, $segment_id); try { $options = $this->createHttpClientOption(); @@ -6212,17 +6309,32 @@ public function deleteTemplateWithHttpInfo($template_id, $app_id) $response->getHeaders() ]; case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6265,7 +6377,15 @@ public function deleteTemplateWithHttpInfo($template_id, $app_id) case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\GenericSuccessBoolResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6284,19 +6404,19 @@ public function deleteTemplateWithHttpInfo($template_id, $app_id) } /** - * Operation deleteTemplateAsync + * Operation deleteSegmentAsync * - * Delete template + * Delete Segment * - * @param string $template_id (required) - * @param string $app_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteTemplateAsync($template_id, $app_id) + public function deleteSegmentAsync($app_id, $segment_id) { - return $this->deleteTemplateAsyncWithHttpInfo($template_id, $app_id) + return $this->deleteSegmentAsyncWithHttpInfo($app_id, $segment_id) ->then( function ($response) { return $response[0]; @@ -6305,20 +6425,20 @@ function ($response) { } /** - * Operation deleteTemplateAsyncWithHttpInfo + * Operation deleteSegmentAsyncWithHttpInfo * - * Delete template + * Delete Segment * - * @param string $template_id (required) - * @param string $app_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteTemplateAsyncWithHttpInfo($template_id, $app_id) + public function deleteSegmentAsyncWithHttpInfo($app_id, $segment_id) { $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; - $request = $this->deleteTemplateRequest($template_id, $app_id); + $request = $this->deleteSegmentRequest($app_id, $segment_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6357,52 +6477,51 @@ function ($exception) { } /** - * Create request for operation 'deleteTemplate' + * Create request for operation 'deleteSegment' * - * @param string $template_id (required) - * @param string $app_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment_id can be found in the URL of the segment when viewing it in the dashboard. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteTemplateRequest($template_id, $app_id) + public function deleteSegmentRequest($app_id, $segment_id) { - // verify the required parameter 'template_id' is set - if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $template_id when calling deleteTemplate' + 'Missing the required parameter $app_id when calling deleteSegment' ); } - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + // verify the required parameter 'segment_id' is set + if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteTemplate' + 'Missing the required parameter $segment_id when calling deleteSegment' ); } - $resourcePath = '/templates/{template_id}'; + $resourcePath = '/apps/{app_id}/segments/{segment_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $app_id, - 'app_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($template_id !== null) { + if ($app_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', - ObjectSerializer::toPathValue($template_id), + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($segment_id !== null) { + $resourcePath = str_replace( + '{' . 'segment_id' . '}', + ObjectSerializer::toPathValue($segment_id), $resourcePath ); } @@ -6454,7 +6573,7 @@ public function deleteTemplateRequest($template_id, $app_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -6472,35 +6591,33 @@ public function deleteTemplateRequest($template_id, $app_id) } /** - * Operation deleteUser + * Operation deleteSubscription * * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) + * @param string $subscription_id subscription_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return void */ - public function deleteUser($app_id, $alias_label, $alias_id) + public function deleteSubscription($app_id, $subscription_id) { - $this->deleteUserWithHttpInfo($app_id, $alias_label, $alias_id); + $this->deleteSubscriptionWithHttpInfo($app_id, $subscription_id); } /** - * Operation deleteUserWithHttpInfo + * Operation deleteSubscriptionWithHttpInfo * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $subscription_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function deleteUserWithHttpInfo($app_id, $alias_label, $alias_id) + public function deleteSubscriptionWithHttpInfo($app_id, $subscription_id) { - $request = $this->deleteUserRequest($app_id, $alias_label, $alias_id); + $request = $this->deleteSubscriptionRequest($app_id, $subscription_id); try { $options = $this->createHttpClientOption(); @@ -6549,6 +6666,14 @@ public function deleteUserWithHttpInfo($app_id, $alias_label, $alias_id) ); $e->setResponseObject($data); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -6579,18 +6704,17 @@ public function deleteUserWithHttpInfo($app_id, $alias_label, $alias_id) } /** - * Operation deleteUserAsync + * Operation deleteSubscriptionAsync * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteUserAsync($app_id, $alias_label, $alias_id) + public function deleteSubscriptionAsync($app_id, $subscription_id) { - return $this->deleteUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + return $this->deleteSubscriptionAsyncWithHttpInfo($app_id, $subscription_id) ->then( function ($response) { return $response[0]; @@ -6599,19 +6723,18 @@ function ($response) { } /** - * Operation deleteUserAsyncWithHttpInfo + * Operation deleteSubscriptionAsyncWithHttpInfo * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function deleteUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + public function deleteSubscriptionAsyncWithHttpInfo($app_id, $subscription_id) { $returnType = ''; - $request = $this->deleteUserRequest($app_id, $alias_label, $alias_id); + $request = $this->deleteSubscriptionRequest($app_id, $subscription_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -6637,37 +6760,30 @@ function ($exception) { } /** - * Create request for operation 'deleteUser' + * Create request for operation 'deleteSubscription' * * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function deleteUserRequest($app_id, $alias_label, $alias_id) + public function deleteSubscriptionRequest($app_id, $subscription_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling deleteUser' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling deleteUser' + 'Missing the required parameter $app_id when calling deleteSubscription' ); } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling deleteUser' + 'Missing the required parameter $subscription_id when calling deleteSubscription' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; + $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -6685,18 +6801,10 @@ public function deleteUserRequest($app_id, $alias_label, $alias_id) ); } // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { + if ($subscription_id !== null) { $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), + '{' . 'subscription_id' . '}', + ObjectSerializer::toPathValue($subscription_id), $resourcePath ); } @@ -6748,7 +6856,7 @@ public function deleteUserRequest($app_id, $alias_label, $alias_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -6766,38 +6874,38 @@ public function deleteUserRequest($app_id, $alias_label, $alias_id) } /** - * Operation exportEvents + * Operation deleteTemplate * - * Export CSV of Events + * Delete template * - * @param string $notification_id The ID of the notification to export events from. (required) - * @param string $app_id The ID of the app that the notification belongs to. (required) + * @param string $template_id template_id (required) + * @param string $app_id app_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\ExportEventsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function exportEvents($notification_id, $app_id) + public function deleteTemplate($template_id, $app_id) { - list($response) = $this->exportEventsWithHttpInfo($notification_id, $app_id); + list($response) = $this->deleteTemplateWithHttpInfo($template_id, $app_id); return $response; } /** - * Operation exportEventsWithHttpInfo + * Operation deleteTemplateWithHttpInfo * - * Export CSV of Events + * Delete template * - * @param string $notification_id The ID of the notification to export events from. (required) - * @param string $app_id The ID of the app that the notification belongs to. (required) + * @param string $template_id (required) + * @param string $app_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\ExportEventsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function exportEventsWithHttpInfo($notification_id, $app_id) + public function deleteTemplateWithHttpInfo($template_id, $app_id) { - $request = $this->exportEventsRequest($notification_id, $app_id); + $request = $this->deleteTemplateRequest($template_id, $app_id); try { $options = $this->createHttpClientOption(); @@ -6836,17 +6944,17 @@ public function exportEventsWithHttpInfo($notification_id, $app_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\ExportEventsSuccessResponse' === '\SplFileObject') { + if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\ExportEventsSuccessResponse' !== 'string') { + if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\ExportEventsSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -6880,24 +6988,9 @@ public function exportEventsWithHttpInfo($notification_id, $app_id) $response->getStatusCode(), $response->getHeaders() ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; } - $returnType = '\onesignal\client\model\ExportEventsSuccessResponse'; + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -6918,7 +7011,7 @@ public function exportEventsWithHttpInfo($notification_id, $app_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\ExportEventsSuccessResponse', + '\onesignal\client\model\GenericSuccessBoolResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -6939,14 +7032,6 @@ public function exportEventsWithHttpInfo($notification_id, $app_id) ); $e->setResponseObject($data); break; - case 429: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -6961,19 +7046,19 @@ public function exportEventsWithHttpInfo($notification_id, $app_id) } /** - * Operation exportEventsAsync + * Operation deleteTemplateAsync * - * Export CSV of Events + * Delete template * - * @param string $notification_id The ID of the notification to export events from. (required) - * @param string $app_id The ID of the app that the notification belongs to. (required) + * @param string $template_id (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function exportEventsAsync($notification_id, $app_id) + public function deleteTemplateAsync($template_id, $app_id) { - return $this->exportEventsAsyncWithHttpInfo($notification_id, $app_id) + return $this->deleteTemplateAsyncWithHttpInfo($template_id, $app_id) ->then( function ($response) { return $response[0]; @@ -6982,20 +7067,20 @@ function ($response) { } /** - * Operation exportEventsAsyncWithHttpInfo + * Operation deleteTemplateAsyncWithHttpInfo * - * Export CSV of Events + * Delete template * - * @param string $notification_id The ID of the notification to export events from. (required) - * @param string $app_id The ID of the app that the notification belongs to. (required) + * @param string $template_id (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function exportEventsAsyncWithHttpInfo($notification_id, $app_id) + public function deleteTemplateAsyncWithHttpInfo($template_id, $app_id) { - $returnType = '\onesignal\client\model\ExportEventsSuccessResponse'; - $request = $this->exportEventsRequest($notification_id, $app_id); + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + $request = $this->deleteTemplateRequest($template_id, $app_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7034,30 +7119,30 @@ function ($exception) { } /** - * Create request for operation 'exportEvents' + * Create request for operation 'deleteTemplate' * - * @param string $notification_id The ID of the notification to export events from. (required) - * @param string $app_id The ID of the app that the notification belongs to. (required) + * @param string $template_id (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function exportEventsRequest($notification_id, $app_id) + public function deleteTemplateRequest($template_id, $app_id) { - // verify the required parameter 'notification_id' is set - if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $notification_id when calling exportEvents' + 'Missing the required parameter $template_id when calling deleteTemplate' ); } // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling exportEvents' + 'Missing the required parameter $app_id when calling deleteTemplate' ); } - $resourcePath = '/notifications/{notification_id}/export_events'; + $resourcePath = '/templates/{template_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7076,10 +7161,10 @@ public function exportEventsRequest($notification_id, $app_id) // path params - if ($notification_id !== null) { + if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'notification_id' . '}', - ObjectSerializer::toPathValue($notification_id), + '{' . 'template_id' . '}', + ObjectSerializer::toPathValue($template_id), $resourcePath ); } @@ -7131,7 +7216,7 @@ public function exportEventsRequest($notification_id, $app_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -7141,7 +7226,7 @@ public function exportEventsRequest($notification_id, $app_id) $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7149,38 +7234,35 @@ public function exportEventsRequest($notification_id, $app_id) } /** - * Operation exportSubscriptions + * Operation deleteUser * - * Export CSV of Subscriptions - * - * @param string $app_id The app ID that you want to export devices from (required) - * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body export_subscriptions_request_body (optional) + * @param string $app_id app_id (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\ExportSubscriptionsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return void */ - public function exportSubscriptions($app_id, $export_subscriptions_request_body = null) + public function deleteUser($app_id, $alias_label, $alias_id) { - list($response) = $this->exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_request_body); - return $response; + $this->deleteUserWithHttpInfo($app_id, $alias_label, $alias_id); } /** - * Operation exportSubscriptionsWithHttpInfo - * - * Export CSV of Subscriptions + * Operation deleteUserWithHttpInfo * - * @param string $app_id The app ID that you want to export devices from (required) - * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\ExportSubscriptionsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_request_body = null) + public function deleteUserWithHttpInfo($app_id, $alias_label, $alias_id) { - $request = $this->exportSubscriptionsRequest($app_id, $export_subscriptions_request_body); + $request = $this->deleteUserRequest($app_id, $alias_label, $alias_id); try { $options = $this->createHttpClientOption(); @@ -7217,81 +7299,19 @@ public function exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_r ); } - switch($statusCode) { - case 200: - if ('\onesignal\client\model\ExportSubscriptionsSuccessResponse' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\ExportSubscriptionsSuccessResponse' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\ExportSubscriptionsSuccessResponse', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\onesignal\client\model\ExportSubscriptionsSuccessResponse'; - 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() - ]; + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\ExportSubscriptionsSuccessResponse', + '\onesignal\client\model\GenericError', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -7321,19 +7341,18 @@ public function exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_r } /** - * Operation exportSubscriptionsAsync - * - * Export CSV of Subscriptions + * Operation deleteUserAsync * - * @param string $app_id The app ID that you want to export devices from (required) - * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function exportSubscriptionsAsync($app_id, $export_subscriptions_request_body = null) + public function deleteUserAsync($app_id, $alias_label, $alias_id) { - return $this->exportSubscriptionsAsyncWithHttpInfo($app_id, $export_subscriptions_request_body) + return $this->deleteUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) ->then( function ($response) { return $response[0]; @@ -7342,39 +7361,25 @@ function ($response) { } /** - * Operation exportSubscriptionsAsyncWithHttpInfo - * - * Export CSV of Subscriptions + * Operation deleteUserAsyncWithHttpInfo * - * @param string $app_id The app ID that you want to export devices from (required) - * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function exportSubscriptionsAsyncWithHttpInfo($app_id, $export_subscriptions_request_body = null) + public function deleteUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) { - $returnType = '\onesignal\client\model\ExportSubscriptionsSuccessResponse'; - $request = $this->exportSubscriptionsRequest($app_id, $export_subscriptions_request_body); + $returnType = ''; + $request = $this->deleteUserRequest($app_id, $alias_label, $alias_id); 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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -7394,24 +7399,37 @@ function ($exception) { } /** - * Create request for operation 'exportSubscriptions' + * Create request for operation 'deleteUser' * - * @param string $app_id The app ID that you want to export devices from (required) - * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function exportSubscriptionsRequest($app_id, $export_subscriptions_request_body = null) + public function deleteUserRequest($app_id, $alias_label, $alias_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling exportSubscriptions' + 'Missing the required parameter $app_id when calling deleteUser' + ); + } + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_label when calling deleteUser' + ); + } + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling deleteUser' ); } - $resourcePath = '/players/csv_export?app_id={app_id}'; + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -7428,6 +7446,22 @@ public function exportSubscriptionsRequest($app_id, $export_subscriptions_reques $resourcePath ); } + // path params + if ($alias_label !== null) { + $resourcePath = str_replace( + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } if ($multipart) { @@ -7437,18 +7471,12 @@ public function exportSubscriptionsRequest($app_id, $export_subscriptions_reques } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($export_subscriptions_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($export_subscriptions_request_body)); - } else { - $httpBody = $export_subscriptions_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -7482,7 +7510,7 @@ public function exportSubscriptionsRequest($app_id, $export_subscriptions_reques } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -7492,7 +7520,7 @@ public function exportSubscriptionsRequest($app_id, $export_subscriptions_reques $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'DELETE', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7500,36 +7528,38 @@ public function exportSubscriptionsRequest($app_id, $export_subscriptions_reques } /** - * Operation getAliases + * Operation exportEvents * - * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) + * Export CSV of Events + * + * @param string $notification_id The ID of the notification to export events from. (required) + * @param string $app_id The ID of the app that the notification belongs to. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\ExportEventsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getAliases($app_id, $alias_label, $alias_id) + public function exportEvents($notification_id, $app_id) { - list($response) = $this->getAliasesWithHttpInfo($app_id, $alias_label, $alias_id); + list($response) = $this->exportEventsWithHttpInfo($notification_id, $app_id); return $response; } /** - * Operation getAliasesWithHttpInfo + * Operation exportEventsWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * Export CSV of Events + * + * @param string $notification_id The ID of the notification to export events from. (required) + * @param string $app_id The ID of the app that the notification belongs to. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\ExportEventsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) + public function exportEventsWithHttpInfo($notification_id, $app_id) { - $request = $this->getAliasesRequest($app_id, $alias_label, $alias_id); + $request = $this->exportEventsRequest($notification_id, $app_id); try { $options = $this->createHttpClientOption(); @@ -7568,17 +7598,17 @@ public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { + if ('\onesignal\client\model\ExportEventsSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UserIdentityBody' !== 'string') { + if ('\onesignal\client\model\ExportEventsSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\ExportEventsSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7629,7 +7659,7 @@ public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) ]; } - $returnType = '\onesignal\client\model\UserIdentityBody'; + $returnType = '\onesignal\client\model\ExportEventsSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -7650,7 +7680,7 @@ public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UserIdentityBody', + '\onesignal\client\model\ExportEventsSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -7693,18 +7723,19 @@ public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) } /** - * Operation getAliasesAsync + * Operation exportEventsAsync * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * Export CSV of Events + * + * @param string $notification_id The ID of the notification to export events from. (required) + * @param string $app_id The ID of the app that the notification belongs to. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAliasesAsync($app_id, $alias_label, $alias_id) + public function exportEventsAsync($notification_id, $app_id) { - return $this->getAliasesAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + return $this->exportEventsAsyncWithHttpInfo($notification_id, $app_id) ->then( function ($response) { return $response[0]; @@ -7713,19 +7744,20 @@ function ($response) { } /** - * Operation getAliasesAsyncWithHttpInfo + * Operation exportEventsAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * Export CSV of Events + * + * @param string $notification_id The ID of the notification to export events from. (required) + * @param string $app_id The ID of the app that the notification belongs to. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAliasesAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + public function exportEventsAsyncWithHttpInfo($notification_id, $app_id) { - $returnType = '\onesignal\client\model\UserIdentityBody'; - $request = $this->getAliasesRequest($app_id, $alias_label, $alias_id); + $returnType = '\onesignal\client\model\ExportEventsSuccessResponse'; + $request = $this->exportEventsRequest($notification_id, $app_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -7764,66 +7796,52 @@ function ($exception) { } /** - * Create request for operation 'getAliases' + * Create request for operation 'exportEvents' * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $notification_id The ID of the notification to export events from. (required) + * @param string $app_id The ID of the app that the notification belongs to. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAliasesRequest($app_id, $alias_label, $alias_id) + public function exportEventsRequest($notification_id, $app_id) { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getAliases' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { + // verify the required parameter 'notification_id' is set + if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling getAliases' + 'Missing the required parameter $notification_id when calling exportEvents' ); } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling getAliases' + 'Missing the required parameter $app_id when calling exportEvents' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'; + $resourcePath = '/notifications/{notification_id}/export_events'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $app_id, + 'app_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } - // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { + if ($notification_id !== null) { $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), + '{' . 'notification_id' . '}', + ObjectSerializer::toPathValue($notification_id), $resourcePath ); } @@ -7875,7 +7893,7 @@ public function getAliasesRequest($app_id, $alias_label, $alias_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -7885,7 +7903,7 @@ public function getAliasesRequest($app_id, $alias_label, $alias_id) $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -7893,34 +7911,38 @@ public function getAliasesRequest($app_id, $alias_label, $alias_id) } /** - * Operation getAliasesBySubscription + * Operation exportSubscriptions * - * @param string $app_id app_id (required) - * @param string $subscription_id subscription_id (required) + * Export CSV of Subscriptions + * + * @param string $app_id The app ID that you want to export devices from (required) + * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body export_subscriptions_request_body (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\ExportSubscriptionsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getAliasesBySubscription($app_id, $subscription_id) + public function exportSubscriptions($app_id, $export_subscriptions_request_body = null) { - list($response) = $this->getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id); + list($response) = $this->exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_request_body); return $response; } /** - * Operation getAliasesBySubscriptionWithHttpInfo + * Operation exportSubscriptionsWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Export CSV of Subscriptions + * + * @param string $app_id The app ID that you want to export devices from (required) + * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\ExportSubscriptionsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) + public function exportSubscriptionsWithHttpInfo($app_id, $export_subscriptions_request_body = null) { - $request = $this->getAliasesBySubscriptionRequest($app_id, $subscription_id); + $request = $this->exportSubscriptionsRequest($app_id, $export_subscriptions_request_body); try { $options = $this->createHttpClientOption(); @@ -7959,17 +7981,17 @@ public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { + if ('\onesignal\client\model\ExportSubscriptionsSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UserIdentityBody' !== 'string') { + if ('\onesignal\client\model\ExportSubscriptionsSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\ExportSubscriptionsSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -7988,24 +8010,24 @@ public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) $response->getStatusCode(), $response->getHeaders() ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\RateLimitError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\onesignal\client\model\UserIdentityBody'; + $returnType = '\onesignal\client\model\ExportSubscriptionsSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -8026,7 +8048,7 @@ public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UserIdentityBody', + '\onesignal\client\model\ExportSubscriptionsSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8039,10 +8061,10 @@ public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) ); $e->setResponseObject($data); break; - case 404: + case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\RateLimitError', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8061,17 +8083,19 @@ public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) } /** - * Operation getAliasesBySubscriptionAsync + * Operation exportSubscriptionsAsync * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Export CSV of Subscriptions + * + * @param string $app_id The app ID that you want to export devices from (required) + * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAliasesBySubscriptionAsync($app_id, $subscription_id) + public function exportSubscriptionsAsync($app_id, $export_subscriptions_request_body = null) { - return $this->getAliasesBySubscriptionAsyncWithHttpInfo($app_id, $subscription_id) + return $this->exportSubscriptionsAsyncWithHttpInfo($app_id, $export_subscriptions_request_body) ->then( function ($response) { return $response[0]; @@ -8080,18 +8104,20 @@ function ($response) { } /** - * Operation getAliasesBySubscriptionAsyncWithHttpInfo + * Operation exportSubscriptionsAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) + * Export CSV of Subscriptions + * + * @param string $app_id The app ID that you want to export devices from (required) + * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAliasesBySubscriptionAsyncWithHttpInfo($app_id, $subscription_id) + public function exportSubscriptionsAsyncWithHttpInfo($app_id, $export_subscriptions_request_body = null) { - $returnType = '\onesignal\client\model\UserIdentityBody'; - $request = $this->getAliasesBySubscriptionRequest($app_id, $subscription_id); + $returnType = '\onesignal\client\model\ExportSubscriptionsSuccessResponse'; + $request = $this->exportSubscriptionsRequest($app_id, $export_subscriptions_request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8130,30 +8156,24 @@ function ($exception) { } /** - * Create request for operation 'getAliasesBySubscription' + * Create request for operation 'exportSubscriptions' * - * @param string $app_id (required) - * @param string $subscription_id (required) + * @param string $app_id The app ID that you want to export devices from (required) + * @param \onesignal\client\model\ExportSubscriptionsRequestBody $export_subscriptions_request_body (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAliasesBySubscriptionRequest($app_id, $subscription_id) + public function exportSubscriptionsRequest($app_id, $export_subscriptions_request_body = null) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getAliasesBySubscription' - ); - } - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling getAliasesBySubscription' + 'Missing the required parameter $app_id when calling exportSubscriptions' ); } - $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'; + $resourcePath = '/players/csv_export?app_id={app_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8170,14 +8190,6 @@ public function getAliasesBySubscriptionRequest($app_id, $subscription_id) $resourcePath ); } - // path params - if ($subscription_id !== null) { - $resourcePath = str_replace( - '{' . 'subscription_id' . '}', - ObjectSerializer::toPathValue($subscription_id), - $resourcePath - ); - } if ($multipart) { @@ -8187,12 +8199,18 @@ public function getAliasesBySubscriptionRequest($app_id, $subscription_id) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($export_subscriptions_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($export_subscriptions_request_body)); + } else { + $httpBody = $export_subscriptions_request_body; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -8226,7 +8244,7 @@ public function getAliasesBySubscriptionRequest($app_id, $subscription_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -8236,7 +8254,7 @@ public function getAliasesBySubscriptionRequest($app_id, $subscription_id) $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -8244,36 +8262,36 @@ public function getAliasesBySubscriptionRequest($app_id, $subscription_id) } /** - * Operation getApp - * - * View an app + * Operation getAliases * - * @param string $app_id An app id (required) + * @param string $app_id app_id (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getApp($app_id) + public function getAliases($app_id, $alias_label, $alias_id) { - list($response) = $this->getAppWithHttpInfo($app_id); + list($response) = $this->getAliasesWithHttpInfo($app_id, $alias_label, $alias_id); return $response; } /** - * Operation getAppWithHttpInfo - * - * View an app + * Operation getAliasesWithHttpInfo * - * @param string $app_id An app id (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getAppWithHttpInfo($app_id) + public function getAliasesWithHttpInfo($app_id, $alias_label, $alias_id) { - $request = $this->getAppRequest($app_id); + $request = $this->getAliasesRequest($app_id, $alias_label, $alias_id); try { $options = $this->createHttpClientOption(); @@ -8312,17 +8330,17 @@ public function getAppWithHttpInfo($app_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\App' === '\SplFileObject') { + if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\App' !== 'string') { + if ('\onesignal\client\model\UserIdentityBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\App', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8336,6 +8354,21 @@ public function getAppWithHttpInfo($app_id) } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -8358,7 +8391,7 @@ public function getAppWithHttpInfo($app_id) ]; } - $returnType = '\onesignal\client\model\App'; + $returnType = '\onesignal\client\model\UserIdentityBody'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -8379,7 +8412,7 @@ public function getAppWithHttpInfo($app_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\App', + '\onesignal\client\model\UserIdentityBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8392,6 +8425,14 @@ public function getAppWithHttpInfo($app_id) ); $e->setResponseObject($data); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -8414,18 +8455,18 @@ public function getAppWithHttpInfo($app_id) } /** - * Operation getAppAsync - * - * View an app + * Operation getAliasesAsync * - * @param string $app_id An app id (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAppAsync($app_id) + public function getAliasesAsync($app_id, $alias_label, $alias_id) { - return $this->getAppAsyncWithHttpInfo($app_id) + return $this->getAliasesAsyncWithHttpInfo($app_id, $alias_label, $alias_id) ->then( function ($response) { return $response[0]; @@ -8434,19 +8475,19 @@ function ($response) { } /** - * Operation getAppAsyncWithHttpInfo - * - * View an app + * Operation getAliasesAsyncWithHttpInfo * - * @param string $app_id An app id (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAppAsyncWithHttpInfo($app_id) + public function getAliasesAsyncWithHttpInfo($app_id, $alias_label, $alias_id) { - $returnType = '\onesignal\client\model\App'; - $request = $this->getAppRequest($app_id); + $returnType = '\onesignal\client\model\UserIdentityBody'; + $request = $this->getAliasesRequest($app_id, $alias_label, $alias_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8485,23 +8526,37 @@ function ($exception) { } /** - * Create request for operation 'getApp' + * Create request for operation 'getAliases' * - * @param string $app_id An app id (required) + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAppRequest($app_id) + public function getAliasesRequest($app_id, $alias_label, $alias_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getApp' + 'Missing the required parameter $app_id when calling getAliases' + ); + } + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_label when calling getAliases' + ); + } + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling getAliases' ); } - $resourcePath = '/apps/{app_id}'; + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8518,6 +8573,22 @@ public function getAppRequest($app_id) $resourcePath ); } + // path params + if ($alias_label !== null) { + $resourcePath = str_replace( + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_id), + $resourcePath + ); + } if ($multipart) { @@ -8556,8 +8627,8 @@ public function getAppRequest($app_id) } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -8566,7 +8637,7 @@ public function getAppRequest($app_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -8584,34 +8655,34 @@ public function getAppRequest($app_id) } /** - * Operation getApps - * - * View apps + * Operation getAliasesBySubscription * + * @param string $app_id app_id (required) + * @param string $subscription_id subscription_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\App[]|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function getApps() + public function getAliasesBySubscription($app_id, $subscription_id) { - list($response) = $this->getAppsWithHttpInfo(); + list($response) = $this->getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id); return $response; } /** - * Operation getAppsWithHttpInfo - * - * View apps + * Operation getAliasesBySubscriptionWithHttpInfo * + * @param string $app_id (required) + * @param string $subscription_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\App[]|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getAppsWithHttpInfo() + public function getAliasesBySubscriptionWithHttpInfo($app_id, $subscription_id) { - $request = $this->getAppsRequest(); + $request = $this->getAliasesBySubscriptionRequest($app_id, $subscription_id); try { $options = $this->createHttpClientOption(); @@ -8650,17 +8721,17 @@ public function getAppsWithHttpInfo() switch($statusCode) { case 200: - if ('\onesignal\client\model\App[]' === '\SplFileObject') { + if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\App[]' !== 'string') { + if ('\onesignal\client\model\UserIdentityBody' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\App[]', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8679,24 +8750,24 @@ public function getAppsWithHttpInfo() $response->getStatusCode(), $response->getHeaders() ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { + if ('\onesignal\client\model\GenericError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\onesignal\client\model\App[]'; + $returnType = '\onesignal\client\model\UserIdentityBody'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -8717,7 +8788,7 @@ public function getAppsWithHttpInfo() case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\App[]', + '\onesignal\client\model\UserIdentityBody', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8730,10 +8801,10 @@ public function getAppsWithHttpInfo() ); $e->setResponseObject($data); break; - case 429: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', + '\onesignal\client\model\GenericError', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -8752,17 +8823,17 @@ public function getAppsWithHttpInfo() } /** - * Operation getAppsAsync - * - * View apps + * Operation getAliasesBySubscriptionAsync * + * @param string $app_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAppsAsync() + public function getAliasesBySubscriptionAsync($app_id, $subscription_id) { - return $this->getAppsAsyncWithHttpInfo() + return $this->getAliasesBySubscriptionAsyncWithHttpInfo($app_id, $subscription_id) ->then( function ($response) { return $response[0]; @@ -8771,18 +8842,18 @@ function ($response) { } /** - * Operation getAppsAsyncWithHttpInfo - * - * View apps + * Operation getAliasesBySubscriptionAsyncWithHttpInfo * + * @param string $app_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getAppsAsyncWithHttpInfo() + public function getAliasesBySubscriptionAsyncWithHttpInfo($app_id, $subscription_id) { - $returnType = '\onesignal\client\model\App[]'; - $request = $this->getAppsRequest(); + $returnType = '\onesignal\client\model\UserIdentityBody'; + $request = $this->getAliasesBySubscriptionRequest($app_id, $subscription_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -8821,16 +8892,30 @@ function ($exception) { } /** - * Create request for operation 'getApps' + * Create request for operation 'getAliasesBySubscription' * + * @param string $app_id (required) + * @param string $subscription_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getAppsRequest() + public function getAliasesBySubscriptionRequest($app_id, $subscription_id) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling getAliasesBySubscription' + ); + } + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling getAliasesBySubscription' + ); + } - $resourcePath = '/apps'; + $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'; $formParams = []; $queryParams = []; $headerParams = []; @@ -8839,6 +8924,22 @@ public function getAppsRequest() + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{' . 'subscription_id' . '}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } if ($multipart) { @@ -8877,8 +8978,8 @@ public function getAppsRequest() } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -8887,7 +8988,7 @@ public function getAppsRequest() } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -8905,38 +9006,36 @@ public function getAppsRequest() } /** - * Operation getNotification + * Operation getApp * - * View notification + * View an app * - * @param string $app_id app_id (required) - * @param string $notification_id notification_id (required) + * @param string $app_id An app id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\NotificationWithMeta|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getNotification($app_id, $notification_id) + public function getApp($app_id) { - list($response) = $this->getNotificationWithHttpInfo($app_id, $notification_id); + list($response) = $this->getAppWithHttpInfo($app_id); return $response; } /** - * Operation getNotificationWithHttpInfo + * Operation getAppWithHttpInfo * - * View notification + * View an app * - * @param string $app_id (required) - * @param string $notification_id (required) + * @param string $app_id An app id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\NotificationWithMeta|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getNotificationWithHttpInfo($app_id, $notification_id) + public function getAppWithHttpInfo($app_id) { - $request = $this->getNotificationRequest($app_id, $notification_id); + $request = $this->getAppRequest($app_id); try { $options = $this->createHttpClientOption(); @@ -8975,17 +9074,17 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\NotificationWithMeta' === '\SplFileObject') { + if ('\onesignal\client\model\App' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\NotificationWithMeta' !== 'string') { + if ('\onesignal\client\model\App' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationWithMeta', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\App', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -8999,21 +9098,6 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) } } - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -9036,7 +9120,7 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) ]; } - $returnType = '\onesignal\client\model\NotificationWithMeta'; + $returnType = '\onesignal\client\model\App'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -9057,7 +9141,7 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\NotificationWithMeta', + '\onesignal\client\model\App', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9070,14 +9154,6 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -9100,19 +9176,18 @@ public function getNotificationWithHttpInfo($app_id, $notification_id) } /** - * Operation getNotificationAsync + * Operation getAppAsync * - * View notification + * View an app * - * @param string $app_id (required) - * @param string $notification_id (required) + * @param string $app_id An app id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationAsync($app_id, $notification_id) + public function getAppAsync($app_id) { - return $this->getNotificationAsyncWithHttpInfo($app_id, $notification_id) + return $this->getAppAsyncWithHttpInfo($app_id) ->then( function ($response) { return $response[0]; @@ -9121,20 +9196,19 @@ function ($response) { } /** - * Operation getNotificationAsyncWithHttpInfo + * Operation getAppAsyncWithHttpInfo * - * View notification + * View an app * - * @param string $app_id (required) - * @param string $notification_id (required) + * @param string $app_id An app id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationAsyncWithHttpInfo($app_id, $notification_id) + public function getAppAsyncWithHttpInfo($app_id) { - $returnType = '\onesignal\client\model\NotificationWithMeta'; - $request = $this->getNotificationRequest($app_id, $notification_id); + $returnType = '\onesignal\client\model\App'; + $request = $this->getAppRequest($app_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9173,52 +9247,36 @@ function ($exception) { } /** - * Create request for operation 'getNotification' + * Create request for operation 'getApp' * - * @param string $app_id (required) - * @param string $notification_id (required) + * @param string $app_id An app id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getNotificationRequest($app_id, $notification_id) + public function getAppRequest($app_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getNotification' - ); - } - // verify the required parameter 'notification_id' is set - if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $notification_id when calling getNotification' + 'Missing the required parameter $app_id when calling getApp' ); } - $resourcePath = '/notifications/{notification_id}'; + $resourcePath = '/apps/{app_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $app_id, - 'app_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params - if ($notification_id !== null) { + if ($app_id !== null) { $resourcePath = str_replace( - '{' . 'notification_id' . '}', - ObjectSerializer::toPathValue($notification_id), + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), $resourcePath ); } @@ -9260,8 +9318,8 @@ public function getNotificationRequest($app_id, $notification_id) } } - if (!empty($this->config->getRestApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); } $defaultHeaders = []; @@ -9270,7 +9328,7 @@ public function getNotificationRequest($app_id, $notification_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -9288,38 +9346,34 @@ public function getNotificationRequest($app_id, $notification_id) } /** - * Operation getNotificationHistory + * Operation getApps * - * Notification History + * View apps * - * @param string $notification_id The \"id\" of the message found in the Notification object (required) - * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body get_notification_history_request_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\NotificationHistorySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\App[]|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getNotificationHistory($notification_id, $get_notification_history_request_body) + public function getApps() { - list($response) = $this->getNotificationHistoryWithHttpInfo($notification_id, $get_notification_history_request_body); + list($response) = $this->getAppsWithHttpInfo(); return $response; } /** - * Operation getNotificationHistoryWithHttpInfo + * Operation getAppsWithHttpInfo * - * Notification History + * View apps * - * @param string $notification_id The \"id\" of the message found in the Notification object (required) - * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\NotificationHistorySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\App[]|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getNotificationHistoryWithHttpInfo($notification_id, $get_notification_history_request_body) + public function getAppsWithHttpInfo() { - $request = $this->getNotificationHistoryRequest($notification_id, $get_notification_history_request_body); + $request = $this->getAppsRequest(); try { $options = $this->createHttpClientOption(); @@ -9358,17 +9412,17 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi switch($statusCode) { case 200: - if ('\onesignal\client\model\NotificationHistorySuccessResponse' === '\SplFileObject') { + if ('\onesignal\client\model\App[]' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\NotificationHistorySuccessResponse' !== 'string') { + if ('\onesignal\client\model\App[]' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationHistorySuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\App[]', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9382,21 +9436,6 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi } } - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -9419,7 +9458,7 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi ]; } - $returnType = '\onesignal\client\model\NotificationHistorySuccessResponse'; + $returnType = '\onesignal\client\model\App[]'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -9440,7 +9479,7 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\NotificationHistorySuccessResponse', + '\onesignal\client\model\App[]', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9453,14 +9492,6 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -9483,19 +9514,17 @@ public function getNotificationHistoryWithHttpInfo($notification_id, $get_notifi } /** - * Operation getNotificationHistoryAsync + * Operation getAppsAsync * - * Notification History + * View apps * - * @param string $notification_id The \"id\" of the message found in the Notification object (required) - * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationHistoryAsync($notification_id, $get_notification_history_request_body) + public function getAppsAsync() { - return $this->getNotificationHistoryAsyncWithHttpInfo($notification_id, $get_notification_history_request_body) + return $this->getAppsAsyncWithHttpInfo() ->then( function ($response) { return $response[0]; @@ -9504,20 +9533,18 @@ function ($response) { } /** - * Operation getNotificationHistoryAsyncWithHttpInfo + * Operation getAppsAsyncWithHttpInfo * - * Notification History + * View apps * - * @param string $notification_id The \"id\" of the message found in the Notification object (required) - * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationHistoryAsyncWithHttpInfo($notification_id, $get_notification_history_request_body) + public function getAppsAsyncWithHttpInfo() { - $returnType = '\onesignal\client\model\NotificationHistorySuccessResponse'; - $request = $this->getNotificationHistoryRequest($notification_id, $get_notification_history_request_body); + $returnType = '\onesignal\client\model\App[]'; + $request = $this->getAppsRequest(); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9556,30 +9583,16 @@ function ($exception) { } /** - * Create request for operation 'getNotificationHistory' + * Create request for operation 'getApps' * - * @param string $notification_id The \"id\" of the message found in the Notification object (required) - * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getNotificationHistoryRequest($notification_id, $get_notification_history_request_body) + public function getAppsRequest() { - // verify the required parameter 'notification_id' is set - if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $notification_id when calling getNotificationHistory' - ); - } - // verify the required parameter 'get_notification_history_request_body' is set - if ($get_notification_history_request_body === null || (is_array($get_notification_history_request_body) && count($get_notification_history_request_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $get_notification_history_request_body when calling getNotificationHistory' - ); - } - $resourcePath = '/notifications/{notification_id}/history'; + $resourcePath = '/apps'; $formParams = []; $queryParams = []; $headerParams = []; @@ -9588,14 +9601,6 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio - // path params - if ($notification_id !== null) { - $resourcePath = str_replace( - '{' . 'notification_id' . '}', - ObjectSerializer::toPathValue($notification_id), - $resourcePath - ); - } if ($multipart) { @@ -9605,18 +9610,12 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($get_notification_history_request_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($get_notification_history_request_body)); - } else { - $httpBody = $get_notification_history_request_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -9640,8 +9639,8 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio } } - if (!empty($this->config->getRestApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); } $defaultHeaders = []; @@ -9650,7 +9649,7 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -9660,7 +9659,7 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -9668,44 +9667,38 @@ public function getNotificationHistoryRequest($notification_id, $get_notificatio } /** - * Operation getNotifications + * Operation getNotification * - * View notifications + * View notification * - * @param string $app_id The app ID that you want to view notifications from (required) - * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) - * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) - * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) - * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * @param string $app_id app_id (required) + * @param string $notification_id notification_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\NotificationSlice|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\NotificationWithMeta|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getNotifications($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) + public function getNotification($app_id, $notification_id) { - list($response) = $this->getNotificationsWithHttpInfo($app_id, $limit, $offset, $kind, $time_offset); + list($response) = $this->getNotificationWithHttpInfo($app_id, $notification_id); return $response; } /** - * Operation getNotificationsWithHttpInfo + * Operation getNotificationWithHttpInfo * - * View notifications + * View notification * - * @param string $app_id The app ID that you want to view notifications from (required) - * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) - * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) - * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) - * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * @param string $app_id (required) + * @param string $notification_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\NotificationSlice|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\NotificationWithMeta|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) + public function getNotificationWithHttpInfo($app_id, $notification_id) { - $request = $this->getNotificationsRequest($app_id, $limit, $offset, $kind, $time_offset); + $request = $this->getNotificationRequest($app_id, $notification_id); try { $options = $this->createHttpClientOption(); @@ -9744,17 +9737,17 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n switch($statusCode) { case 200: - if ('\onesignal\client\model\NotificationSlice' === '\SplFileObject') { + if ('\onesignal\client\model\NotificationWithMeta' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\NotificationSlice' !== 'string') { + if ('\onesignal\client\model\NotificationWithMeta' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationSlice', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationWithMeta', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -9768,6 +9761,21 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -9790,7 +9798,7 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n ]; } - $returnType = '\onesignal\client\model\NotificationSlice'; + $returnType = '\onesignal\client\model\NotificationWithMeta'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -9811,7 +9819,7 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\NotificationSlice', + '\onesignal\client\model\NotificationWithMeta', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -9824,6 +9832,14 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n ); $e->setResponseObject($data); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -9846,22 +9862,19 @@ public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = n } /** - * Operation getNotificationsAsync + * Operation getNotificationAsync * - * View notifications + * View notification * - * @param string $app_id The app ID that you want to view notifications from (required) - * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) - * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) - * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) - * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * @param string $app_id (required) + * @param string $notification_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationsAsync($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) + public function getNotificationAsync($app_id, $notification_id) { - return $this->getNotificationsAsyncWithHttpInfo($app_id, $limit, $offset, $kind, $time_offset) + return $this->getNotificationAsyncWithHttpInfo($app_id, $notification_id) ->then( function ($response) { return $response[0]; @@ -9870,23 +9883,20 @@ function ($response) { } /** - * Operation getNotificationsAsyncWithHttpInfo + * Operation getNotificationAsyncWithHttpInfo * - * View notifications + * View notification * - * @param string $app_id The app ID that you want to view notifications from (required) - * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) - * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) - * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) - * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * @param string $app_id (required) + * @param string $notification_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getNotificationsAsyncWithHttpInfo($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) + public function getNotificationAsyncWithHttpInfo($app_id, $notification_id) { - $returnType = '\onesignal\client\model\NotificationSlice'; - $request = $this->getNotificationsRequest($app_id, $limit, $offset, $kind, $time_offset); + $returnType = '\onesignal\client\model\NotificationWithMeta'; + $request = $this->getNotificationRequest($app_id, $notification_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -9925,27 +9935,30 @@ function ($exception) { } /** - * Create request for operation 'getNotifications' + * Create request for operation 'getNotification' * - * @param string $app_id The app ID that you want to view notifications from (required) - * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) - * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) - * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) - * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * @param string $app_id (required) + * @param string $notification_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getNotificationsRequest($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) + public function getNotificationRequest($app_id, $notification_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getNotifications' + 'Missing the required parameter $app_id when calling getNotification' + ); + } + // verify the required parameter 'notification_id' is set + if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $notification_id when calling getNotification' ); } - $resourcePath = '/notifications'; + $resourcePath = '/notifications/{notification_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -9961,44 +9974,16 @@ public function getNotificationsRequest($app_id, $limit = null, $offset = null, true, // explode true // required ) ?? []); - // 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( - $offset, - 'offset', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $kind, - 'kind', // param base name - 'integer', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $time_offset, - 'time_offset', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); + // path params + if ($notification_id !== null) { + $resourcePath = str_replace( + '{' . 'notification_id' . '}', + ObjectSerializer::toPathValue($notification_id), + $resourcePath + ); + } if ($multipart) { @@ -10047,7 +10032,7 @@ public function getNotificationsRequest($app_id, $limit = null, $offset = null, } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -10065,46 +10050,38 @@ public function getNotificationsRequest($app_id, $limit = null, $offset = null, } /** - * Operation getOutcomes + * Operation getNotificationHistory * - * View Outcomes + * Notification History * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) - * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) - * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) - * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) - * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) + * @param string $notification_id The \"id\" of the message found in the Notification object (required) + * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body get_notification_history_request_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\OutcomesData|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\NotificationHistorySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getOutcomes($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) + public function getNotificationHistory($notification_id, $get_notification_history_request_body) { - list($response) = $this->getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); + list($response) = $this->getNotificationHistoryWithHttpInfo($notification_id, $get_notification_history_request_body); return $response; } /** - * Operation getOutcomesWithHttpInfo + * Operation getNotificationHistoryWithHttpInfo * - * View Outcomes + * Notification History * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) - * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) - * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) - * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) - * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) + * @param string $notification_id The \"id\" of the message found in the Notification object (required) + * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\OutcomesData|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\NotificationHistorySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) + public function getNotificationHistoryWithHttpInfo($notification_id, $get_notification_history_request_body) { - $request = $this->getOutcomesRequest($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); + $request = $this->getNotificationHistoryRequest($notification_id, $get_notification_history_request_body); try { $options = $this->createHttpClientOption(); @@ -10143,17 +10120,17 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 switch($statusCode) { case 200: - if ('\onesignal\client\model\OutcomesData' === '\SplFileObject') { + if ('\onesignal\client\model\NotificationHistorySuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\OutcomesData' !== 'string') { + if ('\onesignal\client\model\NotificationHistorySuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\OutcomesData', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationHistorySuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10167,6 +10144,21 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -10189,7 +10181,7 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 ]; } - $returnType = '\onesignal\client\model\OutcomesData'; + $returnType = '\onesignal\client\model\NotificationHistorySuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -10210,7 +10202,7 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\OutcomesData', + '\onesignal\client\model\NotificationHistorySuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10223,6 +10215,14 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 ); $e->setResponseObject($data); break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -10245,23 +10245,19 @@ public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 } /** - * Operation getOutcomesAsync + * Operation getNotificationHistoryAsync * - * View Outcomes + * Notification History * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) - * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) - * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) - * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) - * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) + * @param string $notification_id The \"id\" of the message found in the Notification object (required) + * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getOutcomesAsync($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) + public function getNotificationHistoryAsync($notification_id, $get_notification_history_request_body) { - return $this->getOutcomesAsyncWithHttpInfo($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution) + return $this->getNotificationHistoryAsyncWithHttpInfo($notification_id, $get_notification_history_request_body) ->then( function ($response) { return $response[0]; @@ -10270,24 +10266,20 @@ function ($response) { } /** - * Operation getOutcomesAsyncWithHttpInfo + * Operation getNotificationHistoryAsyncWithHttpInfo * - * View Outcomes + * Notification History * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) - * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) - * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) - * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) - * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) + * @param string $notification_id The \"id\" of the message found in the Notification object (required) + * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getOutcomesAsyncWithHttpInfo($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) + public function getNotificationHistoryAsyncWithHttpInfo($notification_id, $get_notification_history_request_body) { - $returnType = '\onesignal\client\model\OutcomesData'; - $request = $this->getOutcomesRequest($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); + $returnType = '\onesignal\client\model\NotificationHistorySuccessResponse'; + $request = $this->getNotificationHistoryRequest($notification_id, $get_notification_history_request_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10326,92 +10318,43 @@ function ($exception) { } /** - * Create request for operation 'getOutcomes' + * Create request for operation 'getNotificationHistory' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) - * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) - * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) - * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) - * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) + * @param string $notification_id The \"id\" of the message found in the Notification object (required) + * @param \onesignal\client\model\GetNotificationHistoryRequestBody $get_notification_history_request_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) + public function getNotificationHistoryRequest($notification_id, $get_notification_history_request_body) { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + // verify the required parameter 'notification_id' is set + if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getOutcomes' + 'Missing the required parameter $notification_id when calling getNotificationHistory' ); } - // verify the required parameter 'outcome_names' is set - if ($outcome_names === null || (is_array($outcome_names) && count($outcome_names) === 0)) { + // verify the required parameter 'get_notification_history_request_body' is set + if ($get_notification_history_request_body === null || (is_array($get_notification_history_request_body) && count($get_notification_history_request_body) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $outcome_names when calling getOutcomes' + 'Missing the required parameter $get_notification_history_request_body when calling getNotificationHistory' ); } - $resourcePath = '/apps/{app_id}/outcomes'; + $resourcePath = '/notifications/{notification_id}/history'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $outcome_names, - 'outcome_names', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $outcome_names2, - 'outcome_names[]', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $outcome_time_range, - 'outcome_time_range', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $outcome_platforms, - 'outcome_platforms', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $outcome_attribution, - 'outcome_attribution', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); // path params - if ($app_id !== null) { + if ($notification_id !== null) { $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), + '{' . 'notification_id' . '}', + ObjectSerializer::toPathValue($notification_id), $resourcePath ); } @@ -10424,12 +10367,18 @@ public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = nu } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($get_notification_history_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($get_notification_history_request_body)); + } else { + $httpBody = $get_notification_history_request_body; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -10463,7 +10412,7 @@ public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = nu } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -10473,7 +10422,7 @@ public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = nu $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'POST', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -10481,40 +10430,44 @@ public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = nu } /** - * Operation getSegment - * - * View Segment + * Operation getNotifications * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) + * View notifications * - * @throws \onesignal\client\ApiException on non-2xx response + * @param string $app_id The app ID that you want to view notifications from (required) + * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) + * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) + * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) + * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) + * + * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\GetSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\NotificationSlice|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getSegment($app_id, $segment_id, $include_segment_detail = null) + public function getNotifications($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) { - list($response) = $this->getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_detail); + list($response) = $this->getNotificationsWithHttpInfo($app_id, $limit, $offset, $kind, $time_offset); return $response; } /** - * Operation getSegmentWithHttpInfo + * Operation getNotificationsWithHttpInfo * - * View Segment + * View notifications * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) + * @param string $app_id The app ID that you want to view notifications from (required) + * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) + * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) + * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) + * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\GetSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\NotificationSlice|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_detail = null) + public function getNotificationsWithHttpInfo($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) { - $request = $this->getSegmentRequest($app_id, $segment_id, $include_segment_detail); + $request = $this->getNotificationsRequest($app_id, $limit, $offset, $kind, $time_offset); try { $options = $this->createHttpClientOption(); @@ -10553,17 +10506,17 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de switch($statusCode) { case 200: - if ('\onesignal\client\model\GetSegmentSuccessResponse' === '\SplFileObject') { + if ('\onesignal\client\model\NotificationSlice' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GetSegmentSuccessResponse' !== 'string') { + if ('\onesignal\client\model\NotificationSlice' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GetSegmentSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\NotificationSlice', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10577,21 +10530,6 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de } } - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -10614,7 +10552,7 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de ]; } - $returnType = '\onesignal\client\model\GetSegmentSuccessResponse'; + $returnType = '\onesignal\client\model\NotificationSlice'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -10635,7 +10573,7 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GetSegmentSuccessResponse', + '\onesignal\client\model\NotificationSlice', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -10648,14 +10586,6 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -10678,20 +10608,22 @@ public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_de } /** - * Operation getSegmentAsync + * Operation getNotificationsAsync * - * View Segment + * View notifications * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) + * @param string $app_id The app ID that you want to view notifications from (required) + * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) + * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) + * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) + * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSegmentAsync($app_id, $segment_id, $include_segment_detail = null) + public function getNotificationsAsync($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) { - return $this->getSegmentAsyncWithHttpInfo($app_id, $segment_id, $include_segment_detail) + return $this->getNotificationsAsyncWithHttpInfo($app_id, $limit, $offset, $kind, $time_offset) ->then( function ($response) { return $response[0]; @@ -10700,21 +10632,23 @@ function ($response) { } /** - * Operation getSegmentAsyncWithHttpInfo + * Operation getNotificationsAsyncWithHttpInfo * - * View Segment + * View notifications * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) + * @param string $app_id The app ID that you want to view notifications from (required) + * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) + * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) + * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) + * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSegmentAsyncWithHttpInfo($app_id, $segment_id, $include_segment_detail = null) + public function getNotificationsAsyncWithHttpInfo($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) { - $returnType = '\onesignal\client\model\GetSegmentSuccessResponse'; - $request = $this->getSegmentRequest($app_id, $segment_id, $include_segment_detail); + $returnType = '\onesignal\client\model\NotificationSlice'; + $request = $this->getNotificationsRequest($app_id, $limit, $offset, $kind, $time_offset); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -10753,31 +10687,27 @@ function ($exception) { } /** - * Create request for operation 'getSegment' + * Create request for operation 'getNotifications' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) + * @param string $app_id The app ID that you want to view notifications from (required) + * @param int $limit How many notifications to return. Max is 50. Default is 50. (optional) + * @param int $offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. (optional) + * @param int $kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only (optional) + * @param string $time_offset Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getSegmentRequest($app_id, $segment_id, $include_segment_detail = null) + public function getNotificationsRequest($app_id, $limit = null, $offset = null, $kind = null, $time_offset = null) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getSegment' - ); - } - // verify the required parameter 'segment_id' is set - if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $segment_id when calling getSegment' + 'Missing the required parameter $app_id when calling getNotifications' ); } - $resourcePath = '/apps/{app_id}/segments/{segment_id}'; + $resourcePath = '/notifications'; $formParams = []; $queryParams = []; $headerParams = []; @@ -10786,31 +10716,51 @@ public function getSegmentRequest($app_id, $segment_id, $include_segment_detail // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $include_segment_detail, - 'include-segment-detail', // param base name - 'boolean', // openApiType + $app_id, + 'app_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // 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( + $offset, + 'offset', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $kind, + 'kind', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $time_offset, + 'time_offset', // param base name + 'string', // openApiType 'form', // style true, // explode false // required ) ?? []); - // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } - // path params - if ($segment_id !== null) { - $resourcePath = str_replace( - '{' . 'segment_id' . '}', - ObjectSerializer::toPathValue($segment_id), - $resourcePath - ); - } if ($multipart) { @@ -10859,7 +10809,7 @@ public function getSegmentRequest($app_id, $segment_id, $include_segment_detail } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -10877,40 +10827,46 @@ public function getSegmentRequest($app_id, $segment_id, $include_segment_detail } /** - * Operation getSegments + * Operation getOutcomes * - * Get Segments + * View Outcomes * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) - * @param int $limit The amount of Segments in the response. Maximum 300. (optional) + * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) + * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) + * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) + * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) + * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\GetSegmentsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\OutcomesData|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getSegments($app_id, $offset = null, $limit = null) + public function getOutcomes($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) { - list($response) = $this->getSegmentsWithHttpInfo($app_id, $offset, $limit); + list($response) = $this->getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); return $response; } /** - * Operation getSegmentsWithHttpInfo + * Operation getOutcomesWithHttpInfo * - * Get Segments + * View Outcomes * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) - * @param int $limit The amount of Segments in the response. Maximum 300. (optional) + * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) + * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) + * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) + * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) + * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\GetSegmentsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\OutcomesData|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) + public function getOutcomesWithHttpInfo($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) { - $request = $this->getSegmentsRequest($app_id, $offset, $limit); + $request = $this->getOutcomesRequest($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); try { $options = $this->createHttpClientOption(); @@ -10948,18 +10904,18 @@ public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) } switch($statusCode) { - case 201: - if ('\onesignal\client\model\GetSegmentsSuccessResponse' === '\SplFileObject') { + case 200: + if ('\onesignal\client\model\OutcomesData' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GetSegmentsSuccessResponse' !== 'string') { + if ('\onesignal\client\model\OutcomesData' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GetSegmentsSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\OutcomesData', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -10995,7 +10951,7 @@ public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) ]; } - $returnType = '\onesignal\client\model\GetSegmentsSuccessResponse'; + $returnType = '\onesignal\client\model\OutcomesData'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -11013,10 +10969,10 @@ public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GetSegmentsSuccessResponse', + '\onesignal\client\model\OutcomesData', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11051,20 +11007,23 @@ public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) } /** - * Operation getSegmentsAsync + * Operation getOutcomesAsync * - * Get Segments + * View Outcomes * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) - * @param int $limit The amount of Segments in the response. Maximum 300. (optional) + * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) + * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) + * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) + * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) + * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSegmentsAsync($app_id, $offset = null, $limit = null) + public function getOutcomesAsync($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) { - return $this->getSegmentsAsyncWithHttpInfo($app_id, $offset, $limit) + return $this->getOutcomesAsyncWithHttpInfo($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution) ->then( function ($response) { return $response[0]; @@ -11073,21 +11032,24 @@ function ($response) { } /** - * Operation getSegmentsAsyncWithHttpInfo + * Operation getOutcomesAsyncWithHttpInfo * - * Get Segments + * View Outcomes * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) - * @param int $limit The amount of Segments in the response. Maximum 300. (optional) + * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) + * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) + * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) + * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) + * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getSegmentsAsyncWithHttpInfo($app_id, $offset = null, $limit = null) + public function getOutcomesAsyncWithHttpInfo($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) { - $returnType = '\onesignal\client\model\GetSegmentsSuccessResponse'; - $request = $this->getSegmentsRequest($app_id, $offset, $limit); + $returnType = '\onesignal\client\model\OutcomesData'; + $request = $this->getOutcomesRequest($app_id, $outcome_names, $outcome_names2, $outcome_time_range, $outcome_platforms, $outcome_attribution); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -11126,25 +11088,34 @@ function ($exception) { } /** - * Create request for operation 'getSegments' + * Create request for operation 'getOutcomes' * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) - * @param int $limit The amount of Segments in the response. Maximum 300. (optional) + * @param string $outcome_names Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the \"os\" prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum (required) + * @param string $outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where \"Sales, Purchase\" is the custom outcomes with a comma in the name. (optional) + * @param string $outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. (optional) + * @param string $outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. (optional) + * @param string $outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getSegmentsRequest($app_id, $offset = null, $limit = null) + public function getOutcomesRequest($app_id, $outcome_names, $outcome_names2 = null, $outcome_time_range = null, $outcome_platforms = null, $outcome_attribution = null) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getSegments' + 'Missing the required parameter $app_id when calling getOutcomes' + ); + } + // verify the required parameter 'outcome_names' is set + if ($outcome_names === null || (is_array($outcome_names) && count($outcome_names) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $outcome_names when calling getOutcomes' ); } - $resourcePath = '/apps/{app_id}/segments'; + $resourcePath = '/apps/{app_id}/outcomes'; $formParams = []; $queryParams = []; $headerParams = []; @@ -11153,18 +11124,45 @@ public function getSegmentsRequest($app_id, $offset = null, $limit = null) // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $offset, - 'offset', // param base name - 'integer', // openApiType + $outcome_names, + 'outcome_names', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $outcome_names2, + 'outcome_names[]', // param base name + 'string', // openApiType 'form', // style true, // explode false // required ) ?? []); // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $limit, - 'limit', // param base name - 'integer', // openApiType + $outcome_time_range, + 'outcome_time_range', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $outcome_platforms, + 'outcome_platforms', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $outcome_attribution, + 'outcome_attribution', // param base name + 'string', // openApiType 'form', // style true, // explode false // required @@ -11227,7 +11225,7 @@ public function getSegmentsRequest($app_id, $offset = null, $limit = null) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -11245,36 +11243,40 @@ public function getSegmentsRequest($app_id, $offset = null, $limit = null) } /** - * Operation getUser + * Operation getSegment * - * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) + * View Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\GetSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function getUser($app_id, $alias_label, $alias_id) + public function getSegment($app_id, $segment_id, $include_segment_detail = null) { - list($response) = $this->getUserWithHttpInfo($app_id, $alias_label, $alias_id); + list($response) = $this->getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_detail); return $response; } /** - * Operation getUserWithHttpInfo + * Operation getSegmentWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * View Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\GetSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) + public function getSegmentWithHttpInfo($app_id, $segment_id, $include_segment_detail = null) { - $request = $this->getUserRequest($app_id, $alias_label, $alias_id); + $request = $this->getSegmentRequest($app_id, $segment_id, $include_segment_detail); try { $options = $this->createHttpClientOption(); @@ -11313,17 +11315,17 @@ public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\User' === '\SplFileObject') { + if ('\onesignal\client\model\GetSegmentSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\User' !== 'string') { + if ('\onesignal\client\model\GetSegmentSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GetSegmentSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -11374,7 +11376,7 @@ public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) ]; } - $returnType = '\onesignal\client\model\User'; + $returnType = '\onesignal\client\model\GetSegmentSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -11395,7 +11397,7 @@ public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\User', + '\onesignal\client\model\GetSegmentSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11438,18 +11440,20 @@ public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) } /** - * Operation getUserAsync + * Operation getSegmentAsync * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * View Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUserAsync($app_id, $alias_label, $alias_id) + public function getSegmentAsync($app_id, $segment_id, $include_segment_detail = null) { - return $this->getUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + return $this->getSegmentAsyncWithHttpInfo($app_id, $segment_id, $include_segment_detail) ->then( function ($response) { return $response[0]; @@ -11458,19 +11462,21 @@ function ($response) { } /** - * Operation getUserAsyncWithHttpInfo + * Operation getSegmentAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * View Segment + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function getUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + public function getSegmentAsyncWithHttpInfo($app_id, $segment_id, $include_segment_detail = null) { - $returnType = '\onesignal\client\model\User'; - $request = $this->getUserRequest($app_id, $alias_label, $alias_id); + $returnType = '\onesignal\client\model\GetSegmentSuccessResponse'; + $request = $this->getSegmentRequest($app_id, $segment_id, $include_segment_detail); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -11509,43 +11515,46 @@ function ($exception) { } /** - * Create request for operation 'getUser' + * Create request for operation 'getSegment' * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param bool $include_segment_detail Set to true to include segment metadata and filters in the response. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function getUserRequest($app_id, $alias_label, $alias_id) + public function getSegmentRequest($app_id, $segment_id, $include_segment_detail = null) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling getUser' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling getUser' + 'Missing the required parameter $app_id when calling getSegment' ); } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + // verify the required parameter 'segment_id' is set + if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling getUser' + 'Missing the required parameter $segment_id when calling getSegment' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; + $resourcePath = '/apps/{app_id}/segments/{segment_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $include_segment_detail, + 'include-segment-detail', // param base name + 'boolean', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -11557,18 +11566,10 @@ public function getUserRequest($app_id, $alias_label, $alias_id) ); } // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { + if ($segment_id !== null) { $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), + '{' . 'segment_id' . '}', + ObjectSerializer::toPathValue($segment_id), $resourcePath ); } @@ -11620,7 +11621,7 @@ public function getUserRequest($app_id, $alias_label, $alias_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -11638,58 +11639,40 @@ public function getUserRequest($app_id, $alias_label, $alias_id) } /** - * Operation listAuditLogs + * Operation getSegments * - * List audit logs + * Get Segments * - * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) - * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) - * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) - * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) - * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) - * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) - * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) - * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) - * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) - * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) - * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) - * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) + * @param int $limit The amount of Segments in the response. Maximum 300. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\ListAuditLogsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\GetSegmentsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function listAuditLogs($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + public function getSegments($app_id, $offset = null, $limit = null) { - list($response) = $this->listAuditLogsWithHttpInfo($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + list($response) = $this->getSegmentsWithHttpInfo($app_id, $offset, $limit); return $response; } /** - * Operation listAuditLogsWithHttpInfo + * Operation getSegmentsWithHttpInfo * - * List audit logs + * Get Segments * - * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) - * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) - * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) - * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) - * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) - * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) - * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) - * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) - * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) - * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) - * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) - * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) + * @param int $limit The amount of Segments in the response. Maximum 300. (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\ListAuditLogsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\GetSegmentsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + public function getSegmentsWithHttpInfo($app_id, $offset = null, $limit = null) { - $request = $this->listAuditLogsRequest($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + $request = $this->getSegmentsRequest($app_id, $offset, $limit); try { $options = $this->createHttpClientOption(); @@ -11727,18 +11710,18 @@ public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, } switch($statusCode) { - case 200: - if ('\onesignal\client\model\ListAuditLogsSuccessResponse' === '\SplFileObject') { + case 201: + if ('\onesignal\client\model\GetSegmentsSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\ListAuditLogsSuccessResponse' !== 'string') { + if ('\onesignal\client\model\GetSegmentsSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\ListAuditLogsSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GetSegmentsSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -11757,54 +11740,24 @@ public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, $response->getStatusCode(), $response->getHeaders() ]; - case 403: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\RateLimitError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\onesignal\client\model\ListAuditLogsSuccessResponse'; + $returnType = '\onesignal\client\model\GetSegmentsSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -11822,10 +11775,10 @@ public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 201: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\ListAuditLogsSuccessResponse', + '\onesignal\client\model\GetSegmentsSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -11838,22 +11791,6 @@ public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, ); $e->setResponseObject($data); break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -11876,29 +11813,20 @@ public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, } /** - * Operation listAuditLogsAsync + * Operation getSegmentsAsync * - * List audit logs + * Get Segments * - * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) - * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) - * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) - * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) - * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) - * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) - * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) - * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) - * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) - * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) - * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) - * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) + * @param int $limit The amount of Segments in the response. Maximum 300. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listAuditLogsAsync($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + public function getSegmentsAsync($app_id, $offset = null, $limit = null) { - return $this->listAuditLogsAsyncWithHttpInfo($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses) + return $this->getSegmentsAsyncWithHttpInfo($app_id, $offset, $limit) ->then( function ($response) { return $response[0]; @@ -11907,30 +11835,21 @@ function ($response) { } /** - * Operation listAuditLogsAsyncWithHttpInfo + * Operation getSegmentsAsyncWithHttpInfo * - * List audit logs + * Get Segments * - * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) - * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) - * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) - * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) - * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) - * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) - * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) - * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) - * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) - * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) - * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) - * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) + * @param int $limit The amount of Segments in the response. Maximum 300. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function listAuditLogsAsyncWithHttpInfo($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + public function getSegmentsAsyncWithHttpInfo($app_id, $offset = null, $limit = null) { - $returnType = '\onesignal\client\model\ListAuditLogsSuccessResponse'; - $request = $this->listAuditLogsRequest($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + $returnType = '\onesignal\client\model\GetSegmentsSuccessResponse'; + $request = $this->getSegmentsRequest($app_id, $offset, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -11969,62 +11888,25 @@ function ($exception) { } /** - * Create request for operation 'listAuditLogs' + * Create request for operation 'getSegments' * - * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) - * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) - * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) - * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) - * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) - * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) - * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) - * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) - * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) - * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) - * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) - * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param int $offset Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments. (optional) + * @param int $limit The amount of Segments in the response. Maximum 300. (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function listAuditLogsRequest($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + public function getSegmentsRequest($app_id, $offset = null, $limit = null) { - // verify the required parameter 'organization_id' is set - if ($organization_id === null || (is_array($organization_id) && count($organization_id) === 0)) { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $organization_id when calling listAuditLogs' + 'Missing the required parameter $app_id when calling getSegments' ); } - if ($app_ids !== null && count($app_ids) > 10) { - throw new \InvalidArgumentException('invalid value for "$app_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - if ($actions !== null && count($actions) > 20) { - throw new \InvalidArgumentException('invalid value for "$actions" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 20.'); - } - - if ($actor_ids !== null && count($actor_ids) > 10) { - throw new \InvalidArgumentException('invalid value for "$actor_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - if ($actor_emails !== null && count($actor_emails) > 10) { - throw new \InvalidArgumentException('invalid value for "$actor_emails" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - if ($target_types !== null && count($target_types) > 10) { - throw new \InvalidArgumentException('invalid value for "$target_types" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - if ($target_ids !== null && count($target_ids) > 10) { - throw new \InvalidArgumentException('invalid value for "$target_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - if ($ip_addresses !== null && count($ip_addresses) > 10) { - throw new \InvalidArgumentException('invalid value for "$ip_addresses" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); - } - - $resourcePath = '/organizations/{organization_id}/audit_logs'; + $resourcePath = '/apps/{app_id}/segments'; $formParams = []; $queryParams = []; $headerParams = []; @@ -12033,27 +11915,9 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ // query params $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $start_time, - 'start_time', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $end_time, - 'end_time', // param base name - 'string', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $cursor, - 'cursor', // param base name - 'string', // openApiType + $offset, + 'offset', // param base name + 'integer', // openApiType 'form', // style true, // explode false // required @@ -12067,76 +11931,2826 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ true, // explode false // required ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $app_ids, - 'app_ids', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $actions, - 'actions', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $actor_ids, - 'actor_ids', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $actor_emails, - 'actor_emails', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $target_types, - 'target_types', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $target_ids, - 'target_ids', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $ip_addresses, - 'ip_addresses', // param base name - 'array', // openApiType - 'form', // style - true, // explode - false // required - ) ?? []); // path params - if ($organization_id !== null) { + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation getUser + * + * @param string $app_id app_id (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + */ + public function getUser($app_id, $alias_label, $alias_id) + { + list($response) = $this->getUserWithHttpInfo($app_id, $alias_label, $alias_id); + return $response; + } + + /** + * Operation getUserWithHttpInfo + * + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\User|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function getUserWithHttpInfo($app_id, $alias_label, $alias_id) + { + $request = $this->getUserRequest($app_id, $alias_label, $alias_id); + + 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 ('\onesignal\client\model\User' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\User' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\User', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\User'; + 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(), + '\onesignal\client\model\User', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation getUserAsync + * + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserAsync($app_id, $alias_label, $alias_id) + { + return $this->getUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation getUserAsyncWithHttpInfo + * + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function getUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id) + { + $returnType = '\onesignal\client\model\User'; + $request = $this->getUserRequest($app_id, $alias_label, $alias_id); + + 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 'getUser' + * + * @param string $app_id (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function getUserRequest($app_id, $alias_label, $alias_id) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling getUser' + ); + } + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_label when calling getUser' + ); + } + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $alias_id when calling getUser' + ); + } + + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($alias_label !== null) { + $resourcePath = str_replace( + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation listAuditLogs + * + * List audit logs + * + * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) + * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) + * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) + * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) + * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) + * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) + * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) + * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) + * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) + * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) + * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) + * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\ListAuditLogsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + */ + public function listAuditLogs($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + { + list($response) = $this->listAuditLogsWithHttpInfo($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + return $response; + } + + /** + * Operation listAuditLogsWithHttpInfo + * + * List audit logs + * + * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) + * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) + * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) + * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) + * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) + * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) + * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) + * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) + * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) + * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) + * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) + * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\ListAuditLogsSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function listAuditLogsWithHttpInfo($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + { + $request = $this->listAuditLogsRequest($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + + 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 ('\onesignal\client\model\ListAuditLogsSuccessResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\ListAuditLogsSuccessResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\ListAuditLogsSuccessResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\ListAuditLogsSuccessResponse'; + 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(), + '\onesignal\client\model\ListAuditLogsSuccessResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation listAuditLogsAsync + * + * List audit logs + * + * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) + * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) + * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) + * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) + * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) + * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) + * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) + * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) + * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) + * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) + * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) + * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAuditLogsAsync($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + { + return $this->listAuditLogsAsyncWithHttpInfo($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation listAuditLogsAsyncWithHttpInfo + * + * List audit logs + * + * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) + * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) + * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) + * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) + * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) + * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) + * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) + * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) + * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) + * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) + * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) + * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function listAuditLogsAsyncWithHttpInfo($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + { + $returnType = '\onesignal\client\model\ListAuditLogsSuccessResponse'; + $request = $this->listAuditLogsRequest($organization_id, $start_time, $end_time, $cursor, $limit, $app_ids, $actions, $actor_ids, $actor_emails, $target_types, $target_ids, $ip_addresses); + + 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 'listAuditLogs' + * + * @param string $organization_id The UUID of the organization to retrieve audit logs for. Must match the authenticated Organization API Key. (required) + * @param string $start_time Start of the time range in ISO 8601 format (e.g. 2026-02-01T00:00:00Z). Required unless cursor is provided. Must be within the last 90 days. (optional) + * @param string $end_time End of the time range in ISO 8601 format. Defaults to the current time. Must be after start_time. (optional) + * @param string $cursor Pagination cursor returned in a previous response as next_cursor. When provided, start_time and end_time are ignored. (optional) + * @param int $limit Maximum number of events to return per page. Minimum 1, maximum 100. Values outside this range are clamped automatically by the server. (optional) + * @param string[] $app_ids Filter events by app UUID. Accepts up to 10 values. Org-level events are always included. (optional) + * @param string[] $actions Filter by action type (e.g. notification.sent, segment.created). Accepts up to 20 values. (optional) + * @param string[] $actor_ids Filter by actor UUID (the user or service that performed the action). Accepts up to 10 values. (optional) + * @param string[] $actor_emails Filter by actor email address. Accepts up to 10 values. (optional) + * @param string[] $target_types Filter by the type of resource the action was performed on (e.g. notification, segment, journey). Accepts up to 10 values. (optional) + * @param string[] $target_ids Filter by the UUID of the resource the action was performed on. Accepts up to 10 values. (optional) + * @param string[] $ip_addresses Filter by the IP address the action originated from. Accepts up to 10 values. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function listAuditLogsRequest($organization_id, $start_time = null, $end_time = null, $cursor = null, $limit = null, $app_ids = null, $actions = null, $actor_ids = null, $actor_emails = null, $target_types = null, $target_ids = null, $ip_addresses = null) + { + // verify the required parameter 'organization_id' is set + if ($organization_id === null || (is_array($organization_id) && count($organization_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $organization_id when calling listAuditLogs' + ); + } + if ($app_ids !== null && count($app_ids) > 10) { + throw new \InvalidArgumentException('invalid value for "$app_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + if ($actions !== null && count($actions) > 20) { + throw new \InvalidArgumentException('invalid value for "$actions" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 20.'); + } + + if ($actor_ids !== null && count($actor_ids) > 10) { + throw new \InvalidArgumentException('invalid value for "$actor_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + if ($actor_emails !== null && count($actor_emails) > 10) { + throw new \InvalidArgumentException('invalid value for "$actor_emails" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + if ($target_types !== null && count($target_types) > 10) { + throw new \InvalidArgumentException('invalid value for "$target_types" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + if ($target_ids !== null && count($target_ids) > 10) { + throw new \InvalidArgumentException('invalid value for "$target_ids" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + if ($ip_addresses !== null && count($ip_addresses) > 10) { + throw new \InvalidArgumentException('invalid value for "$ip_addresses" when calling DefaultApi.listAuditLogs, number of items must be less than or equal to 10.'); + } + + + $resourcePath = '/organizations/{organization_id}/audit_logs'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $start_time, + 'start_time', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $end_time, + 'end_time', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $cursor, + 'cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // 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( + $app_ids, + 'app_ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $actions, + 'actions', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $actor_ids, + 'actor_ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $actor_emails, + 'actor_emails', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $target_types, + 'target_types', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $target_ids, + 'target_ids', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $ip_addresses, + 'ip_addresses', // param base name + 'array', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + + + // path params + if ($organization_id !== null) { + $resourcePath = str_replace( + '{' . 'organization_id' . '}', + ObjectSerializer::toPathValue($organization_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation rotateApiKey + * + * Rotate API key + * + * @param string $app_id app_id (required) + * @param string $token_id token_id (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\CreateApiKeyResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + */ + public function rotateApiKey($app_id, $token_id) + { + list($response) = $this->rotateApiKeyWithHttpInfo($app_id, $token_id); + return $response; + } + + /** + * Operation rotateApiKeyWithHttpInfo + * + * Rotate API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\CreateApiKeyResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function rotateApiKeyWithHttpInfo($app_id, $token_id) + { + $request = $this->rotateApiKeyRequest($app_id, $token_id); + + 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 ('\onesignal\client\model\CreateApiKeyResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\CreateApiKeyResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateApiKeyResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\CreateApiKeyResponse'; + 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(), + '\onesignal\client\model\CreateApiKeyResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation rotateApiKeyAsync + * + * Rotate API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rotateApiKeyAsync($app_id, $token_id) + { + return $this->rotateApiKeyAsyncWithHttpInfo($app_id, $token_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation rotateApiKeyAsyncWithHttpInfo + * + * Rotate API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function rotateApiKeyAsyncWithHttpInfo($app_id, $token_id) + { + $returnType = '\onesignal\client\model\CreateApiKeyResponse'; + $request = $this->rotateApiKeyRequest($app_id, $token_id); + + 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 'rotateApiKey' + * + * @param string $app_id (required) + * @param string $token_id (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function rotateApiKeyRequest($app_id, $token_id) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling rotateApiKey' + ); + } + // verify the required parameter 'token_id' is set + if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $token_id when calling rotateApiKey' + ); + } + + $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}/rotate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($token_id !== null) { + $resourcePath = str_replace( + '{' . 'token_id' . '}', + ObjectSerializer::toPathValue($token_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation startLiveActivity + * + * Start Live Activity + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) + * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request start_live_activity_request (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\StartLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + */ + public function startLiveActivity($app_id, $activity_type, $start_live_activity_request) + { + list($response) = $this->startLiveActivityWithHttpInfo($app_id, $activity_type, $start_live_activity_request); + return $response; + } + + /** + * Operation startLiveActivityWithHttpInfo + * + * Start Live Activity + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) + * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\StartLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + { + $request = $this->startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 201: + if ('\onesignal\client\model\StartLiveActivitySuccessResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\StartLiveActivitySuccessResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\StartLiveActivitySuccessResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\StartLiveActivitySuccessResponse'; + 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 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\StartLiveActivitySuccessResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation startLiveActivityAsync + * + * Start Live Activity + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) + * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function startLiveActivityAsync($app_id, $activity_type, $start_live_activity_request) + { + return $this->startLiveActivityAsyncWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation startLiveActivityAsyncWithHttpInfo + * + * Start Live Activity + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) + * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function startLiveActivityAsyncWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + { + $returnType = '\onesignal\client\model\StartLiveActivitySuccessResponse'; + $request = $this->startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request); + + 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 'startLiveActivity' + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) + * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling startLiveActivity' + ); + } + // verify the required parameter 'activity_type' is set + if ($activity_type === null || (is_array($activity_type) && count($activity_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $activity_type when calling startLiveActivity' + ); + } + // verify the required parameter 'start_live_activity_request' is set + if ($start_live_activity_request === null || (is_array($start_live_activity_request) && count($start_live_activity_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $start_live_activity_request when calling startLiveActivity' + ); + } + + $resourcePath = '/apps/{app_id}/activities/activity/{activity_type}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($activity_type !== null) { + $resourcePath = str_replace( + '{' . 'activity_type' . '}', + ObjectSerializer::toPathValue($activity_type), + $resourcePath + ); + } + + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($start_live_activity_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($start_live_activity_request)); + } else { + $httpBody = $start_live_activity_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation transferSubscription + * + * @param string $app_id app_id (required) + * @param string $subscription_id subscription_id (required) + * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body transfer_subscription_request_body (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + */ + public function transferSubscription($app_id, $subscription_id, $transfer_subscription_request_body) + { + list($response) = $this->transferSubscriptionWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body); + return $response; + } + + /** + * Operation transferSubscriptionWithHttpInfo + * + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + { + $request = $this->transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body); + + 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 ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\UserIdentityBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\UserIdentityBody'; + 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(), + '\onesignal\client\model\UserIdentityBody', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transferSubscriptionAsync + * + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transferSubscriptionAsync($app_id, $subscription_id, $transfer_subscription_request_body) + { + return $this->transferSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transferSubscriptionAsyncWithHttpInfo + * + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transferSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + { + $returnType = '\onesignal\client\model\UserIdentityBody'; + $request = $this->transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body); + + 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 'transferSubscription' + * + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling transferSubscription' + ); + } + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_id when calling transferSubscription' + ); + } + // verify the required parameter 'transfer_subscription_request_body' is set + if ($transfer_subscription_request_body === null || (is_array($transfer_subscription_request_body) && count($transfer_subscription_request_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $transfer_subscription_request_body when calling transferSubscription' + ); + } + + $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}/owner'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{' . 'subscription_id' . '}', + ObjectSerializer::toPathValue($subscription_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($transfer_subscription_request_body)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($transfer_subscription_request_body)); + } else { + $httpBody = $transfer_subscription_request_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 ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PATCH', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation unsubscribeEmailWithToken + * + * Unsubscribe with token + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) + * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + */ + public function unsubscribeEmailWithToken($app_id, $notification_id, $token) + { + list($response) = $this->unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, $token); + return $response; + } + + /** + * Operation unsubscribeEmailWithTokenWithHttpInfo + * + * Unsubscribe with token + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) + * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, $token) + { + $request = $this->unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + switch($statusCode) { + case 202: + if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + 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 202: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericSuccessBoolResponse', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation unsubscribeEmailWithTokenAsync + * + * Unsubscribe with token + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) + * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unsubscribeEmailWithTokenAsync($app_id, $notification_id, $token) + { + return $this->unsubscribeEmailWithTokenAsyncWithHttpInfo($app_id, $notification_id, $token) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation unsubscribeEmailWithTokenAsyncWithHttpInfo + * + * Unsubscribe with token + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) + * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function unsubscribeEmailWithTokenAsyncWithHttpInfo($app_id, $notification_id, $token) + { + $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + $request = $this->unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token); + + 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 'unsubscribeEmailWithToken' + * + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) + * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling unsubscribeEmailWithToken' + ); + } + // verify the required parameter 'notification_id' is set + if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $notification_id when calling unsubscribeEmailWithToken' + ); + } + // verify the required parameter 'token' is set + if ($token === null || (is_array($token) && count($token) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $token when calling unsubscribeEmailWithToken' + ); + } + + $resourcePath = '/apps/{app_id}/notifications/{notification_id}/unsubscribe'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $token, + 'token', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($app_id !== null) { + $resourcePath = str_replace( + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($notification_id !== null) { + $resourcePath = str_replace( + '{' . 'notification_id' . '}', + ObjectSerializer::toPathValue($notification_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 = ObjectSerializer::buildQuery($formParams); + } + } + + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + // Adding the telemetry header + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation updateApiKey + * + * Update API key + * + * @param string $app_id app_id (required) + * @param string $token_id token_id (required) + * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request update_api_key_request (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + */ + public function updateApiKey($app_id, $token_id, $update_api_key_request) + { + list($response) = $this->updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_request); + return $response; + } + + /** + * Operation updateApiKeyWithHttpInfo + * + * Update API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * + * @throws \onesignal\client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + */ + public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_request) + { + $request = $this->updateApiKeyRequest($app_id, $token_id, $update_api_key_request); + + 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 ('object' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('object' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + 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(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 400: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + default: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation updateApiKeyAsync + * + * Update API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateApiKeyAsync($app_id, $token_id, $update_api_key_request) + { + return $this->updateApiKeyAsyncWithHttpInfo($app_id, $token_id, $update_api_key_request) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation updateApiKeyAsyncWithHttpInfo + * + * Update API key + * + * @param string $app_id (required) + * @param string $token_id (required) + * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function updateApiKeyAsyncWithHttpInfo($app_id, $token_id, $update_api_key_request) + { + $returnType = 'object'; + $request = $this->updateApiKeyRequest($app_id, $token_id, $update_api_key_request); + + 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 'updateApiKey' + * + * @param string $app_id (required) + * @param string $token_id (required) + * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $app_id when calling updateApiKey' + ); + } + // verify the required parameter 'token_id' is set + if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $token_id when calling updateApiKey' + ); + } + // verify the required parameter 'update_api_key_request' is set + if ($update_api_key_request === null || (is_array($update_api_key_request) && count($update_api_key_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_api_key_request when calling updateApiKey' + ); + } + + $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($app_id !== null) { $resourcePath = str_replace( - '{' . 'organization_id' . '}', - ObjectSerializer::toPathValue($organization_id), + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($token_id !== null) { + $resourcePath = str_replace( + '{' . 'token_id' . '}', + ObjectSerializer::toPathValue($token_id), $resourcePath ); } @@ -12149,12 +14763,18 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($update_api_key_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_api_key_request)); + } else { + $httpBody = $update_api_key_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -12188,7 +14808,7 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -12198,7 +14818,7 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'GET', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -12206,38 +14826,38 @@ public function listAuditLogsRequest($organization_id, $start_time = null, $end_ } /** - * Operation rotateApiKey + * Operation updateApp * - * Rotate API key + * Update an app * - * @param string $app_id app_id (required) - * @param string $token_id token_id (required) + * @param string $app_id An app id (required) + * @param \onesignal\client\model\App $app app (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\CreateApiKeyResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function rotateApiKey($app_id, $token_id) + public function updateApp($app_id, $app) { - list($response) = $this->rotateApiKeyWithHttpInfo($app_id, $token_id); + list($response) = $this->updateAppWithHttpInfo($app_id, $app); return $response; } /** - * Operation rotateApiKeyWithHttpInfo + * Operation updateAppWithHttpInfo * - * Rotate API key + * Update an app * - * @param string $app_id (required) - * @param string $token_id (required) + * @param string $app_id An app id (required) + * @param \onesignal\client\model\App $app (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\CreateApiKeyResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function rotateApiKeyWithHttpInfo($app_id, $token_id) + public function updateAppWithHttpInfo($app_id, $app) { - $request = $this->rotateApiKeyRequest($app_id, $token_id); + $request = $this->updateAppRequest($app_id, $app); try { $options = $this->createHttpClientOption(); @@ -12276,17 +14896,17 @@ public function rotateApiKeyWithHttpInfo($app_id, $token_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\CreateApiKeyResponse' === '\SplFileObject') { + if ('\onesignal\client\model\App' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\CreateApiKeyResponse' !== 'string') { + if ('\onesignal\client\model\App' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\CreateApiKeyResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\App', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -12305,9 +14925,24 @@ public function rotateApiKeyWithHttpInfo($app_id, $token_id) $response->getStatusCode(), $response->getHeaders() ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } - $returnType = '\onesignal\client\model\CreateApiKeyResponse'; + $returnType = '\onesignal\client\model\App'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -12328,7 +14963,7 @@ public function rotateApiKeyWithHttpInfo($app_id, $token_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\CreateApiKeyResponse', + '\onesignal\client\model\App', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12341,6 +14976,14 @@ public function rotateApiKeyWithHttpInfo($app_id, $token_id) ); $e->setResponseObject($data); break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -12355,19 +14998,19 @@ public function rotateApiKeyWithHttpInfo($app_id, $token_id) } /** - * Operation rotateApiKeyAsync + * Operation updateAppAsync * - * Rotate API key + * Update an app * - * @param string $app_id (required) - * @param string $token_id (required) + * @param string $app_id An app id (required) + * @param \onesignal\client\model\App $app (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function rotateApiKeyAsync($app_id, $token_id) + public function updateAppAsync($app_id, $app) { - return $this->rotateApiKeyAsyncWithHttpInfo($app_id, $token_id) + return $this->updateAppAsyncWithHttpInfo($app_id, $app) ->then( function ($response) { return $response[0]; @@ -12376,20 +15019,20 @@ function ($response) { } /** - * Operation rotateApiKeyAsyncWithHttpInfo + * Operation updateAppAsyncWithHttpInfo * - * Rotate API key + * Update an app * - * @param string $app_id (required) - * @param string $token_id (required) + * @param string $app_id An app id (required) + * @param \onesignal\client\model\App $app (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function rotateApiKeyAsyncWithHttpInfo($app_id, $token_id) + public function updateAppAsyncWithHttpInfo($app_id, $app) { - $returnType = '\onesignal\client\model\CreateApiKeyResponse'; - $request = $this->rotateApiKeyRequest($app_id, $token_id); + $returnType = '\onesignal\client\model\App'; + $request = $this->updateAppRequest($app_id, $app); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12428,30 +15071,30 @@ function ($exception) { } /** - * Create request for operation 'rotateApiKey' + * Create request for operation 'updateApp' * - * @param string $app_id (required) - * @param string $token_id (required) + * @param string $app_id An app id (required) + * @param \onesignal\client\model\App $app (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function rotateApiKeyRequest($app_id, $token_id) + public function updateAppRequest($app_id, $app) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling rotateApiKey' + 'Missing the required parameter $app_id when calling updateApp' ); } - // verify the required parameter 'token_id' is set - if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { + // verify the required parameter 'app' is set + if ($app === null || (is_array($app) && count($app) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $token_id when calling rotateApiKey' + 'Missing the required parameter $app when calling updateApp' ); } - $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}/rotate'; + $resourcePath = '/apps/{app_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -12468,14 +15111,6 @@ public function rotateApiKeyRequest($app_id, $token_id) $resourcePath ); } - // path params - if ($token_id !== null) { - $resourcePath = str_replace( - '{' . 'token_id' . '}', - ObjectSerializer::toPathValue($token_id), - $resourcePath - ); - } if ($multipart) { @@ -12485,12 +15120,18 @@ public function rotateApiKeyRequest($app_id, $token_id) } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($app)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($app)); + } else { + $httpBody = $app; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -12524,7 +15165,7 @@ public function rotateApiKeyRequest($app_id, $token_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -12534,7 +15175,7 @@ public function rotateApiKeyRequest($app_id, $token_id) $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'PUT', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -12542,40 +15183,40 @@ public function rotateApiKeyRequest($app_id, $token_id) } /** - * Operation startLiveActivity + * Operation updateJourney * - * Start Live Activity + * Update journey * * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) - * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request start_live_activity_request (required) + * @param string $journey_id UUID of the journey to update. (required) + * @param \onesignal\client\model\UpdateJourneyRequest $update_journey_request update_journey_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\StartLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function startLiveActivity($app_id, $activity_type, $start_live_activity_request) + public function updateJourney($app_id, $journey_id, $update_journey_request) { - list($response) = $this->startLiveActivityWithHttpInfo($app_id, $activity_type, $start_live_activity_request); + list($response) = $this->updateJourneyWithHttpInfo($app_id, $journey_id, $update_journey_request); return $response; } /** - * Operation startLiveActivityWithHttpInfo + * Operation updateJourneyWithHttpInfo * - * Start Live Activity + * Update journey * * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) - * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * @param string $journey_id UUID of the journey to update. (required) + * @param \onesignal\client\model\UpdateJourneyRequest $update_journey_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\StartLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + public function updateJourneyWithHttpInfo($app_id, $journey_id, $update_journey_request) { - $request = $this->startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request); + $request = $this->updateJourneyRequest($app_id, $journey_id, $update_journey_request); try { $options = $this->createHttpClientOption(); @@ -12599,36 +15240,96 @@ public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_li $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() - ); - } + 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 ('\onesignal\client\model\Journey' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\Journey' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\Journey', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } - switch($statusCode) { - case 201: - if ('\onesignal\client\model\StartLiveActivitySuccessResponse' === '\SplFileObject') { + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\StartLiveActivitySuccessResponse' !== 'string') { + if ('\onesignal\client\model\GenericError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\StartLiveActivitySuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), $response->getHeaders() ]; - case 400: + case 422: if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -12660,7 +15361,7 @@ public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_li ]; } - $returnType = '\onesignal\client\model\StartLiveActivitySuccessResponse'; + $returnType = '\onesignal\client\model\Journey'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -12678,10 +15379,10 @@ public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_li } catch (ApiException $e) { switch ($e->getCode()) { - case 201: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\StartLiveActivitySuccessResponse', + '\onesignal\client\model\Journey', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -12694,6 +15395,38 @@ public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_li ); $e->setResponseObject($data); break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -12716,20 +15449,20 @@ public function startLiveActivityWithHttpInfo($app_id, $activity_type, $start_li } /** - * Operation startLiveActivityAsync + * Operation updateJourneyAsync * - * Start Live Activity + * Update journey * * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) - * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * @param string $journey_id UUID of the journey to update. (required) + * @param \onesignal\client\model\UpdateJourneyRequest $update_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function startLiveActivityAsync($app_id, $activity_type, $start_live_activity_request) + public function updateJourneyAsync($app_id, $journey_id, $update_journey_request) { - return $this->startLiveActivityAsyncWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + return $this->updateJourneyAsyncWithHttpInfo($app_id, $journey_id, $update_journey_request) ->then( function ($response) { return $response[0]; @@ -12738,21 +15471,21 @@ function ($response) { } /** - * Operation startLiveActivityAsyncWithHttpInfo + * Operation updateJourneyAsyncWithHttpInfo * - * Start Live Activity + * Update journey * * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) - * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * @param string $journey_id UUID of the journey to update. (required) + * @param \onesignal\client\model\UpdateJourneyRequest $update_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function startLiveActivityAsyncWithHttpInfo($app_id, $activity_type, $start_live_activity_request) + public function updateJourneyAsyncWithHttpInfo($app_id, $journey_id, $update_journey_request) { - $returnType = '\onesignal\client\model\StartLiveActivitySuccessResponse'; - $request = $this->startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request); + $returnType = '\onesignal\client\model\Journey'; + $request = $this->updateJourneyRequest($app_id, $journey_id, $update_journey_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -12791,37 +15524,37 @@ function ($exception) { } /** - * Create request for operation 'startLiveActivity' + * Create request for operation 'updateJourney' * * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $activity_type The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation. (required) - * @param \onesignal\client\model\StartLiveActivityRequest $start_live_activity_request (required) + * @param string $journey_id UUID of the journey to update. (required) + * @param \onesignal\client\model\UpdateJourneyRequest $update_journey_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function startLiveActivityRequest($app_id, $activity_type, $start_live_activity_request) + public function updateJourneyRequest($app_id, $journey_id, $update_journey_request) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling startLiveActivity' + 'Missing the required parameter $app_id when calling updateJourney' ); } - // verify the required parameter 'activity_type' is set - if ($activity_type === null || (is_array($activity_type) && count($activity_type) === 0)) { + // verify the required parameter 'journey_id' is set + if ($journey_id === null || (is_array($journey_id) && count($journey_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $activity_type when calling startLiveActivity' + 'Missing the required parameter $journey_id when calling updateJourney' ); } - // verify the required parameter 'start_live_activity_request' is set - if ($start_live_activity_request === null || (is_array($start_live_activity_request) && count($start_live_activity_request) === 0)) { + // verify the required parameter 'update_journey_request' is set + if ($update_journey_request === null || (is_array($update_journey_request) && count($update_journey_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $start_live_activity_request when calling startLiveActivity' + 'Missing the required parameter $update_journey_request when calling updateJourney' ); } - $resourcePath = '/apps/{app_id}/activities/activity/{activity_type}'; + $resourcePath = '/apps/{app_id}/journeys/{journey_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -12839,10 +15572,10 @@ public function startLiveActivityRequest($app_id, $activity_type, $start_live_ac ); } // path params - if ($activity_type !== null) { + if ($journey_id !== null) { $resourcePath = str_replace( - '{' . 'activity_type' . '}', - ObjectSerializer::toPathValue($activity_type), + '{' . 'journey_id' . '}', + ObjectSerializer::toPathValue($journey_id), $resourcePath ); } @@ -12860,11 +15593,11 @@ public function startLiveActivityRequest($app_id, $activity_type, $start_live_ac } // for model (json/xml) - if (isset($start_live_activity_request)) { + if (isset($update_journey_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($start_live_activity_request)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_journey_request)); } else { - $httpBody = $start_live_activity_request; + $httpBody = $update_journey_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -12900,7 +15633,7 @@ public function startLiveActivityRequest($app_id, $activity_type, $start_live_ac } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -12910,7 +15643,7 @@ public function startLiveActivityRequest($app_id, $activity_type, $start_live_ac $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -12918,36 +15651,42 @@ public function startLiveActivityRequest($app_id, $activity_type, $start_live_ac } /** - * Operation transferSubscription + * Operation updateJourneyNode * - * @param string $app_id app_id (required) - * @param string $subscription_id subscription_id (required) - * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body transfer_subscription_request_body (required) + * Update journey node + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey that owns the node. (required) + * @param string $node_id Server-assigned UUID of the node to update, from a prior View journey fetch. (required) + * @param \onesignal\client\model\UpdateJourneyNodeRequest $update_journey_node_request update_journey_node_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function transferSubscription($app_id, $subscription_id, $transfer_subscription_request_body) + public function updateJourneyNode($app_id, $journey_id, $node_id, $update_journey_node_request) { - list($response) = $this->transferSubscriptionWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body); + list($response) = $this->updateJourneyNodeWithHttpInfo($app_id, $journey_id, $node_id, $update_journey_node_request); return $response; } /** - * Operation transferSubscriptionWithHttpInfo + * Operation updateJourneyNodeWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * Update journey node + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey that owns the node. (required) + * @param string $node_id Server-assigned UUID of the node to update, from a prior View journey fetch. (required) + * @param \onesignal\client\model\UpdateJourneyNodeRequest $update_journey_node_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UserIdentityBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + public function updateJourneyNodeWithHttpInfo($app_id, $journey_id, $node_id, $update_journey_node_request) { - $request = $this->transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body); + $request = $this->updateJourneyNodeRequest($app_id, $journey_id, $node_id, $update_journey_node_request); try { $options = $this->createHttpClientOption(); @@ -12986,17 +15725,17 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra switch($statusCode) { case 200: - if ('\onesignal\client\model\UserIdentityBody' === '\SplFileObject') { + if ('\onesignal\client\model\Journey' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UserIdentityBody' !== 'string') { + if ('\onesignal\client\model\Journey' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UserIdentityBody', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\Journey', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -13010,6 +15749,21 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -13040,6 +15794,21 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra } } + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 422: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -13062,7 +15831,7 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra ]; } - $returnType = '\onesignal\client\model\UserIdentityBody'; + $returnType = '\onesignal\client\model\Journey'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -13083,7 +15852,7 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UserIdentityBody', + '\onesignal\client\model\Journey', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13096,6 +15865,14 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra ); $e->setResponseObject($data); break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -13112,6 +15889,14 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra ); $e->setResponseObject($data); break; + case 422: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; case 429: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -13134,18 +15919,21 @@ public function transferSubscriptionWithHttpInfo($app_id, $subscription_id, $tra } /** - * Operation transferSubscriptionAsync + * Operation updateJourneyNodeAsync * - * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * Update journey node + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey that owns the node. (required) + * @param string $node_id Server-assigned UUID of the node to update, from a prior View journey fetch. (required) + * @param \onesignal\client\model\UpdateJourneyNodeRequest $update_journey_node_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function transferSubscriptionAsync($app_id, $subscription_id, $transfer_subscription_request_body) + public function updateJourneyNodeAsync($app_id, $journey_id, $node_id, $update_journey_node_request) { - return $this->transferSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + return $this->updateJourneyNodeAsyncWithHttpInfo($app_id, $journey_id, $node_id, $update_journey_node_request) ->then( function ($response) { return $response[0]; @@ -13154,19 +15942,22 @@ function ($response) { } /** - * Operation transferSubscriptionAsyncWithHttpInfo + * Operation updateJourneyNodeAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * Update journey node + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey that owns the node. (required) + * @param string $node_id Server-assigned UUID of the node to update, from a prior View journey fetch. (required) + * @param \onesignal\client\model\UpdateJourneyNodeRequest $update_journey_node_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function transferSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $transfer_subscription_request_body) + public function updateJourneyNodeAsyncWithHttpInfo($app_id, $journey_id, $node_id, $update_journey_node_request) { - $returnType = '\onesignal\client\model\UserIdentityBody'; - $request = $this->transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body); + $returnType = '\onesignal\client\model\Journey'; + $request = $this->updateJourneyNodeRequest($app_id, $journey_id, $node_id, $update_journey_node_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -13205,37 +15996,44 @@ function ($exception) { } /** - * Create request for operation 'transferSubscription' + * Create request for operation 'updateJourneyNode' * - * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\TransferSubscriptionRequestBody $transfer_subscription_request_body (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey that owns the node. (required) + * @param string $node_id Server-assigned UUID of the node to update, from a prior View journey fetch. (required) + * @param \onesignal\client\model\UpdateJourneyNodeRequest $update_journey_node_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function transferSubscriptionRequest($app_id, $subscription_id, $transfer_subscription_request_body) + public function updateJourneyNodeRequest($app_id, $journey_id, $node_id, $update_journey_node_request) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling transferSubscription' + 'Missing the required parameter $app_id when calling updateJourneyNode' ); } - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + // verify the required parameter 'journey_id' is set + if ($journey_id === null || (is_array($journey_id) && count($journey_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling transferSubscription' + 'Missing the required parameter $journey_id when calling updateJourneyNode' ); } - // verify the required parameter 'transfer_subscription_request_body' is set - if ($transfer_subscription_request_body === null || (is_array($transfer_subscription_request_body) && count($transfer_subscription_request_body) === 0)) { + // verify the required parameter 'node_id' is set + if ($node_id === null || (is_array($node_id) && count($node_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $transfer_subscription_request_body when calling transferSubscription' + 'Missing the required parameter $node_id when calling updateJourneyNode' + ); + } + // verify the required parameter 'update_journey_node_request' is set + if ($update_journey_node_request === null || (is_array($update_journey_node_request) && count($update_journey_node_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_journey_node_request when calling updateJourneyNode' ); } - $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}/owner'; + $resourcePath = '/apps/{app_id}/journeys/{journey_id}/nodes/{node_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -13253,10 +16051,18 @@ public function transferSubscriptionRequest($app_id, $subscription_id, $transfer ); } // path params - if ($subscription_id !== null) { + if ($journey_id !== null) { $resourcePath = str_replace( - '{' . 'subscription_id' . '}', - ObjectSerializer::toPathValue($subscription_id), + '{' . 'journey_id' . '}', + ObjectSerializer::toPathValue($journey_id), + $resourcePath + ); + } + // path params + if ($node_id !== null) { + $resourcePath = str_replace( + '{' . 'node_id' . '}', + ObjectSerializer::toPathValue($node_id), $resourcePath ); } @@ -13274,11 +16080,11 @@ public function transferSubscriptionRequest($app_id, $subscription_id, $transfer } // for model (json/xml) - if (isset($transfer_subscription_request_body)) { + if (isset($update_journey_node_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($transfer_subscription_request_body)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_journey_node_request)); } else { - $httpBody = $transfer_subscription_request_body; + $httpBody = $update_journey_node_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -13314,7 +16120,7 @@ public function transferSubscriptionRequest($app_id, $subscription_id, $transfer } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -13332,40 +16138,40 @@ public function transferSubscriptionRequest($app_id, $subscription_id, $transfer } /** - * Operation unsubscribeEmailWithToken + * Operation updateLiveActivity * - * Unsubscribe with token + * Update a Live Activity via Push * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) - * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * @param string $activity_id Live Activity record ID (required) + * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request update_live_activity_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\UpdateLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function unsubscribeEmailWithToken($app_id, $notification_id, $token) + public function updateLiveActivity($app_id, $activity_id, $update_live_activity_request) { - list($response) = $this->unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, $token); + list($response) = $this->updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_live_activity_request); return $response; } /** - * Operation unsubscribeEmailWithTokenWithHttpInfo + * Operation updateLiveActivityWithHttpInfo * - * Unsubscribe with token + * Update a Live Activity via Push * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) - * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * @param string $activity_id Live Activity record ID (required) + * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\GenericSuccessBoolResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\UpdateLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, $token) + public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_live_activity_request) { - $request = $this->unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token); + $request = $this->updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request); try { $options = $this->createHttpClientOption(); @@ -13403,18 +16209,18 @@ public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, } switch($statusCode) { - case 202: - if ('\onesignal\client\model\GenericSuccessBoolResponse' === '\SplFileObject') { + case 200: + if ('\onesignal\client\model\UpdateLiveActivitySuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericSuccessBoolResponse' !== 'string') { + if ('\onesignal\client\model\UpdateLiveActivitySuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericSuccessBoolResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\UpdateLiveActivitySuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -13450,7 +16256,7 @@ public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, ]; } - $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; + $returnType = '\onesignal\client\model\UpdateLiveActivitySuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -13468,10 +16274,10 @@ public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, } catch (ApiException $e) { switch ($e->getCode()) { - case 202: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericSuccessBoolResponse', + '\onesignal\client\model\UpdateLiveActivitySuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13506,20 +16312,20 @@ public function unsubscribeEmailWithTokenWithHttpInfo($app_id, $notification_id, } /** - * Operation unsubscribeEmailWithTokenAsync + * Operation updateLiveActivityAsync * - * Unsubscribe with token + * Update a Live Activity via Push * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) - * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * @param string $activity_id Live Activity record ID (required) + * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unsubscribeEmailWithTokenAsync($app_id, $notification_id, $token) + public function updateLiveActivityAsync($app_id, $activity_id, $update_live_activity_request) { - return $this->unsubscribeEmailWithTokenAsyncWithHttpInfo($app_id, $notification_id, $token) + return $this->updateLiveActivityAsyncWithHttpInfo($app_id, $activity_id, $update_live_activity_request) ->then( function ($response) { return $response[0]; @@ -13528,21 +16334,21 @@ function ($response) { } /** - * Operation unsubscribeEmailWithTokenAsyncWithHttpInfo + * Operation updateLiveActivityAsyncWithHttpInfo * - * Unsubscribe with token + * Update a Live Activity via Push * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) - * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * @param string $activity_id Live Activity record ID (required) + * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function unsubscribeEmailWithTokenAsyncWithHttpInfo($app_id, $notification_id, $token) + public function updateLiveActivityAsyncWithHttpInfo($app_id, $activity_id, $update_live_activity_request) { - $returnType = '\onesignal\client\model\GenericSuccessBoolResponse'; - $request = $this->unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token); + $returnType = '\onesignal\client\model\UpdateLiveActivitySuccessResponse'; + $request = $this->updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -13581,52 +16387,43 @@ function ($exception) { } /** - * Create request for operation 'unsubscribeEmailWithToken' + * Create request for operation 'updateLiveActivity' * * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $notification_id The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report. (required) - * @param string $token The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email. (required) + * @param string $activity_id Live Activity record ID (required) + * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $token) + public function updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling unsubscribeEmailWithToken' + 'Missing the required parameter $app_id when calling updateLiveActivity' ); } - // verify the required parameter 'notification_id' is set - if ($notification_id === null || (is_array($notification_id) && count($notification_id) === 0)) { + // verify the required parameter 'activity_id' is set + if ($activity_id === null || (is_array($activity_id) && count($activity_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $notification_id when calling unsubscribeEmailWithToken' + 'Missing the required parameter $activity_id when calling updateLiveActivity' ); } - // verify the required parameter 'token' is set - if ($token === null || (is_array($token) && count($token) === 0)) { + // verify the required parameter 'update_live_activity_request' is set + if ($update_live_activity_request === null || (is_array($update_live_activity_request) && count($update_live_activity_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $token when calling unsubscribeEmailWithToken' + 'Missing the required parameter $update_live_activity_request when calling updateLiveActivity' ); } - $resourcePath = '/apps/{app_id}/notifications/{notification_id}/unsubscribe'; + $resourcePath = '/apps/{app_id}/live_activities/{activity_id}/notifications'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $token, - 'token', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); // path params @@ -13638,10 +16435,10 @@ public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $tok ); } // path params - if ($notification_id !== null) { + if ($activity_id !== null) { $resourcePath = str_replace( - '{' . 'notification_id' . '}', - ObjectSerializer::toPathValue($notification_id), + '{' . 'activity_id' . '}', + ObjectSerializer::toPathValue($activity_id), $resourcePath ); } @@ -13654,12 +16451,18 @@ public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $tok } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - [] + ['application/json'] ); } // for model (json/xml) - if (count($formParams) > 0) { + if (isset($update_live_activity_request)) { + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_live_activity_request)); + } else { + $httpBody = $update_live_activity_request; + } + } elseif (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -13693,7 +16496,7 @@ public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $tok } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -13711,40 +16514,40 @@ public function unsubscribeEmailWithTokenRequest($app_id, $notification_id, $tok } /** - * Operation updateApiKey + * Operation updateSegment * - * Update API key + * Update Segment * - * @param string $app_id app_id (required) - * @param string $token_id token_id (required) - * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request update_api_key_request (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request update_segment_request (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\UpdateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function updateApiKey($app_id, $token_id, $update_api_key_request) + public function updateSegment($app_id, $segment_id, $update_segment_request = null) { - list($response) = $this->updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_request); + list($response) = $this->updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_request); return $response; } /** - * Operation updateApiKeyWithHttpInfo + * Operation updateSegmentWithHttpInfo * - * Update API key + * Update Segment * - * @param string $app_id (required) - * @param string $token_id (required) - * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\UpdateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_request) + public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_request = null) { - $request = $this->updateApiKeyRequest($app_id, $token_id, $update_api_key_request); + $request = $this->updateSegmentRequest($app_id, $segment_id, $update_segment_request); try { $options = $this->createHttpClientOption(); @@ -13783,17 +16586,17 @@ public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_req switch($statusCode) { case 200: - if ('object' === '\SplFileObject') { + if ('\onesignal\client\model\UpdateSegmentSuccessResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('object' !== 'string') { + if ('\onesignal\client\model\UpdateSegmentSuccessResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, 'object', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\UpdateSegmentSuccessResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -13812,9 +16615,54 @@ public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_req $response->getStatusCode(), $response->getHeaders() ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } - $returnType = 'object'; + $returnType = '\onesignal\client\model\UpdateSegmentSuccessResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -13835,7 +16683,7 @@ public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_req case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'object', + '\onesignal\client\model\UpdateSegmentSuccessResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -13848,6 +16696,30 @@ public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_req ); $e->setResponseObject($data); break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -13862,20 +16734,20 @@ public function updateApiKeyWithHttpInfo($app_id, $token_id, $update_api_key_req } /** - * Operation updateApiKeyAsync + * Operation updateSegmentAsync * - * Update API key + * Update Segment * - * @param string $app_id (required) - * @param string $token_id (required) - * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateApiKeyAsync($app_id, $token_id, $update_api_key_request) + public function updateSegmentAsync($app_id, $segment_id, $update_segment_request = null) { - return $this->updateApiKeyAsyncWithHttpInfo($app_id, $token_id, $update_api_key_request) + return $this->updateSegmentAsyncWithHttpInfo($app_id, $segment_id, $update_segment_request) ->then( function ($response) { return $response[0]; @@ -13884,21 +16756,21 @@ function ($response) { } /** - * Operation updateApiKeyAsyncWithHttpInfo + * Operation updateSegmentAsyncWithHttpInfo * - * Update API key + * Update Segment * - * @param string $app_id (required) - * @param string $token_id (required) - * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateApiKeyAsyncWithHttpInfo($app_id, $token_id, $update_api_key_request) + public function updateSegmentAsyncWithHttpInfo($app_id, $segment_id, $update_segment_request = null) { - $returnType = 'object'; - $request = $this->updateApiKeyRequest($app_id, $token_id, $update_api_key_request); + $returnType = '\onesignal\client\model\UpdateSegmentSuccessResponse'; + $request = $this->updateSegmentRequest($app_id, $segment_id, $update_segment_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -13937,37 +16809,31 @@ function ($exception) { } /** - * Create request for operation 'updateApiKey' + * Create request for operation 'updateSegment' * - * @param string $app_id (required) - * @param string $token_id (required) - * @param \onesignal\client\model\UpdateApiKeyRequest $update_api_key_request (required) + * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) + * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) + * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) - { - // verify the required parameter 'app_id' is set - if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateApiKey' - ); - } - // verify the required parameter 'token_id' is set - if ($token_id === null || (is_array($token_id) && count($token_id) === 0)) { + public function updateSegmentRequest($app_id, $segment_id, $update_segment_request = null) + { + // verify the required parameter 'app_id' is set + if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $token_id when calling updateApiKey' + 'Missing the required parameter $app_id when calling updateSegment' ); } - // verify the required parameter 'update_api_key_request' is set - if ($update_api_key_request === null || (is_array($update_api_key_request) && count($update_api_key_request) === 0)) { + // verify the required parameter 'segment_id' is set + if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $update_api_key_request when calling updateApiKey' + 'Missing the required parameter $segment_id when calling updateSegment' ); } - $resourcePath = '/apps/{app_id}/auth/tokens/{token_id}'; + $resourcePath = '/apps/{app_id}/segments/{segment_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -13985,10 +16851,10 @@ public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) ); } // path params - if ($token_id !== null) { + if ($segment_id !== null) { $resourcePath = str_replace( - '{' . 'token_id' . '}', - ObjectSerializer::toPathValue($token_id), + '{' . 'segment_id' . '}', + ObjectSerializer::toPathValue($segment_id), $resourcePath ); } @@ -14006,11 +16872,11 @@ public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) } // for model (json/xml) - if (isset($update_api_key_request)) { + if (isset($update_segment_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_api_key_request)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_segment_request)); } else { - $httpBody = $update_api_key_request; + $httpBody = $update_segment_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -14036,8 +16902,8 @@ public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -14046,7 +16912,7 @@ public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -14064,38 +16930,35 @@ public function updateApiKeyRequest($app_id, $token_id, $update_api_key_request) } /** - * Operation updateApp - * - * Update an app + * Operation updateSubscription * - * @param string $app_id An app id (required) - * @param \onesignal\client\model\App $app app (required) + * @param string $app_id app_id (required) + * @param string $subscription_id subscription_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return void */ - public function updateApp($app_id, $app) + public function updateSubscription($app_id, $subscription_id, $subscription_body) { - list($response) = $this->updateAppWithHttpInfo($app_id, $app); - return $response; + $this->updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subscription_body); } /** - * Operation updateAppWithHttpInfo - * - * Update an app + * Operation updateSubscriptionWithHttpInfo * - * @param string $app_id An app id (required) - * @param \onesignal\client\model\App $app (required) + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\App|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of null, HTTP status code, HTTP response headers (array of strings) */ - public function updateAppWithHttpInfo($app_id, $app) + public function updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subscription_body) { - $request = $this->updateAppRequest($app_id, $app); + $request = $this->updateSubscriptionRequest($app_id, $subscription_id, $subscription_body); try { $options = $this->createHttpClientOption(); @@ -14132,81 +16995,27 @@ public function updateAppWithHttpInfo($app_id, $app) ); } - switch($statusCode) { - case 200: - if ('\onesignal\client\model\App' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\App' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\App', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - $returnType = '\onesignal\client\model\App'; - 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() - ]; + return [null, $statusCode, $response->getHeaders()]; } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\App', + '\onesignal\client\model\GenericError', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 409: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -14236,19 +17045,18 @@ public function updateAppWithHttpInfo($app_id, $app) } /** - * Operation updateAppAsync - * - * Update an app + * Operation updateSubscriptionAsync * - * @param string $app_id An app id (required) - * @param \onesignal\client\model\App $app (required) + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAppAsync($app_id, $app) + public function updateSubscriptionAsync($app_id, $subscription_id, $subscription_body) { - return $this->updateAppAsyncWithHttpInfo($app_id, $app) + return $this->updateSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $subscription_body) ->then( function ($response) { return $response[0]; @@ -14257,39 +17065,25 @@ function ($response) { } /** - * Operation updateAppAsyncWithHttpInfo - * - * Update an app + * Operation updateSubscriptionAsyncWithHttpInfo * - * @param string $app_id An app id (required) - * @param \onesignal\client\model\App $app (required) + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateAppAsyncWithHttpInfo($app_id, $app) + public function updateSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $subscription_body) { - $returnType = '\onesignal\client\model\App'; - $request = $this->updateAppRequest($app_id, $app); + $returnType = ''; + $request = $this->updateSubscriptionRequest($app_id, $subscription_id, $subscription_body); 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() - ]; + return [null, $response->getStatusCode(), $response->getHeaders()]; }, function ($exception) { $response = $exception->getResponse(); @@ -14309,30 +17103,37 @@ function ($exception) { } /** - * Create request for operation 'updateApp' + * Create request for operation 'updateSubscription' * - * @param string $app_id An app id (required) - * @param \onesignal\client\model\App $app (required) + * @param string $app_id (required) + * @param string $subscription_id (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateAppRequest($app_id, $app) + public function updateSubscriptionRequest($app_id, $subscription_id, $subscription_body) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateApp' + 'Missing the required parameter $app_id when calling updateSubscription' ); } - // verify the required parameter 'app' is set - if ($app === null || (is_array($app) && count($app) === 0)) { + // verify the required parameter 'subscription_id' is set + if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app when calling updateApp' + 'Missing the required parameter $subscription_id when calling updateSubscription' + ); + } + // verify the required parameter 'subscription_body' is set + if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_body when calling updateSubscription' ); } - $resourcePath = '/apps/{app_id}'; + $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -14349,6 +17150,14 @@ public function updateAppRequest($app_id, $app) $resourcePath ); } + // path params + if ($subscription_id !== null) { + $resourcePath = str_replace( + '{' . 'subscription_id' . '}', + ObjectSerializer::toPathValue($subscription_id), + $resourcePath + ); + } if ($multipart) { @@ -14363,11 +17172,11 @@ public function updateAppRequest($app_id, $app) } // for model (json/xml) - if (isset($app)) { + if (isset($subscription_body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($app)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); } else { - $httpBody = $app; + $httpBody = $subscription_body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -14393,8 +17202,8 @@ public function updateAppRequest($app_id, $app) } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -14403,7 +17212,7 @@ public function updateAppRequest($app_id, $app) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -14413,7 +17222,7 @@ public function updateAppRequest($app_id, $app) $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PUT', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -14421,40 +17230,42 @@ public function updateAppRequest($app_id, $app) } /** - * Operation updateLiveActivity + * Operation updateSubscriptionByToken * - * Update a Live Activity via Push + * Update subscription by token * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $activity_id Live Activity record ID (required) - * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request update_live_activity_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) + * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UpdateLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function updateLiveActivity($app_id, $activity_id, $update_live_activity_request) + public function updateSubscriptionByToken($app_id, $token_type, $token, $subscription_body) { - list($response) = $this->updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_live_activity_request); + list($response) = $this->updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $token, $subscription_body); return $response; } /** - * Operation updateLiveActivityWithHttpInfo + * Operation updateSubscriptionByTokenWithHttpInfo * - * Update a Live Activity via Push + * Update subscription by token * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $activity_id Live Activity record ID (required) - * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) + * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UpdateLiveActivitySuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_live_activity_request) + public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $token, $subscription_body) { - $request = $this->updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request); + $request = $this->updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body); try { $options = $this->createHttpClientOption(); @@ -14492,18 +17303,18 @@ public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_li } switch($statusCode) { - case 200: - if ('\onesignal\client\model\UpdateLiveActivitySuccessResponse' === '\SplFileObject') { + case 202: + if ('object' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UpdateLiveActivitySuccessResponse' !== 'string') { + if ('object' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UpdateLiveActivitySuccessResponse', []), + ObjectSerializer::deserialize($content, 'object', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -14522,24 +17333,24 @@ public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_li $response->getStatusCode(), $response->getHeaders() ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + case 404: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { + if ('\onesignal\client\model\GenericError' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), $response->getHeaders() ]; } - $returnType = '\onesignal\client\model\UpdateLiveActivitySuccessResponse'; + $returnType = 'object'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -14557,10 +17368,10 @@ public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_li } catch (ApiException $e) { switch ($e->getCode()) { - case 200: + case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UpdateLiveActivitySuccessResponse', + 'object', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14573,10 +17384,10 @@ public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_li ); $e->setResponseObject($data); break; - case 429: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', + '\onesignal\client\model\GenericError', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14595,20 +17406,21 @@ public function updateLiveActivityWithHttpInfo($app_id, $activity_id, $update_li } /** - * Operation updateLiveActivityAsync + * Operation updateSubscriptionByTokenAsync * - * Update a Live Activity via Push + * Update subscription by token * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $activity_id Live Activity record ID (required) - * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) + * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateLiveActivityAsync($app_id, $activity_id, $update_live_activity_request) + public function updateSubscriptionByTokenAsync($app_id, $token_type, $token, $subscription_body) { - return $this->updateLiveActivityAsyncWithHttpInfo($app_id, $activity_id, $update_live_activity_request) + return $this->updateSubscriptionByTokenAsyncWithHttpInfo($app_id, $token_type, $token, $subscription_body) ->then( function ($response) { return $response[0]; @@ -14617,21 +17429,22 @@ function ($response) { } /** - * Operation updateLiveActivityAsyncWithHttpInfo + * Operation updateSubscriptionByTokenAsyncWithHttpInfo * - * Update a Live Activity via Push + * Update subscription by token * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $activity_id Live Activity record ID (required) - * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) + * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateLiveActivityAsyncWithHttpInfo($app_id, $activity_id, $update_live_activity_request) + public function updateSubscriptionByTokenAsyncWithHttpInfo($app_id, $token_type, $token, $subscription_body) { - $returnType = '\onesignal\client\model\UpdateLiveActivitySuccessResponse'; - $request = $this->updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request); + $returnType = 'object'; + $request = $this->updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -14670,37 +17483,44 @@ function ($exception) { } /** - * Create request for operation 'updateLiveActivity' + * Create request for operation 'updateSubscriptionByToken' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $activity_id Live Activity record ID (required) - * @param \onesignal\client\model\UpdateLiveActivityRequest $update_live_activity_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) + * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) + * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateLiveActivityRequest($app_id, $activity_id, $update_live_activity_request) + public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateLiveActivity' + 'Missing the required parameter $app_id when calling updateSubscriptionByToken' ); } - // verify the required parameter 'activity_id' is set - if ($activity_id === null || (is_array($activity_id) && count($activity_id) === 0)) { + // verify the required parameter 'token_type' is set + if ($token_type === null || (is_array($token_type) && count($token_type) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $activity_id when calling updateLiveActivity' + 'Missing the required parameter $token_type when calling updateSubscriptionByToken' ); } - // verify the required parameter 'update_live_activity_request' is set - if ($update_live_activity_request === null || (is_array($update_live_activity_request) && count($update_live_activity_request) === 0)) { + // verify the required parameter 'token' is set + if ($token === null || (is_array($token) && count($token) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $update_live_activity_request when calling updateLiveActivity' + 'Missing the required parameter $token when calling updateSubscriptionByToken' + ); + } + // verify the required parameter 'subscription_body' is set + if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $subscription_body when calling updateSubscriptionByToken' ); } - $resourcePath = '/apps/{app_id}/live_activities/{activity_id}/notifications'; + $resourcePath = '/apps/{app_id}/subscriptions_by_token/{token_type}/{token}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -14718,10 +17538,18 @@ public function updateLiveActivityRequest($app_id, $activity_id, $update_live_ac ); } // path params - if ($activity_id !== null) { + if ($token_type !== null) { $resourcePath = str_replace( - '{' . 'activity_id' . '}', - ObjectSerializer::toPathValue($activity_id), + '{' . 'token_type' . '}', + ObjectSerializer::toPathValue($token_type), + $resourcePath + ); + } + // path params + if ($token !== null) { + $resourcePath = str_replace( + '{' . 'token' . '}', + ObjectSerializer::toPathValue($token), $resourcePath ); } @@ -14739,11 +17567,11 @@ public function updateLiveActivityRequest($app_id, $activity_id, $update_live_ac } // for model (json/xml) - if (isset($update_live_activity_request)) { + if (isset($subscription_body)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_live_activity_request)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); } else { - $httpBody = $update_live_activity_request; + $httpBody = $subscription_body; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -14779,7 +17607,7 @@ public function updateLiveActivityRequest($app_id, $activity_id, $update_live_ac } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -14789,7 +17617,7 @@ public function updateLiveActivityRequest($app_id, $activity_id, $update_live_ac $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'POST', + 'PATCH', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -14797,40 +17625,40 @@ public function updateLiveActivityRequest($app_id, $activity_id, $update_live_ac } /** - * Operation updateSegment + * Operation updateTemplate * - * Update Segment + * Update template * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request update_segment_request (optional) + * @param string $template_id template_id (required) + * @param string $app_id app_id (required) + * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request update_template_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\UpdateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function updateSegment($app_id, $segment_id, $update_segment_request = null) + public function updateTemplate($template_id, $app_id, $update_template_request) { - list($response) = $this->updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_request); + list($response) = $this->updateTemplateWithHttpInfo($template_id, $app_id, $update_template_request); return $response; } /** - * Operation updateSegmentWithHttpInfo + * Operation updateTemplateWithHttpInfo * - * Update Segment + * Update template * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) + * @param string $template_id (required) + * @param string $app_id (required) + * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\UpdateSegmentSuccessResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_request = null) + public function updateTemplateWithHttpInfo($template_id, $app_id, $update_template_request) { - $request = $this->updateSegmentRequest($app_id, $segment_id, $update_segment_request); + $request = $this->updateTemplateRequest($template_id, $app_id, $update_template_request); try { $options = $this->createHttpClientOption(); @@ -14869,17 +17697,17 @@ public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_ switch($statusCode) { case 200: - if ('\onesignal\client\model\UpdateSegmentSuccessResponse' === '\SplFileObject') { + if ('\onesignal\client\model\TemplateResource' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\UpdateSegmentSuccessResponse' !== 'string') { + if ('\onesignal\client\model\TemplateResource' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\UpdateSegmentSuccessResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\TemplateResource', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -14898,54 +17726,9 @@ public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_ $response->getStatusCode(), $response->getHeaders() ]; - case 403: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 429: - if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\RateLimitError' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; } - $returnType = '\onesignal\client\model\UpdateSegmentSuccessResponse'; + $returnType = '\onesignal\client\model\TemplateResource'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -14966,7 +17749,7 @@ public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_ case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\UpdateSegmentSuccessResponse', + '\onesignal\client\model\TemplateResource', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -14979,30 +17762,6 @@ public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_ ); $e->setResponseObject($data); break; - case 403: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 429: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\RateLimitError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -15017,20 +17776,20 @@ public function updateSegmentWithHttpInfo($app_id, $segment_id, $update_segment_ } /** - * Operation updateSegmentAsync + * Operation updateTemplateAsync * - * Update Segment + * Update template * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) + * @param string $template_id (required) + * @param string $app_id (required) + * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSegmentAsync($app_id, $segment_id, $update_segment_request = null) + public function updateTemplateAsync($template_id, $app_id, $update_template_request) { - return $this->updateSegmentAsyncWithHttpInfo($app_id, $segment_id, $update_segment_request) + return $this->updateTemplateAsyncWithHttpInfo($template_id, $app_id, $update_template_request) ->then( function ($response) { return $response[0]; @@ -15039,21 +17798,21 @@ function ($response) { } /** - * Operation updateSegmentAsyncWithHttpInfo + * Operation updateTemplateAsyncWithHttpInfo * - * Update Segment + * Update template * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) + * @param string $template_id (required) + * @param string $app_id (required) + * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSegmentAsyncWithHttpInfo($app_id, $segment_id, $update_segment_request = null) + public function updateTemplateAsyncWithHttpInfo($template_id, $app_id, $update_template_request) { - $returnType = '\onesignal\client\model\UpdateSegmentSuccessResponse'; - $request = $this->updateSegmentRequest($app_id, $segment_id, $update_segment_request); + $returnType = '\onesignal\client\model\TemplateResource'; + $request = $this->updateTemplateRequest($template_id, $app_id, $update_template_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -15092,52 +17851,59 @@ function ($exception) { } /** - * Create request for operation 'updateSegment' + * Create request for operation 'updateTemplate' * - * @param string $app_id The OneSignal App ID for your app. Available in Keys & IDs. (required) - * @param string $segment_id The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. (required) - * @param \onesignal\client\model\UpdateSegmentRequest $update_segment_request (optional) + * @param string $template_id (required) + * @param string $app_id (required) + * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateSegmentRequest($app_id, $segment_id, $update_segment_request = null) + public function updateTemplateRequest($template_id, $app_id, $update_template_request) { + // verify the required parameter 'template_id' is set + if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $template_id when calling updateTemplate' + ); + } // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateSegment' + 'Missing the required parameter $app_id when calling updateTemplate' ); } - // verify the required parameter 'segment_id' is set - if ($segment_id === null || (is_array($segment_id) && count($segment_id) === 0)) { + // verify the required parameter 'update_template_request' is set + if ($update_template_request === null || (is_array($update_template_request) && count($update_template_request) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $segment_id when calling updateSegment' + 'Missing the required parameter $update_template_request when calling updateTemplate' ); } - $resourcePath = '/apps/{app_id}/segments/{segment_id}'; + $resourcePath = '/templates/{template_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $app_id, + 'app_id', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); // path params - if ($app_id !== null) { - $resourcePath = str_replace( - '{' . 'app_id' . '}', - ObjectSerializer::toPathValue($app_id), - $resourcePath - ); - } - // path params - if ($segment_id !== null) { + if ($template_id !== null) { $resourcePath = str_replace( - '{' . 'segment_id' . '}', - ObjectSerializer::toPathValue($segment_id), + '{' . 'template_id' . '}', + ObjectSerializer::toPathValue($template_id), $resourcePath ); } @@ -15155,11 +17921,11 @@ public function updateSegmentRequest($app_id, $segment_id, $update_segment_reque } // for model (json/xml) - if (isset($update_segment_request)) { + if (isset($update_template_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_segment_request)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_template_request)); } else { - $httpBody = $update_segment_request; + $httpBody = $update_template_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -15195,7 +17961,7 @@ public function updateSegmentRequest($app_id, $segment_id, $update_segment_reque } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -15213,35 +17979,38 @@ public function updateSegmentRequest($app_id, $segment_id, $update_segment_reque } /** - * Operation updateSubscription + * Operation updateUser * * @param string $app_id app_id (required) - * @param string $subscription_id subscription_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) + * @param string $alias_label alias_label (required) + * @param string $alias_id alias_id (required) + * @param \onesignal\client\model\UpdateUserRequest $update_user_request update_user_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return void + * @return \onesignal\client\model\PropertiesBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function updateSubscription($app_id, $subscription_id, $subscription_body) + public function updateUser($app_id, $alias_label, $alias_id, $update_user_request) { - $this->updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subscription_body); + list($response) = $this->updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request); + return $response; } /** - * Operation updateSubscriptionWithHttpInfo + * Operation updateUserWithHttpInfo * * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\PropertiesBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subscription_body) + public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) { - $request = $this->updateSubscriptionRequest($app_id, $subscription_id, $subscription_body); + $request = $this->updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request); try { $options = $this->createHttpClientOption(); @@ -15278,19 +18047,96 @@ public function updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subsc ); } - return [null, $statusCode, $response->getHeaders()]; + switch($statusCode) { + case 202: + if ('\onesignal\client\model\PropertiesBody' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\PropertiesBody' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\PropertiesBody', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 400: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 409: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\onesignal\client\model\PropertiesBody'; + 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 400: + case 202: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\PropertiesBody', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 404: + case 400: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -15328,18 +18174,19 @@ public function updateSubscriptionWithHttpInfo($app_id, $subscription_id, $subsc } /** - * Operation updateSubscriptionAsync + * Operation updateUserAsync * * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSubscriptionAsync($app_id, $subscription_id, $subscription_body) + public function updateUserAsync($app_id, $alias_label, $alias_id, $update_user_request) { - return $this->updateSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $subscription_body) + return $this->updateUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) ->then( function ($response) { return $response[0]; @@ -15348,25 +18195,39 @@ function ($response) { } /** - * Operation updateSubscriptionAsyncWithHttpInfo + * Operation updateUserAsyncWithHttpInfo * * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSubscriptionAsyncWithHttpInfo($app_id, $subscription_id, $subscription_body) + public function updateUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) { - $returnType = ''; - $request = $this->updateSubscriptionRequest($app_id, $subscription_id, $subscription_body); + $returnType = '\onesignal\client\model\PropertiesBody'; + $request = $this->updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request); return $this->client ->sendAsync($request, $this->createHttpClientOption()) ->then( function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; }, function ($exception) { $response = $exception->getResponse(); @@ -15386,37 +18247,44 @@ function ($exception) { } /** - * Create request for operation 'updateSubscription' + * Create request for operation 'updateUser' * * @param string $app_id (required) - * @param string $subscription_id (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $alias_label (required) + * @param string $alias_id (required) + * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateSubscriptionRequest($app_id, $subscription_id, $subscription_body) + public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateSubscription' + 'Missing the required parameter $app_id when calling updateUser' ); } - // verify the required parameter 'subscription_id' is set - if ($subscription_id === null || (is_array($subscription_id) && count($subscription_id) === 0)) { + // verify the required parameter 'alias_label' is set + if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_id when calling updateSubscription' + 'Missing the required parameter $alias_label when calling updateUser' ); } - // verify the required parameter 'subscription_body' is set - if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { + // verify the required parameter 'alias_id' is set + if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_body when calling updateSubscription' + 'Missing the required parameter $alias_id when calling updateUser' + ); + } + // verify the required parameter 'update_user_request' is set + if ($update_user_request === null || (is_array($update_user_request) && count($update_user_request) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $update_user_request when calling updateUser' ); } - $resourcePath = '/apps/{app_id}/subscriptions/{subscription_id}'; + $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; $formParams = []; $queryParams = []; $headerParams = []; @@ -15434,10 +18302,18 @@ public function updateSubscriptionRequest($app_id, $subscription_id, $subscripti ); } // path params - if ($subscription_id !== null) { + if ($alias_label !== null) { $resourcePath = str_replace( - '{' . 'subscription_id' . '}', - ObjectSerializer::toPathValue($subscription_id), + '{' . 'alias_label' . '}', + ObjectSerializer::toPathValue($alias_label), + $resourcePath + ); + } + // path params + if ($alias_id !== null) { + $resourcePath = str_replace( + '{' . 'alias_id' . '}', + ObjectSerializer::toPathValue($alias_id), $resourcePath ); } @@ -15455,11 +18331,11 @@ public function updateSubscriptionRequest($app_id, $subscription_id, $subscripti } // for model (json/xml) - if (isset($subscription_body)) { + if (isset($update_user_request)) { if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_user_request)); } else { - $httpBody = $subscription_body; + $httpBody = $update_user_request; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -15495,7 +18371,7 @@ public function updateSubscriptionRequest($app_id, $subscription_id, $subscripti } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -15513,42 +18389,36 @@ public function updateSubscriptionRequest($app_id, $subscription_id, $subscripti } /** - * Operation updateSubscriptionByToken + * Operation viewApiKeys * - * Update subscription by token + * View API keys * - * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) - * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body subscription_body (required) + * @param string $app_id app_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\ApiKeyTokensListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError */ - public function updateSubscriptionByToken($app_id, $token_type, $token, $subscription_body) + public function viewApiKeys($app_id) { - list($response) = $this->updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $token, $subscription_body); + list($response) = $this->viewApiKeysWithHttpInfo($app_id); return $response; } /** - * Operation updateSubscriptionByTokenWithHttpInfo + * Operation viewApiKeysWithHttpInfo * - * Update subscription by token + * View API keys * - * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) - * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $app_id (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of object|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\ApiKeyTokensListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $token, $subscription_body) + public function viewApiKeysWithHttpInfo($app_id) { - $request = $this->updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body); + $request = $this->viewApiKeysRequest($app_id); try { $options = $this->createHttpClientOption(); @@ -15586,18 +18456,18 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok } switch($statusCode) { - case 202: - if ('object' === '\SplFileObject') { + case 200: + if ('\onesignal\client\model\ApiKeyTokensListResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('object' !== 'string') { + if ('\onesignal\client\model\ApiKeyTokensListResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, 'object', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\ApiKeyTokensListResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -15611,21 +18481,6 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok } } - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 404: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { - $content = json_decode($content); - } - } - return [ ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), $response->getStatusCode(), @@ -15633,7 +18488,7 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok ]; } - $returnType = 'object'; + $returnType = '\onesignal\client\model\ApiKeyTokensListResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -15651,10 +18506,10 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok } catch (ApiException $e) { switch ($e->getCode()) { - case 202: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - 'object', + '\onesignal\client\model\ApiKeyTokensListResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -15667,14 +18522,6 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok ); $e->setResponseObject($data); break; - case 404: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\GenericError', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -15689,21 +18536,18 @@ public function updateSubscriptionByTokenWithHttpInfo($app_id, $token_type, $tok } /** - * Operation updateSubscriptionByTokenAsync + * Operation viewApiKeysAsync * - * Update subscription by token + * View API keys * - * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) - * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSubscriptionByTokenAsync($app_id, $token_type, $token, $subscription_body) + public function viewApiKeysAsync($app_id) { - return $this->updateSubscriptionByTokenAsyncWithHttpInfo($app_id, $token_type, $token, $subscription_body) + return $this->viewApiKeysAsyncWithHttpInfo($app_id) ->then( function ($response) { return $response[0]; @@ -15712,22 +18556,19 @@ function ($response) { } /** - * Operation updateSubscriptionByTokenAsyncWithHttpInfo + * Operation viewApiKeysAsyncWithHttpInfo * - * Update subscription by token + * View API keys * - * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) - * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateSubscriptionByTokenAsyncWithHttpInfo($app_id, $token_type, $token, $subscription_body) + public function viewApiKeysAsyncWithHttpInfo($app_id) { - $returnType = 'object'; - $request = $this->updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body); + $returnType = '\onesignal\client\model\ApiKeyTokensListResponse'; + $request = $this->viewApiKeysRequest($app_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -15766,44 +18607,23 @@ function ($exception) { } /** - * Create request for operation 'updateSubscriptionByToken' + * Create request for operation 'viewApiKeys' * - * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) - * @param string $token_type The type of token to use when looking up the subscription. See Subscription Types. (required) - * @param string $token The value of the token to lookup by (e.g., email address, phone number). (required) - * @param \onesignal\client\model\SubscriptionBody $subscription_body (required) + * @param string $app_id (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $subscription_body) + public function viewApiKeysRequest($app_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateSubscriptionByToken' - ); - } - // verify the required parameter 'token_type' is set - if ($token_type === null || (is_array($token_type) && count($token_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $token_type when calling updateSubscriptionByToken' - ); - } - // verify the required parameter 'token' is set - if ($token === null || (is_array($token) && count($token) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $token when calling updateSubscriptionByToken' - ); - } - // verify the required parameter 'subscription_body' is set - if ($subscription_body === null || (is_array($subscription_body) && count($subscription_body) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $subscription_body when calling updateSubscriptionByToken' + 'Missing the required parameter $app_id when calling viewApiKeys' ); } - $resourcePath = '/apps/{app_id}/subscriptions_by_token/{token_type}/{token}'; + $resourcePath = '/apps/{app_id}/auth/tokens'; $formParams = []; $queryParams = []; $headerParams = []; @@ -15820,22 +18640,6 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ $resourcePath ); } - // path params - if ($token_type !== null) { - $resourcePath = str_replace( - '{' . 'token_type' . '}', - ObjectSerializer::toPathValue($token_type), - $resourcePath - ); - } - // path params - if ($token !== null) { - $resourcePath = str_replace( - '{' . 'token' . '}', - ObjectSerializer::toPathValue($token), - $resourcePath - ); - } if ($multipart) { @@ -15845,18 +18649,12 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($subscription_body)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($subscription_body)); - } else { - $httpBody = $subscription_body; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -15880,8 +18678,8 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ } } - if (!empty($this->config->getRestApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); + if (!empty($this->config->getOrganizationApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); } $defaultHeaders = []; @@ -15890,7 +18688,7 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -15900,7 +18698,7 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -15908,40 +18706,38 @@ public function updateSubscriptionByTokenRequest($app_id, $token_type, $token, $ } /** - * Operation updateTemplate + * Operation viewJourney * - * Update template + * View journey * - * @param string $template_id template_id (required) - * @param string $app_id app_id (required) - * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request update_template_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function updateTemplate($template_id, $app_id, $update_template_request) + public function viewJourney($app_id, $journey_id) { - list($response) = $this->updateTemplateWithHttpInfo($template_id, $app_id, $update_template_request); + list($response) = $this->viewJourneyWithHttpInfo($app_id, $journey_id); return $response; } /** - * Operation updateTemplateWithHttpInfo + * Operation viewJourneyWithHttpInfo * - * Update template + * View journey * - * @param string $template_id (required) - * @param string $app_id (required) - * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\TemplateResource|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\Journey|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateTemplateWithHttpInfo($template_id, $app_id, $update_template_request) + public function viewJourneyWithHttpInfo($app_id, $journey_id) { - $request = $this->updateTemplateRequest($template_id, $app_id, $update_template_request); + $request = $this->viewJourneyRequest($app_id, $journey_id); try { $options = $this->createHttpClientOption(); @@ -15980,21 +18776,21 @@ public function updateTemplateWithHttpInfo($template_id, $app_id, $update_templa switch($statusCode) { case 200: - if ('\onesignal\client\model\TemplateResource' === '\SplFileObject') { + if ('\onesignal\client\model\Journey' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\TemplateResource' !== 'string') { + if ('\onesignal\client\model\Journey' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\TemplateResource', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\Journey', []), $response->getStatusCode(), $response->getHeaders() ]; - case 400: + case 404: if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -16009,9 +18805,24 @@ public function updateTemplateWithHttpInfo($template_id, $app_id, $update_templa $response->getStatusCode(), $response->getHeaders() ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } - $returnType = '\onesignal\client\model\TemplateResource'; + $returnType = '\onesignal\client\model\Journey'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -16032,12 +18843,12 @@ public function updateTemplateWithHttpInfo($template_id, $app_id, $update_templa case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\TemplateResource', + '\onesignal\client\model\Journey', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 400: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -16045,6 +18856,14 @@ public function updateTemplateWithHttpInfo($template_id, $app_id, $update_templa ); $e->setResponseObject($data); break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -16059,20 +18878,19 @@ public function updateTemplateWithHttpInfo($template_id, $app_id, $update_templa } /** - * Operation updateTemplateAsync + * Operation viewJourneyAsync * - * Update template + * View journey * - * @param string $template_id (required) - * @param string $app_id (required) - * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateTemplateAsync($template_id, $app_id, $update_template_request) + public function viewJourneyAsync($app_id, $journey_id) { - return $this->updateTemplateAsyncWithHttpInfo($template_id, $app_id, $update_template_request) + return $this->viewJourneyAsyncWithHttpInfo($app_id, $journey_id) ->then( function ($response) { return $response[0]; @@ -16081,21 +18899,20 @@ function ($response) { } /** - * Operation updateTemplateAsyncWithHttpInfo + * Operation viewJourneyAsyncWithHttpInfo * - * Update template + * View journey * - * @param string $template_id (required) - * @param string $app_id (required) - * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateTemplateAsyncWithHttpInfo($template_id, $app_id, $update_template_request) + public function viewJourneyAsyncWithHttpInfo($app_id, $journey_id) { - $returnType = '\onesignal\client\model\TemplateResource'; - $request = $this->updateTemplateRequest($template_id, $app_id, $update_template_request); + $returnType = '\onesignal\client\model\Journey'; + $request = $this->viewJourneyRequest($app_id, $journey_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -16134,59 +18951,51 @@ function ($exception) { } /** - * Create request for operation 'updateTemplate' + * Create request for operation 'viewJourney' * - * @param string $template_id (required) - * @param string $app_id (required) - * @param \onesignal\client\model\UpdateTemplateRequest $update_template_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateTemplateRequest($template_id, $app_id, $update_template_request) + public function viewJourneyRequest($app_id, $journey_id) { - // verify the required parameter 'template_id' is set - if ($template_id === null || (is_array($template_id) && count($template_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $template_id when calling updateTemplate' - ); - } // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateTemplate' + 'Missing the required parameter $app_id when calling viewJourney' ); } - // verify the required parameter 'update_template_request' is set - if ($update_template_request === null || (is_array($update_template_request) && count($update_template_request) === 0)) { + // verify the required parameter 'journey_id' is set + if ($journey_id === null || (is_array($journey_id) && count($journey_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $update_template_request when calling updateTemplate' + 'Missing the required parameter $journey_id when calling viewJourney' ); } - $resourcePath = '/templates/{template_id}'; + $resourcePath = '/apps/{app_id}/journeys/{journey_id}'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $app_id, - 'app_id', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); + $multipart = false; + // path params - if ($template_id !== null) { + if ($app_id !== null) { $resourcePath = str_replace( - '{' . 'template_id' . '}', - ObjectSerializer::toPathValue($template_id), + '{' . 'app_id' . '}', + ObjectSerializer::toPathValue($app_id), + $resourcePath + ); + } + // path params + if ($journey_id !== null) { + $resourcePath = str_replace( + '{' . 'journey_id' . '}', + ObjectSerializer::toPathValue($journey_id), $resourcePath ); } @@ -16199,18 +19008,12 @@ public function updateTemplateRequest($template_id, $app_id, $update_template_re } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($update_template_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_template_request)); - } else { - $httpBody = $update_template_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -16244,7 +19047,7 @@ public function updateTemplateRequest($template_id, $app_id, $update_template_re } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -16254,7 +19057,7 @@ public function updateTemplateRequest($template_id, $app_id, $update_template_re $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -16262,38 +19065,38 @@ public function updateTemplateRequest($template_id, $app_id, $update_template_re } /** - * Operation updateUser + * Operation viewJourneyStats * - * @param string $app_id app_id (required) - * @param string $alias_label alias_label (required) - * @param string $alias_id alias_id (required) - * @param \onesignal\client\model\UpdateUserRequest $update_user_request update_user_request (required) + * View journey stats + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve stats for. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\PropertiesBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\JourneyStats|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function updateUser($app_id, $alias_label, $alias_id, $update_user_request) + public function viewJourneyStats($app_id, $journey_id) { - list($response) = $this->updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request); + list($response) = $this->viewJourneyStatsWithHttpInfo($app_id, $journey_id); return $response; } /** - * Operation updateUserWithHttpInfo + * Operation viewJourneyStatsWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) + * View journey stats + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve stats for. (required) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\PropertiesBody|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\JourneyStats|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) + public function viewJourneyStatsWithHttpInfo($app_id, $journey_id) { - $request = $this->updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request); + $request = $this->viewJourneyStatsRequest($app_id, $journey_id); try { $options = $this->createHttpClientOption(); @@ -16331,37 +19134,22 @@ public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update } switch($statusCode) { - case 202: - if ('\onesignal\client\model\PropertiesBody' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\onesignal\client\model\PropertiesBody' !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\PropertiesBody', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - case 400: - if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + case 200: + if ('\onesignal\client\model\JourneyStats' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\GenericError' !== 'string') { + if ('\onesignal\client\model\JourneyStats' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\JourneyStats', []), $response->getStatusCode(), $response->getHeaders() ]; - case 409: + case 404: if ('\onesignal\client\model\GenericError' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -16393,7 +19181,7 @@ public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update ]; } - $returnType = '\onesignal\client\model\PropertiesBody'; + $returnType = '\onesignal\client\model\JourneyStats'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -16411,23 +19199,15 @@ public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update } catch (ApiException $e) { switch ($e->getCode()) { - case 202: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\onesignal\client\model\PropertiesBody', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - case 400: + case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\GenericError', + '\onesignal\client\model\JourneyStats', $e->getResponseHeaders() ); $e->setResponseObject($data); break; - case 409: + case 404: $data = ObjectSerializer::deserialize( $e->getResponseBody(), '\onesignal\client\model\GenericError', @@ -16457,19 +19237,19 @@ public function updateUserWithHttpInfo($app_id, $alias_label, $alias_id, $update } /** - * Operation updateUserAsync + * Operation viewJourneyStatsAsync * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) + * View journey stats + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve stats for. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateUserAsync($app_id, $alias_label, $alias_id, $update_user_request) + public function viewJourneyStatsAsync($app_id, $journey_id) { - return $this->updateUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) + return $this->viewJourneyStatsAsyncWithHttpInfo($app_id, $journey_id) ->then( function ($response) { return $response[0]; @@ -16478,20 +19258,20 @@ function ($response) { } /** - * Operation updateUserAsyncWithHttpInfo + * Operation viewJourneyStatsAsyncWithHttpInfo * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) + * View journey stats + * + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve stats for. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function updateUserAsyncWithHttpInfo($app_id, $alias_label, $alias_id, $update_user_request) + public function viewJourneyStatsAsyncWithHttpInfo($app_id, $journey_id) { - $returnType = '\onesignal\client\model\PropertiesBody'; - $request = $this->updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request); + $returnType = '\onesignal\client\model\JourneyStats'; + $request = $this->viewJourneyStatsRequest($app_id, $journey_id); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -16530,44 +19310,30 @@ function ($exception) { } /** - * Create request for operation 'updateUser' + * Create request for operation 'viewJourneyStats' * - * @param string $app_id (required) - * @param string $alias_label (required) - * @param string $alias_id (required) - * @param \onesignal\client\model\UpdateUserRequest $update_user_request (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $journey_id UUID of the journey to retrieve stats for. (required) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user_request) + public function viewJourneyStatsRequest($app_id, $journey_id) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling updateUser' - ); - } - // verify the required parameter 'alias_label' is set - if ($alias_label === null || (is_array($alias_label) && count($alias_label) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_label when calling updateUser' - ); - } - // verify the required parameter 'alias_id' is set - if ($alias_id === null || (is_array($alias_id) && count($alias_id) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $alias_id when calling updateUser' + 'Missing the required parameter $app_id when calling viewJourneyStats' ); } - // verify the required parameter 'update_user_request' is set - if ($update_user_request === null || (is_array($update_user_request) && count($update_user_request) === 0)) { + // verify the required parameter 'journey_id' is set + if ($journey_id === null || (is_array($journey_id) && count($journey_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $update_user_request when calling updateUser' + 'Missing the required parameter $journey_id when calling viewJourneyStats' ); } - $resourcePath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'; + $resourcePath = '/apps/{app_id}/journeys/{journey_id}/stats'; $formParams = []; $queryParams = []; $headerParams = []; @@ -16585,18 +19351,10 @@ public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user ); } // path params - if ($alias_label !== null) { - $resourcePath = str_replace( - '{' . 'alias_label' . '}', - ObjectSerializer::toPathValue($alias_label), - $resourcePath - ); - } - // path params - if ($alias_id !== null) { + if ($journey_id !== null) { $resourcePath = str_replace( - '{' . 'alias_id' . '}', - ObjectSerializer::toPathValue($alias_id), + '{' . 'journey_id' . '}', + ObjectSerializer::toPathValue($journey_id), $resourcePath ); } @@ -16609,18 +19367,12 @@ public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user } else { $headers = $this->headerSelector->selectHeaders( ['application/json'], - ['application/json'] + [] ); } // for model (json/xml) - if (isset($update_user_request)) { - if ($headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($update_user_request)); - } else { - $httpBody = $update_user_request; - } - } elseif (count($formParams) > 0) { + if (count($formParams) > 0) { if ($multipart) { $multipartContents = []; foreach ($formParams as $formParamName => $formParamValue) { @@ -16654,7 +19406,7 @@ public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -16664,7 +19416,7 @@ public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user $query = ObjectSerializer::buildQuery($queryParams); return new Request( - 'PATCH', + 'GET', $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), $headers, $httpBody @@ -16672,36 +19424,40 @@ public function updateUserRequest($app_id, $alias_label, $alias_id, $update_user } /** - * Operation viewApiKeys + * Operation viewJourneys * - * View API keys + * View journeys * - * @param string $app_id app_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. (optional) + * @param int $limit Maximum journeys to return per page. Minimum 1, maximum 50. (optional, default to 50) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return \onesignal\client\model\ApiKeyTokensListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError + * @return \onesignal\client\model\JourneyListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError */ - public function viewApiKeys($app_id) + public function viewJourneys($app_id, $cursor = null, $limit = 50) { - list($response) = $this->viewApiKeysWithHttpInfo($app_id); + list($response) = $this->viewJourneysWithHttpInfo($app_id, $cursor, $limit); return $response; } /** - * Operation viewApiKeysWithHttpInfo + * Operation viewJourneysWithHttpInfo * - * View API keys + * View journeys * - * @param string $app_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. (optional) + * @param int $limit Maximum journeys to return per page. Minimum 1, maximum 50. (optional, default to 50) * * @throws \onesignal\client\ApiException on non-2xx response * @throws \InvalidArgumentException - * @return array of \onesignal\client\model\ApiKeyTokensListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) + * @return array of \onesignal\client\model\JourneyListResponse|\onesignal\client\model\GenericError|\onesignal\client\model\GenericError|\onesignal\client\model\RateLimitError|\onesignal\client\model\GenericError, HTTP status code, HTTP response headers (array of strings) */ - public function viewApiKeysWithHttpInfo($app_id) + public function viewJourneysWithHttpInfo($app_id, $cursor = null, $limit = 50) { - $request = $this->viewApiKeysRequest($app_id); + $request = $this->viewJourneysRequest($app_id, $cursor, $limit); try { $options = $this->createHttpClientOption(); @@ -16740,17 +19496,17 @@ public function viewApiKeysWithHttpInfo($app_id) switch($statusCode) { case 200: - if ('\onesignal\client\model\ApiKeyTokensListResponse' === '\SplFileObject') { + if ('\onesignal\client\model\JourneyListResponse' === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { $content = (string) $response->getBody(); - if ('\onesignal\client\model\ApiKeyTokensListResponse' !== 'string') { + if ('\onesignal\client\model\JourneyListResponse' !== 'string') { $content = json_decode($content); } } return [ - ObjectSerializer::deserialize($content, '\onesignal\client\model\ApiKeyTokensListResponse', []), + ObjectSerializer::deserialize($content, '\onesignal\client\model\JourneyListResponse', []), $response->getStatusCode(), $response->getHeaders() ]; @@ -16769,9 +19525,39 @@ public function viewApiKeysWithHttpInfo($app_id) $response->getStatusCode(), $response->getHeaders() ]; + case 403: + if ('\onesignal\client\model\GenericError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\GenericError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\GenericError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + case 429: + if ('\onesignal\client\model\RateLimitError' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\onesignal\client\model\RateLimitError' !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, '\onesignal\client\model\RateLimitError', []), + $response->getStatusCode(), + $response->getHeaders() + ]; } - $returnType = '\onesignal\client\model\ApiKeyTokensListResponse'; + $returnType = '\onesignal\client\model\JourneyListResponse'; if ($returnType === '\SplFileObject') { $content = $response->getBody(); //stream goes to serializer } else { @@ -16792,7 +19578,7 @@ public function viewApiKeysWithHttpInfo($app_id) case 200: $data = ObjectSerializer::deserialize( $e->getResponseBody(), - '\onesignal\client\model\ApiKeyTokensListResponse', + '\onesignal\client\model\JourneyListResponse', $e->getResponseHeaders() ); $e->setResponseObject($data); @@ -16805,6 +19591,22 @@ public function viewApiKeysWithHttpInfo($app_id) ); $e->setResponseObject($data); break; + case 403: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\GenericError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + case 429: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\onesignal\client\model\RateLimitError', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; default: $data = ObjectSerializer::deserialize( $e->getResponseBody(), @@ -16819,18 +19621,20 @@ public function viewApiKeysWithHttpInfo($app_id) } /** - * Operation viewApiKeysAsync + * Operation viewJourneysAsync * - * View API keys + * View journeys * - * @param string $app_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. (optional) + * @param int $limit Maximum journeys to return per page. Minimum 1, maximum 50. (optional, default to 50) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function viewApiKeysAsync($app_id) + public function viewJourneysAsync($app_id, $cursor = null, $limit = 50) { - return $this->viewApiKeysAsyncWithHttpInfo($app_id) + return $this->viewJourneysAsyncWithHttpInfo($app_id, $cursor, $limit) ->then( function ($response) { return $response[0]; @@ -16839,19 +19643,21 @@ function ($response) { } /** - * Operation viewApiKeysAsyncWithHttpInfo + * Operation viewJourneysAsyncWithHttpInfo * - * View API keys + * View journeys * - * @param string $app_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. (optional) + * @param int $limit Maximum journeys to return per page. Minimum 1, maximum 50. (optional, default to 50) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Promise\PromiseInterface */ - public function viewApiKeysAsyncWithHttpInfo($app_id) + public function viewJourneysAsyncWithHttpInfo($app_id, $cursor = null, $limit = 50) { - $returnType = '\onesignal\client\model\ApiKeyTokensListResponse'; - $request = $this->viewApiKeysRequest($app_id); + $returnType = '\onesignal\client\model\JourneyListResponse'; + $request = $this->viewJourneysRequest($app_id, $cursor, $limit); return $this->client ->sendAsync($request, $this->createHttpClientOption()) @@ -16890,29 +19696,56 @@ function ($exception) { } /** - * Create request for operation 'viewApiKeys' + * Create request for operation 'viewJourneys' * - * @param string $app_id (required) + * @param string $app_id Your OneSignal App ID in UUID v4 format. (required) + * @param string $cursor Opaque pagination token from a previous response's next_cursor. Omit for the first page. (optional) + * @param int $limit Maximum journeys to return per page. Minimum 1, maximum 50. (optional, default to 50) * * @throws \InvalidArgumentException * @return \GuzzleHttp\Psr7\Request */ - public function viewApiKeysRequest($app_id) + public function viewJourneysRequest($app_id, $cursor = null, $limit = 50) { // verify the required parameter 'app_id' is set if ($app_id === null || (is_array($app_id) && count($app_id) === 0)) { throw new \InvalidArgumentException( - 'Missing the required parameter $app_id when calling viewApiKeys' + 'Missing the required parameter $app_id when calling viewJourneys' ); } + if ($limit !== null && $limit > 50) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling DefaultApi.viewJourneys, must be smaller than or equal to 50.'); + } + if ($limit !== null && $limit < 1) { + throw new \InvalidArgumentException('invalid value for "$limit" when calling DefaultApi.viewJourneys, must be bigger than or equal to 1.'); + } - $resourcePath = '/apps/{app_id}/auth/tokens'; + + $resourcePath = '/apps/{app_id}/journeys'; $formParams = []; $queryParams = []; $headerParams = []; $httpBody = ''; $multipart = false; + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $cursor, + 'cursor', // param base name + 'string', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $limit, + 'limit', // param base name + 'integer', // openApiType + 'form', // style + true, // explode + false // required + ) ?? []); // path params @@ -16961,8 +19794,8 @@ public function viewApiKeysRequest($app_id) } } - if (!empty($this->config->getOrganizationApiKeyToken())) { - $headers['Authorization'] = 'Key ' . $this->config->getOrganizationApiKeyToken(); + if (!empty($this->config->getRestApiKeyToken())) { + $headers['Authorization'] = 'Key ' . $this->config->getRestApiKeyToken(); } $defaultHeaders = []; @@ -16971,7 +19804,7 @@ public function viewApiKeysRequest($app_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -17331,7 +20164,7 @@ public function viewTemplateRequest($template_id, $app_id) } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, @@ -17714,7 +20547,7 @@ public function viewTemplatesRequest($app_id, $limit = 50, $offset = 0, $channel } // Adding the telemetry header - $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.11.2'; + $defaultHeaders['OS-Usage-Data'] = 'kind=sdk, sdk-name=onesignal-php, version=5.12.0'; $headers = array_merge( $defaultHeaders, diff --git a/lib/model/CreateJourneyRequest.php b/lib/model/CreateJourneyRequest.php new file mode 100644 index 0000000..dd6a092 --- /dev/null +++ b/lib/model/CreateJourneyRequest.php @@ -0,0 +1,506 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreateJourneyRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CreateJourneyRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'audience' => '\onesignal\client\model\JourneyAudience', + 'early_exit' => '\onesignal\client\model\JourneyEarlyExit', + 'reentry_rules' => '\onesignal\client\model\JourneyReentryRules', + 'schedule' => '\onesignal\client\model\JourneySchedule', + 'nodes' => '\onesignal\client\model\JourneyNode[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'audience' => null, + 'early_exit' => null, + 'reentry_rules' => null, + 'schedule' => null, + 'nodes' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'audience' => 'audience', + 'early_exit' => 'early_exit', + 'reentry_rules' => 'reentry_rules', + 'schedule' => 'schedule', + 'nodes' => 'nodes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'audience' => 'setAudience', + 'early_exit' => 'setEarlyExit', + 'reentry_rules' => 'setReentryRules', + 'schedule' => 'setSchedule', + 'nodes' => 'setNodes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'audience' => 'getAudience', + 'early_exit' => 'getEarlyExit', + 'reentry_rules' => 'getReentryRules', + 'schedule' => 'getSchedule', + 'nodes' => 'getNodes' + ]; + + /** + * 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->container['name'] = $data['name'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['audience'] = $data['audience'] ?? null; + $this->container['early_exit'] = $data['early_exit'] ?? null; + $this->container['reentry_rules'] = $data['reentry_rules'] ?? null; + $this->container['schedule'] = $data['schedule'] ?? null; + $this->container['nodes'] = $data['nodes'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Journey name, up to 300 characters. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Optional journey description, up to 1024 characters. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets audience + * + * @return \onesignal\client\model\JourneyAudience|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param \onesignal\client\model\JourneyAudience|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets early_exit + * + * @return \onesignal\client\model\JourneyEarlyExit|null + */ + public function getEarlyExit() + { + return $this->container['early_exit']; + } + + /** + * Sets early_exit + * + * @param \onesignal\client\model\JourneyEarlyExit|null $early_exit early_exit + * + * @return self + */ + public function setEarlyExit($early_exit) + { + $this->container['early_exit'] = $early_exit; + + return $this; + } + + /** + * Gets reentry_rules + * + * @return \onesignal\client\model\JourneyReentryRules|null + */ + public function getReentryRules() + { + return $this->container['reentry_rules']; + } + + /** + * Sets reentry_rules + * + * @param \onesignal\client\model\JourneyReentryRules|null $reentry_rules reentry_rules + * + * @return self + */ + public function setReentryRules($reentry_rules) + { + $this->container['reentry_rules'] = $reentry_rules; + + return $this; + } + + /** + * Gets schedule + * + * @return \onesignal\client\model\JourneySchedule|null + */ + public function getSchedule() + { + return $this->container['schedule']; + } + + /** + * Sets schedule + * + * @param \onesignal\client\model\JourneySchedule|null $schedule schedule + * + * @return self + */ + public function setSchedule($schedule) + { + $this->container['schedule'] = $schedule; + + return $this; + } + + /** + * Gets nodes + * + * @return \onesignal\client\model\JourneyNode[]|null + */ + public function getNodes() + { + return $this->container['nodes']; + } + + /** + * Sets nodes + * + * @param \onesignal\client\model\JourneyNode[]|null $nodes Ordered list of journey nodes. Server-assigned id fields are rejected on create. + * + * @return self + */ + public function setNodes($nodes) + { + $this->container['nodes'] = $nodes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/Journey.php b/lib/model/Journey.php new file mode 100644 index 0000000..e0d65e8 --- /dev/null +++ b/lib/model/Journey.php @@ -0,0 +1,813 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Journey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Journey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'app_id' => 'string', + 'name' => 'string', + 'description' => 'string', + 'state' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string', + 'started_at' => 'string', + 'archived_at' => 'string', + 'created_source' => 'string', + 'audience' => '\onesignal\client\model\JourneyAudience', + 'early_exit' => '\onesignal\client\model\JourneyEarlyExit', + 'reentry_rules' => '\onesignal\client\model\JourneyReentryRules', + 'schedule' => '\onesignal\client\model\JourneySchedule', + 'nodes' => '\onesignal\client\model\JourneyNode[]', + 'concurrency_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'app_id' => null, + 'name' => null, + 'description' => null, + 'state' => null, + 'created_at' => null, + 'updated_at' => null, + 'started_at' => null, + 'archived_at' => null, + 'created_source' => null, + 'audience' => null, + 'early_exit' => null, + 'reentry_rules' => null, + 'schedule' => null, + 'nodes' => null, + 'concurrency_key' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'app_id' => 'app_id', + 'name' => 'name', + 'description' => 'description', + 'state' => 'state', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at', + 'started_at' => 'started_at', + 'archived_at' => 'archived_at', + 'created_source' => 'created_source', + 'audience' => 'audience', + 'early_exit' => 'early_exit', + 'reentry_rules' => 'reentry_rules', + 'schedule' => 'schedule', + 'nodes' => 'nodes', + 'concurrency_key' => 'concurrency_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'app_id' => 'setAppId', + 'name' => 'setName', + 'description' => 'setDescription', + 'state' => 'setState', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'started_at' => 'setStartedAt', + 'archived_at' => 'setArchivedAt', + 'created_source' => 'setCreatedSource', + 'audience' => 'setAudience', + 'early_exit' => 'setEarlyExit', + 'reentry_rules' => 'setReentryRules', + 'schedule' => 'setSchedule', + 'nodes' => 'setNodes', + 'concurrency_key' => 'setConcurrencyKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'app_id' => 'getAppId', + 'name' => 'getName', + 'description' => 'getDescription', + 'state' => 'getState', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'started_at' => 'getStartedAt', + 'archived_at' => 'getArchivedAt', + 'created_source' => 'getCreatedSource', + 'audience' => 'getAudience', + 'early_exit' => 'getEarlyExit', + 'reentry_rules' => 'getReentryRules', + 'schedule' => 'getSchedule', + 'nodes' => 'getNodes', + 'concurrency_key' => 'getConcurrencyKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATE_DRAFT = 'draft'; + public const STATE_SCHEDULED = 'scheduled'; + public const STATE_PROCESSING = 'processing'; + public const STATE_ACTIVE = 'active'; + public const STATE_ARCHIVED = 'archived'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_SCHEDULED, + self::STATE_PROCESSING, + self::STATE_ACTIVE, + self::STATE_ARCHIVED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + $this->container['app_id'] = $data['app_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['state'] = $data['state'] ?? null; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['archived_at'] = $data['archived_at'] ?? null; + $this->container['created_source'] = $data['created_source'] ?? null; + $this->container['audience'] = $data['audience'] ?? null; + $this->container['early_exit'] = $data['early_exit'] ?? null; + $this->container['reentry_rules'] = $data['reentry_rules'] ?? null; + $this->container['schedule'] = $data['schedule'] ?? null; + $this->container['nodes'] = $data['nodes'] ?? null; + $this->container['concurrency_key'] = $data['concurrency_key'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Journey UUID. Read-only. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id UUID of the app the journey belongs to. Read-only. + * + * @return self + */ + public function setAppId($app_id) + { + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Journey name, up to 300 characters. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Journey description, up to 1024 characters. Defaults to an empty string. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. + * + * @return self + */ + public function setState($state) + { + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($state) && !in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at ISO 8601 creation time. Read-only. + * + * @return self + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at ISO 8601 last-update time. Read-only. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets started_at + * + * @return string|null + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param string|null $started_at ISO 8601 time the journey was activated, or null. Read-only. May stay null briefly after you set state to active: activation is enqueued, and started_at populates once the journey finishes processing. + * + * @return self + */ + public function setStartedAt($started_at) + { + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets archived_at + * + * @return string|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param string|null $archived_at ISO 8601 time the journey was archived, or null. Read-only. + * + * @return self + */ + public function setArchivedAt($archived_at) + { + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets created_source + * + * @return string|null + */ + public function getCreatedSource() + { + return $this->container['created_source']; + } + + /** + * Sets created_source + * + * @param string|null $created_source Origin of the journey, for example public_api or dashboard. Read-only. + * + * @return self + */ + public function setCreatedSource($created_source) + { + $this->container['created_source'] = $created_source; + + return $this; + } + + /** + * Gets audience + * + * @return \onesignal\client\model\JourneyAudience|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param \onesignal\client\model\JourneyAudience|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets early_exit + * + * @return \onesignal\client\model\JourneyEarlyExit|null + */ + public function getEarlyExit() + { + return $this->container['early_exit']; + } + + /** + * Sets early_exit + * + * @param \onesignal\client\model\JourneyEarlyExit|null $early_exit early_exit + * + * @return self + */ + public function setEarlyExit($early_exit) + { + $this->container['early_exit'] = $early_exit; + + return $this; + } + + /** + * Gets reentry_rules + * + * @return \onesignal\client\model\JourneyReentryRules|null + */ + public function getReentryRules() + { + return $this->container['reentry_rules']; + } + + /** + * Sets reentry_rules + * + * @param \onesignal\client\model\JourneyReentryRules|null $reentry_rules reentry_rules + * + * @return self + */ + public function setReentryRules($reentry_rules) + { + $this->container['reentry_rules'] = $reentry_rules; + + return $this; + } + + /** + * Gets schedule + * + * @return \onesignal\client\model\JourneySchedule|null + */ + public function getSchedule() + { + return $this->container['schedule']; + } + + /** + * Sets schedule + * + * @param \onesignal\client\model\JourneySchedule|null $schedule schedule + * + * @return self + */ + public function setSchedule($schedule) + { + $this->container['schedule'] = $schedule; + + return $this; + } + + /** + * Gets nodes + * + * @return \onesignal\client\model\JourneyNode[]|null + */ + public function getNodes() + { + return $this->container['nodes']; + } + + /** + * Sets nodes + * + * @param \onesignal\client\model\JourneyNode[]|null $nodes Ordered list of journey nodes. + * + * @return self + */ + public function setNodes($nodes) + { + $this->container['nodes'] = $nodes; + + return $this; + } + + /** + * Gets concurrency_key + * + * @return string|null + */ + public function getConcurrencyKey() + { + return $this->container['concurrency_key']; + } + + /** + * Sets concurrency_key + * + * @param string|null $concurrency_key Opaque optimistic-concurrency token. Read-only. Pass it back on update to guard against overwriting a concurrent change (409). Send it back exactly as read; do not construct or parse it. + * + * @return self + */ + public function setConcurrencyKey($concurrency_key) + { + $this->container['concurrency_key'] = $concurrency_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyAudience.php b/lib/model/JourneyAudience.php new file mode 100644 index 0000000..3284e7b --- /dev/null +++ b/lib/model/JourneyAudience.php @@ -0,0 +1,510 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyAudience implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyAudience'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'kind' => 'string', + 'included_segment_ids' => 'string[]', + 'excluded_segment_ids' => 'string[]', + 'future_additions_only' => 'bool', + 'name' => 'string', + 'attributes' => '\onesignal\client\model\JourneyEventAttribute[][]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'kind' => null, + 'included_segment_ids' => null, + 'excluded_segment_ids' => null, + 'future_additions_only' => null, + 'name' => null, + 'attributes' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind', + 'included_segment_ids' => 'included_segment_ids', + 'excluded_segment_ids' => 'excluded_segment_ids', + 'future_additions_only' => 'future_additions_only', + 'name' => 'name', + 'attributes' => 'attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind', + 'included_segment_ids' => 'setIncludedSegmentIds', + 'excluded_segment_ids' => 'setExcludedSegmentIds', + 'future_additions_only' => 'setFutureAdditionsOnly', + 'name' => 'setName', + 'attributes' => 'setAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind', + 'included_segment_ids' => 'getIncludedSegmentIds', + 'excluded_segment_ids' => 'getExcludedSegmentIds', + 'future_additions_only' => 'getFutureAdditionsOnly', + 'name' => 'getName', + 'attributes' => 'getAttributes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const KIND_SEGMENT = 'segment'; + public const KIND_EVENT_TRIGGER = 'event_trigger'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_SEGMENT, + self::KIND_EVENT_TRIGGER, + ]; + } + + /** + * 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['kind'] = $data['kind'] ?? null; + $this->container['included_segment_ids'] = $data['included_segment_ids'] ?? null; + $this->container['excluded_segment_ids'] = $data['excluded_segment_ids'] ?? null; + $this->container['future_additions_only'] = $data['future_additions_only'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['attributes'] = $data['attributes'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['kind'] === null) { + $invalidProperties[] = "'kind' can't be null"; + } + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], + 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 kind + * + * @return string + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string $kind Audience kind. Selects which other fields apply. + * + * @return self + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + + /** + * Gets included_segment_ids + * + * @return string[]|null + */ + public function getIncludedSegmentIds() + { + return $this->container['included_segment_ids']; + } + + /** + * Sets included_segment_ids + * + * @param string[]|null $included_segment_ids segment audiences: Segment UUIDs whose users enter the journey. + * + * @return self + */ + public function setIncludedSegmentIds($included_segment_ids) + { + $this->container['included_segment_ids'] = $included_segment_ids; + + return $this; + } + + /** + * Gets excluded_segment_ids + * + * @return string[]|null + */ + public function getExcludedSegmentIds() + { + return $this->container['excluded_segment_ids']; + } + + /** + * Sets excluded_segment_ids + * + * @param string[]|null $excluded_segment_ids segment audiences: Segment UUIDs whose users are excluded. + * + * @return self + */ + public function setExcludedSegmentIds($excluded_segment_ids) + { + $this->container['excluded_segment_ids'] = $excluded_segment_ids; + + return $this; + } + + /** + * Gets future_additions_only + * + * @return bool|null + */ + public function getFutureAdditionsOnly() + { + return $this->container['future_additions_only']; + } + + /** + * Sets future_additions_only + * + * @param bool|null $future_additions_only segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. + * + * @return self + */ + public function setFutureAdditionsOnly($future_additions_only) + { + $this->container['future_additions_only'] = $future_additions_only; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name event_trigger audiences: event name that triggers entry, up to 255 characters. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return \onesignal\client\model\JourneyEventAttribute[][]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \onesignal\client\model\JourneyEventAttribute[][]|null $attributes Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. + * + * @return self + */ + public function setAttributes($attributes) + { + $this->container['attributes'] = $attributes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyBranch.php b/lib/model/JourneyBranch.php new file mode 100644 index 0000000..c125eb5 --- /dev/null +++ b/lib/model/JourneyBranch.php @@ -0,0 +1,412 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyBranch implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyBranch'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'condition' => '\onesignal\client\model\JourneyCondition', + 'weight' => 'float', + 'nodes' => '\onesignal\client\model\JourneyNode[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'condition' => null, + 'weight' => null, + 'nodes' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'condition' => 'condition', + 'weight' => 'weight', + 'nodes' => 'nodes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'condition' => 'setCondition', + 'weight' => 'setWeight', + 'nodes' => 'setNodes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'condition' => 'getCondition', + 'weight' => 'getWeight', + 'nodes' => 'getNodes' + ]; + + /** + * 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->container['id'] = $data['id'] ?? null; + $this->container['condition'] = $data['condition'] ?? null; + $this->container['weight'] = $data['weight'] ?? null; + $this->container['nodes'] = $data['nodes'] ?? 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 Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets condition + * + * @return \onesignal\client\model\JourneyCondition|null + */ + public function getCondition() + { + return $this->container['condition']; + } + + /** + * Sets condition + * + * @param \onesignal\client\model\JourneyCondition|null $condition condition + * + * @return self + */ + public function setCondition($condition) + { + $this->container['condition'] = $condition; + + return $this; + } + + /** + * Gets weight + * + * @return float|null + */ + public function getWeight() + { + return $this->container['weight']; + } + + /** + * Sets weight + * + * @param float|null $weight Branch weight for split_range nodes. Weights across a node's branches must sum to 100. + * + * @return self + */ + public function setWeight($weight) + { + $this->container['weight'] = $weight; + + return $this; + } + + /** + * Gets nodes + * + * @return \onesignal\client\model\JourneyNode[]|null + */ + public function getNodes() + { + return $this->container['nodes']; + } + + /** + * Sets nodes + * + * @param \onesignal\client\model\JourneyNode[]|null $nodes Nodes run when this branch is taken, before flow converges to the next sibling node. + * + * @return self + */ + public function setNodes($nodes) + { + $this->container['nodes'] = $nodes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyBranchStats.php b/lib/model/JourneyBranchStats.php new file mode 100644 index 0000000..d69f5da --- /dev/null +++ b/lib/model/JourneyBranchStats.php @@ -0,0 +1,323 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyBranchStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyBranchStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'completed' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'completed' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'completed' => 'completed' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'completed' => 'setCompleted' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'completed' => 'getCompleted' + ]; + + /** + * 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->container['completed'] = $data['completed'] ?? 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 completed + * + * @return int|null + */ + public function getCompleted() + { + return $this->container['completed']; + } + + /** + * Sets completed + * + * @param int|null $completed Users who took this branch. + * + * @return self + */ + public function setCompleted($completed) + { + $this->container['completed'] = $completed; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyCondition.php b/lib/model/JourneyCondition.php new file mode 100644 index 0000000..a6ceb8e --- /dev/null +++ b/lib/model/JourneyCondition.php @@ -0,0 +1,638 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyCondition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyCondition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'kind' => 'string', + 'included_segment_ids' => 'string[]', + 'excluded_segment_ids' => 'string[]', + 'action' => 'string', + 'sending_node_id' => 'string', + 'client_node_id' => 'string', + 'name' => 'string', + 'attributes' => '\onesignal\client\model\JourneyEventAttribute[][]', + 'entry_event_match_attributes' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'kind' => null, + 'included_segment_ids' => null, + 'excluded_segment_ids' => null, + 'action' => null, + 'sending_node_id' => null, + 'client_node_id' => null, + 'name' => null, + 'attributes' => null, + 'entry_event_match_attributes' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind', + 'included_segment_ids' => 'included_segment_ids', + 'excluded_segment_ids' => 'excluded_segment_ids', + 'action' => 'action', + 'sending_node_id' => 'sending_node_id', + 'client_node_id' => 'client_node_id', + 'name' => 'name', + 'attributes' => 'attributes', + 'entry_event_match_attributes' => 'entry_event_match_attributes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind', + 'included_segment_ids' => 'setIncludedSegmentIds', + 'excluded_segment_ids' => 'setExcludedSegmentIds', + 'action' => 'setAction', + 'sending_node_id' => 'setSendingNodeId', + 'client_node_id' => 'setClientNodeId', + 'name' => 'setName', + 'attributes' => 'setAttributes', + 'entry_event_match_attributes' => 'setEntryEventMatchAttributes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind', + 'included_segment_ids' => 'getIncludedSegmentIds', + 'excluded_segment_ids' => 'getExcludedSegmentIds', + 'action' => 'getAction', + 'sending_node_id' => 'getSendingNodeId', + 'client_node_id' => 'getClientNodeId', + 'name' => 'getName', + 'attributes' => 'getAttributes', + 'entry_event_match_attributes' => 'getEntryEventMatchAttributes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const KIND_SEGMENT_MEMBERSHIP = 'segment_membership'; + public const KIND_ON_NOTIFICATION_ACTION = 'on_notification_action'; + public const KIND_EVENT_TRIGGER = 'event_trigger'; + public const ACTION_RECEIVED = 'received'; + public const ACTION_CLICKED = 'clicked'; + public const ACTION_OPENED = 'opened'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_SEGMENT_MEMBERSHIP, + self::KIND_ON_NOTIFICATION_ACTION, + self::KIND_EVENT_TRIGGER, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getActionAllowableValues() + { + return [ + self::ACTION_RECEIVED, + self::ACTION_CLICKED, + self::ACTION_OPENED, + ]; + } + + /** + * 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['kind'] = $data['kind'] ?? null; + $this->container['included_segment_ids'] = $data['included_segment_ids'] ?? null; + $this->container['excluded_segment_ids'] = $data['excluded_segment_ids'] ?? null; + $this->container['action'] = $data['action'] ?? null; + $this->container['sending_node_id'] = $data['sending_node_id'] ?? null; + $this->container['client_node_id'] = $data['client_node_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['attributes'] = $data['attributes'] ?? null; + $this->container['entry_event_match_attributes'] = $data['entry_event_match_attributes'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['kind'] === null) { + $invalidProperties[] = "'kind' can't be null"; + } + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($this->container['action']) && !in_array($this->container['action'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'action', must be one of '%s'", + $this->container['action'], + 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 kind + * + * @return string + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string $kind Condition kind. Selects which other fields apply. + * + * @return self + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + + /** + * Gets included_segment_ids + * + * @return string[]|null + */ + public function getIncludedSegmentIds() + { + return $this->container['included_segment_ids']; + } + + /** + * Sets included_segment_ids + * + * @param string[]|null $included_segment_ids segment_membership conditions: Segment UUIDs the user must belong to. + * + * @return self + */ + public function setIncludedSegmentIds($included_segment_ids) + { + $this->container['included_segment_ids'] = $included_segment_ids; + + return $this; + } + + /** + * Gets excluded_segment_ids + * + * @return string[]|null + */ + public function getExcludedSegmentIds() + { + return $this->container['excluded_segment_ids']; + } + + /** + * Sets excluded_segment_ids + * + * @param string[]|null $excluded_segment_ids segment_membership conditions: Segment UUIDs the user must not belong to. + * + * @return self + */ + public function setExcludedSegmentIds($excluded_segment_ids) + { + $this->container['excluded_segment_ids'] = $excluded_segment_ids; + + return $this; + } + + /** + * Gets action + * + * @return string|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string|null $action on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. + * + * @return self + */ + public function setAction($action) + { + $allowedValues = $this->getActionAllowableValues(); + if (!is_null($action) && !in_array($action, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'action', must be one of '%s'", + $action, + implode("', '", $allowedValues) + ) + ); + } + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets sending_node_id + * + * @return string|null + */ + public function getSendingNodeId() + { + return $this->container['sending_node_id']; + } + + /** + * Sets sending_node_id + * + * @param string|null $sending_node_id on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. + * + * @return self + */ + public function setSendingNodeId($sending_node_id) + { + $this->container['sending_node_id'] = $sending_node_id; + + return $this; + } + + /** + * Gets client_node_id + * + * @return string|null + */ + public function getClientNodeId() + { + return $this->container['client_node_id']; + } + + /** + * Sets client_node_id + * + * @param string|null $client_node_id on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. + * + * @return self + */ + public function setClientNodeId($client_node_id) + { + $this->container['client_node_id'] = $client_node_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name event_trigger conditions: event name, up to 255 characters. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets attributes + * + * @return \onesignal\client\model\JourneyEventAttribute[][]|null + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \onesignal\client\model\JourneyEventAttribute[][]|null $attributes Event attribute matchers, as a list of condition groups. Send a single group whose conditions are AND'd together. More than one group is rejected. + * + * @return self + */ + public function setAttributes($attributes) + { + $this->container['attributes'] = $attributes; + + return $this; + } + + /** + * Gets entry_event_match_attributes + * + * @return object[]|null + */ + public function getEntryEventMatchAttributes() + { + return $this->container['entry_event_match_attributes']; + } + + /** + * Sets entry_event_match_attributes + * + * @param object[]|null $entry_event_match_attributes event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys. + * + * @return self + */ + public function setEntryEventMatchAttributes($entry_event_match_attributes) + { + $this->container['entry_event_match_attributes'] = $entry_event_match_attributes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyEarlyExit.php b/lib/model/JourneyEarlyExit.php new file mode 100644 index 0000000..b420445 --- /dev/null +++ b/lib/model/JourneyEarlyExit.php @@ -0,0 +1,353 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyEarlyExit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyEarlyExit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rules' => '\onesignal\client\model\JourneyEarlyExitRules', + 'tag_on_early_exit' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rules' => null, + 'tag_on_early_exit' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rules' => 'rules', + 'tag_on_early_exit' => 'tag_on_early_exit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rules' => 'setRules', + 'tag_on_early_exit' => 'setTagOnEarlyExit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rules' => 'getRules', + 'tag_on_early_exit' => 'getTagOnEarlyExit' + ]; + + /** + * 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->container['rules'] = $data['rules'] ?? null; + $this->container['tag_on_early_exit'] = $data['tag_on_early_exit'] ?? 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 rules + * + * @return \onesignal\client\model\JourneyEarlyExitRules|null + */ + public function getRules() + { + return $this->container['rules']; + } + + /** + * Sets rules + * + * @param \onesignal\client\model\JourneyEarlyExitRules|null $rules rules + * + * @return self + */ + public function setRules($rules) + { + $this->container['rules'] = $rules; + + return $this; + } + + /** + * Gets tag_on_early_exit + * + * @return array|null + */ + public function getTagOnEarlyExit() + { + return $this->container['tag_on_early_exit']; + } + + /** + * Sets tag_on_early_exit + * + * @param array|null $tag_on_early_exit Tag key-value pairs applied when a user exits early. + * + * @return self + */ + public function setTagOnEarlyExit($tag_on_early_exit) + { + $this->container['tag_on_early_exit'] = $tag_on_early_exit; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyEarlyExitRules.php b/lib/model/JourneyEarlyExitRules.php new file mode 100644 index 0000000..fc219a7 --- /dev/null +++ b/lib/model/JourneyEarlyExitRules.php @@ -0,0 +1,412 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyEarlyExitRules implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyEarlyExit_rules'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'on_segment' => '\onesignal\client\model\JourneyEarlyExitRulesOnSegment', + 'when_not_in_audience' => 'bool', + 'on_session' => 'bool', + 'on_event' => '\onesignal\client\model\JourneyEarlyExitRulesOnEvent' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'on_segment' => null, + 'when_not_in_audience' => null, + 'on_session' => null, + 'on_event' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'on_segment' => 'on_segment', + 'when_not_in_audience' => 'when_not_in_audience', + 'on_session' => 'on_session', + 'on_event' => 'on_event' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'on_segment' => 'setOnSegment', + 'when_not_in_audience' => 'setWhenNotInAudience', + 'on_session' => 'setOnSession', + 'on_event' => 'setOnEvent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'on_segment' => 'getOnSegment', + 'when_not_in_audience' => 'getWhenNotInAudience', + 'on_session' => 'getOnSession', + 'on_event' => 'getOnEvent' + ]; + + /** + * 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->container['on_segment'] = $data['on_segment'] ?? null; + $this->container['when_not_in_audience'] = $data['when_not_in_audience'] ?? null; + $this->container['on_session'] = $data['on_session'] ?? null; + $this->container['on_event'] = $data['on_event'] ?? 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 on_segment + * + * @return \onesignal\client\model\JourneyEarlyExitRulesOnSegment|null + */ + public function getOnSegment() + { + return $this->container['on_segment']; + } + + /** + * Sets on_segment + * + * @param \onesignal\client\model\JourneyEarlyExitRulesOnSegment|null $on_segment on_segment + * + * @return self + */ + public function setOnSegment($on_segment) + { + $this->container['on_segment'] = $on_segment; + + return $this; + } + + /** + * Gets when_not_in_audience + * + * @return bool|null + */ + public function getWhenNotInAudience() + { + return $this->container['when_not_in_audience']; + } + + /** + * Sets when_not_in_audience + * + * @param bool|null $when_not_in_audience Exit when the user no longer matches the journey audience. Defaults to false. + * + * @return self + */ + public function setWhenNotInAudience($when_not_in_audience) + { + $this->container['when_not_in_audience'] = $when_not_in_audience; + + return $this; + } + + /** + * Gets on_session + * + * @return bool|null + */ + public function getOnSession() + { + return $this->container['on_session']; + } + + /** + * Sets on_session + * + * @param bool|null $on_session Exit on a new session start. Defaults to false. + * + * @return self + */ + public function setOnSession($on_session) + { + $this->container['on_session'] = $on_session; + + return $this; + } + + /** + * Gets on_event + * + * @return \onesignal\client\model\JourneyEarlyExitRulesOnEvent|null + */ + public function getOnEvent() + { + return $this->container['on_event']; + } + + /** + * Sets on_event + * + * @param \onesignal\client\model\JourneyEarlyExitRulesOnEvent|null $on_event on_event + * + * @return self + */ + public function setOnEvent($on_event) + { + $this->container['on_event'] = $on_event; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyEarlyExitRulesOnEvent.php b/lib/model/JourneyEarlyExitRulesOnEvent.php new file mode 100644 index 0000000..c3bee02 --- /dev/null +++ b/lib/model/JourneyEarlyExitRulesOnEvent.php @@ -0,0 +1,325 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyEarlyExitRulesOnEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyEarlyExit_rules_on_event'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null + ]; + + /** + * Array of 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['name'] = $data['name'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name Exit when this event occurs. Up to 255 characters. + * + * @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): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyEarlyExitRulesOnSegment.php b/lib/model/JourneyEarlyExitRulesOnSegment.php new file mode 100644 index 0000000..98f0f6e --- /dev/null +++ b/lib/model/JourneyEarlyExitRulesOnSegment.php @@ -0,0 +1,322 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyEarlyExitRulesOnSegment implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyEarlyExit_rules_on_segment'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'included_segment_ids' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'included_segment_ids' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'included_segment_ids' => 'included_segment_ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'included_segment_ids' => 'setIncludedSegmentIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'included_segment_ids' => 'getIncludedSegmentIds' + ]; + + /** + * 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->container['included_segment_ids'] = $data['included_segment_ids'] ?? 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 included_segment_ids + * + * @return string[]|null + */ + public function getIncludedSegmentIds() + { + return $this->container['included_segment_ids']; + } + + /** + * Sets included_segment_ids + * + * @param string[]|null $included_segment_ids Exit when the user enters any of these segments. + * + * @return self + */ + public function setIncludedSegmentIds($included_segment_ids) + { + $this->container['included_segment_ids'] = $included_segment_ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyEventAttribute.php b/lib/model/JourneyEventAttribute.php new file mode 100644 index 0000000..bc2b6db --- /dev/null +++ b/lib/model/JourneyEventAttribute.php @@ -0,0 +1,442 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyEventAttribute implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyEventAttribute'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'operator' => 'string', + 'value' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'operator' => null, + 'value' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'key' => 'key', + 'operator' => 'operator', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'operator' => 'setOperator', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'operator' => 'getOperator', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const OPERATOR_EQUAL = 'equal'; + public const OPERATOR_NOT_EQUAL = 'not_equal'; + public const OPERATOR_LESS = 'less'; + public const OPERATOR_LESS_OR_EQUAL = 'less_or_equal'; + public const OPERATOR_GREATER_OR_EQUAL = 'greater_or_equal'; + public const OPERATOR_GREATER = 'greater'; + public const OPERATOR_IS = 'is'; + public const OPERATOR_IS_NOT = 'is_not'; + public const OPERATOR_EXISTS = 'exists'; + public const OPERATOR_NOT_EXISTS = 'not_exists'; + public const OPERATOR_BEFORE = 'before'; + public const OPERATOR_AFTER = 'after'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperatorAllowableValues() + { + return [ + self::OPERATOR_EQUAL, + self::OPERATOR_NOT_EQUAL, + self::OPERATOR_LESS, + self::OPERATOR_LESS_OR_EQUAL, + self::OPERATOR_GREATER_OR_EQUAL, + self::OPERATOR_GREATER, + self::OPERATOR_IS, + self::OPERATOR_IS_NOT, + self::OPERATOR_EXISTS, + self::OPERATOR_NOT_EXISTS, + self::OPERATOR_BEFORE, + self::OPERATOR_AFTER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['key'] = $data['key'] ?? null; + $this->container['operator'] = $data['operator'] ?? null; + $this->container['value'] = $data['value'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + $allowedValues = $this->getOperatorAllowableValues(); + if (!is_null($this->container['operator']) && !in_array($this->container['operator'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operator', must be one of '%s'", + $this->container['operator'], + 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 key + * + * @return string + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string $key Event attribute key. + * + * @return self + */ + public function setKey($key) + { + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator Comparison operator. + * + * @return self + */ + public function setOperator($operator) + { + $allowedValues = $this->getOperatorAllowableValues(); + if (!in_array($operator, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operator', must be one of '%s'", + $operator, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operator'] = $operator; + + return $this; + } + + /** + * Gets value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value Value to compare against. Not required for exists and not_exists. + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyListAudience.php b/lib/model/JourneyListAudience.php new file mode 100644 index 0000000..31d59a6 --- /dev/null +++ b/lib/model/JourneyListAudience.php @@ -0,0 +1,357 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyListAudience implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyListAudience'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'kind' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'kind' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const KIND_SEGMENT = 'segment'; + public const KIND_EVENT_TRIGGER = 'event_trigger'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_SEGMENT, + self::KIND_EVENT_TRIGGER, + ]; + } + + /** + * 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['kind'] = $data['kind'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], + 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 kind + * + * @return string|null + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string|null $kind Audience kind. + * + * @return self + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($kind) && !in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyListItem.php b/lib/model/JourneyListItem.php new file mode 100644 index 0000000..8fc318f --- /dev/null +++ b/lib/model/JourneyListItem.php @@ -0,0 +1,693 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyListItem implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyListItem'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'app_id' => 'string', + 'name' => 'string', + 'state' => 'string', + 'created_at' => 'string', + 'updated_at' => 'string', + 'started_at' => 'string', + 'archived_at' => 'string', + 'created_source' => 'string', + 'schedule' => '\onesignal\client\model\JourneySchedule', + 'audience' => '\onesignal\client\model\JourneyListAudience', + 'reentry_rules' => '\onesignal\client\model\JourneyReentryRules' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'app_id' => null, + 'name' => null, + 'state' => null, + 'created_at' => null, + 'updated_at' => null, + 'started_at' => null, + 'archived_at' => null, + 'created_source' => null, + 'schedule' => null, + 'audience' => null, + 'reentry_rules' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'app_id' => 'app_id', + 'name' => 'name', + 'state' => 'state', + 'created_at' => 'created_at', + 'updated_at' => 'updated_at', + 'started_at' => 'started_at', + 'archived_at' => 'archived_at', + 'created_source' => 'created_source', + 'schedule' => 'schedule', + 'audience' => 'audience', + 'reentry_rules' => 'reentry_rules' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'app_id' => 'setAppId', + 'name' => 'setName', + 'state' => 'setState', + 'created_at' => 'setCreatedAt', + 'updated_at' => 'setUpdatedAt', + 'started_at' => 'setStartedAt', + 'archived_at' => 'setArchivedAt', + 'created_source' => 'setCreatedSource', + 'schedule' => 'setSchedule', + 'audience' => 'setAudience', + 'reentry_rules' => 'setReentryRules' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'app_id' => 'getAppId', + 'name' => 'getName', + 'state' => 'getState', + 'created_at' => 'getCreatedAt', + 'updated_at' => 'getUpdatedAt', + 'started_at' => 'getStartedAt', + 'archived_at' => 'getArchivedAt', + 'created_source' => 'getCreatedSource', + 'schedule' => 'getSchedule', + 'audience' => 'getAudience', + 'reentry_rules' => 'getReentryRules' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATE_DRAFT = 'draft'; + public const STATE_SCHEDULED = 'scheduled'; + public const STATE_PROCESSING = 'processing'; + public const STATE_ACTIVE = 'active'; + public const STATE_ARCHIVED = 'archived'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_SCHEDULED, + self::STATE_PROCESSING, + self::STATE_ACTIVE, + self::STATE_ARCHIVED, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + $this->container['app_id'] = $data['app_id'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['state'] = $data['state'] ?? null; + $this->container['created_at'] = $data['created_at'] ?? null; + $this->container['updated_at'] = $data['updated_at'] ?? null; + $this->container['started_at'] = $data['started_at'] ?? null; + $this->container['archived_at'] = $data['archived_at'] ?? null; + $this->container['created_source'] = $data['created_source'] ?? null; + $this->container['schedule'] = $data['schedule'] ?? null; + $this->container['audience'] = $data['audience'] ?? null; + $this->container['reentry_rules'] = $data['reentry_rules'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + 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 id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Journey UUID. Read-only. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets app_id + * + * @return string|null + */ + public function getAppId() + { + return $this->container['app_id']; + } + + /** + * Sets app_id + * + * @param string|null $app_id UUID of the app the journey belongs to. Read-only. + * + * @return self + */ + public function setAppId($app_id) + { + $this->container['app_id'] = $app_id; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Journey name, up to 300 characters. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Journey state. New journeys are created as draft. processing is transient while activation is in progress. archived is a journey that has been stopped. Change it through the state field on Update journey. + * + * @return self + */ + public function setState($state) + { + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($state) && !in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets created_at + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['created_at']; + } + + /** + * Sets created_at + * + * @param string|null $created_at ISO 8601 creation time. Read-only. + * + * @return self + */ + public function setCreatedAt($created_at) + { + $this->container['created_at'] = $created_at; + + return $this; + } + + /** + * Gets updated_at + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updated_at']; + } + + /** + * Sets updated_at + * + * @param string|null $updated_at ISO 8601 last-update time. Read-only. + * + * @return self + */ + public function setUpdatedAt($updated_at) + { + $this->container['updated_at'] = $updated_at; + + return $this; + } + + /** + * Gets started_at + * + * @return string|null + */ + public function getStartedAt() + { + return $this->container['started_at']; + } + + /** + * Sets started_at + * + * @param string|null $started_at ISO 8601 time the journey was activated, or null. Read-only. + * + * @return self + */ + public function setStartedAt($started_at) + { + $this->container['started_at'] = $started_at; + + return $this; + } + + /** + * Gets archived_at + * + * @return string|null + */ + public function getArchivedAt() + { + return $this->container['archived_at']; + } + + /** + * Sets archived_at + * + * @param string|null $archived_at ISO 8601 time the journey was archived, or null. Read-only. + * + * @return self + */ + public function setArchivedAt($archived_at) + { + $this->container['archived_at'] = $archived_at; + + return $this; + } + + /** + * Gets created_source + * + * @return string|null + */ + public function getCreatedSource() + { + return $this->container['created_source']; + } + + /** + * Sets created_source + * + * @param string|null $created_source Origin of the journey, for example public_api or dashboard. Read-only. + * + * @return self + */ + public function setCreatedSource($created_source) + { + $this->container['created_source'] = $created_source; + + return $this; + } + + /** + * Gets schedule + * + * @return \onesignal\client\model\JourneySchedule|null + */ + public function getSchedule() + { + return $this->container['schedule']; + } + + /** + * Sets schedule + * + * @param \onesignal\client\model\JourneySchedule|null $schedule schedule + * + * @return self + */ + public function setSchedule($schedule) + { + $this->container['schedule'] = $schedule; + + return $this; + } + + /** + * Gets audience + * + * @return \onesignal\client\model\JourneyListAudience|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param \onesignal\client\model\JourneyListAudience|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets reentry_rules + * + * @return \onesignal\client\model\JourneyReentryRules|null + */ + public function getReentryRules() + { + return $this->container['reentry_rules']; + } + + /** + * Sets reentry_rules + * + * @param \onesignal\client\model\JourneyReentryRules|null $reentry_rules reentry_rules + * + * @return self + */ + public function setReentryRules($reentry_rules) + { + $this->container['reentry_rules'] = $reentry_rules; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyListResponse.php b/lib/model/JourneyListResponse.php new file mode 100644 index 0000000..d85584d --- /dev/null +++ b/lib/model/JourneyListResponse.php @@ -0,0 +1,382 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyListResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyListResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'journeys' => '\onesignal\client\model\JourneyListItem[]', + 'has_more' => 'bool', + 'next_cursor' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'journeys' => null, + 'has_more' => null, + 'next_cursor' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'journeys' => 'journeys', + 'has_more' => 'has_more', + 'next_cursor' => 'next_cursor' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'journeys' => 'setJourneys', + 'has_more' => 'setHasMore', + 'next_cursor' => 'setNextCursor' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'journeys' => 'getJourneys', + 'has_more' => 'getHasMore', + 'next_cursor' => 'getNextCursor' + ]; + + /** + * 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->container['journeys'] = $data['journeys'] ?? null; + $this->container['has_more'] = $data['has_more'] ?? null; + $this->container['next_cursor'] = $data['next_cursor'] ?? 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 journeys + * + * @return \onesignal\client\model\JourneyListItem[]|null + */ + public function getJourneys() + { + return $this->container['journeys']; + } + + /** + * Sets journeys + * + * @param \onesignal\client\model\JourneyListItem[]|null $journeys Journeys ordered by creation time, newest first. + * + * @return self + */ + public function setJourneys($journeys) + { + $this->container['journeys'] = $journeys; + + return $this; + } + + /** + * Gets has_more + * + * @return bool|null + */ + public function getHasMore() + { + return $this->container['has_more']; + } + + /** + * Sets has_more + * + * @param bool|null $has_more true if more journeys exist beyond this page. + * + * @return self + */ + public function setHasMore($has_more) + { + $this->container['has_more'] = $has_more; + + return $this; + } + + /** + * Gets next_cursor + * + * @return string|null + */ + public function getNextCursor() + { + return $this->container['next_cursor']; + } + + /** + * Sets next_cursor + * + * @param string|null $next_cursor Cursor for the next page. Present only when has_more is true. + * + * @return self + */ + public function setNextCursor($next_cursor) + { + $this->container['next_cursor'] = $next_cursor; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyMessageStats.php b/lib/model/JourneyMessageStats.php new file mode 100644 index 0000000..08a0a3c --- /dev/null +++ b/lib/model/JourneyMessageStats.php @@ -0,0 +1,323 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyMessageStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyMessageStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'totals' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'totals' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'totals' => 'totals' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'totals' => 'setTotals' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'totals' => 'getTotals' + ]; + + /** + * 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->container['totals'] = $data['totals'] ?? 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 totals + * + * @return array|null + */ + public function getTotals() + { + return $this->container['totals']; + } + + /** + * Sets totals + * + * @param array|null $totals All-time totals for this node, keyed by channel-specific stat name. + * + * @return self + */ + public function setTotals($totals) + { + $this->container['totals'] = $totals; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyNode.php b/lib/model/JourneyNode.php new file mode 100644 index 0000000..ff09aae --- /dev/null +++ b/lib/model/JourneyNode.php @@ -0,0 +1,917 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyNode implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyNode'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'kind' => 'string', + 'client_node_id' => 'string', + 'annotation' => 'string', + 'duration_seconds' => 'int', + 'relative_to' => 'string', + 'windows' => '\onesignal\client\model\JourneyTimeWindow[]', + 'time_zone' => 'string', + 'use_user_time_zone' => 'bool', + 'template_id' => 'string', + 'iam_id' => 'string', + 'user_ttl_seconds' => 'int', + 'webhook_id' => 'string', + 'assignments' => 'array', + 'randomize_on_entry' => 'bool', + 'branches' => '\onesignal\client\model\JourneyBranch[]', + 'expiration' => '\onesignal\client\model\JourneyWaitUntilExpiration' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'kind' => null, + 'client_node_id' => null, + 'annotation' => null, + 'duration_seconds' => null, + 'relative_to' => null, + 'windows' => null, + 'time_zone' => null, + 'use_user_time_zone' => null, + 'template_id' => null, + 'iam_id' => null, + 'user_ttl_seconds' => null, + 'webhook_id' => null, + 'assignments' => null, + 'randomize_on_entry' => null, + 'branches' => null, + 'expiration' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'kind' => 'kind', + 'client_node_id' => 'client_node_id', + 'annotation' => 'annotation', + 'duration_seconds' => 'duration_seconds', + 'relative_to' => 'relative_to', + 'windows' => 'windows', + 'time_zone' => 'time_zone', + 'use_user_time_zone' => 'use_user_time_zone', + 'template_id' => 'template_id', + 'iam_id' => 'iam_id', + 'user_ttl_seconds' => 'user_ttl_seconds', + 'webhook_id' => 'webhook_id', + 'assignments' => 'assignments', + 'randomize_on_entry' => 'randomize_on_entry', + 'branches' => 'branches', + 'expiration' => 'expiration' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'kind' => 'setKind', + 'client_node_id' => 'setClientNodeId', + 'annotation' => 'setAnnotation', + 'duration_seconds' => 'setDurationSeconds', + 'relative_to' => 'setRelativeTo', + 'windows' => 'setWindows', + 'time_zone' => 'setTimeZone', + 'use_user_time_zone' => 'setUseUserTimeZone', + 'template_id' => 'setTemplateId', + 'iam_id' => 'setIamId', + 'user_ttl_seconds' => 'setUserTtlSeconds', + 'webhook_id' => 'setWebhookId', + 'assignments' => 'setAssignments', + 'randomize_on_entry' => 'setRandomizeOnEntry', + 'branches' => 'setBranches', + 'expiration' => 'setExpiration' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'kind' => 'getKind', + 'client_node_id' => 'getClientNodeId', + 'annotation' => 'getAnnotation', + 'duration_seconds' => 'getDurationSeconds', + 'relative_to' => 'getRelativeTo', + 'windows' => 'getWindows', + 'time_zone' => 'getTimeZone', + 'use_user_time_zone' => 'getUseUserTimeZone', + 'template_id' => 'getTemplateId', + 'iam_id' => 'getIamId', + 'user_ttl_seconds' => 'getUserTtlSeconds', + 'webhook_id' => 'getWebhookId', + 'assignments' => 'getAssignments', + 'randomize_on_entry' => 'getRandomizeOnEntry', + 'branches' => 'getBranches', + 'expiration' => 'getExpiration' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const KIND_WAIT = 'wait'; + public const KIND_TIME_WINDOW = 'time_window'; + public const KIND_SEND_PUSH = 'send_push'; + public const KIND_SEND_EMAIL = 'send_email'; + public const KIND_SEND_SMS = 'send_sms'; + public const KIND_SEND_IAM = 'send_iam'; + public const KIND_SEND_WEBHOOK = 'send_webhook'; + public const KIND_TAG = 'tag'; + public const KIND_SPLIT_RANGE = 'split_range'; + public const KIND_YES_NO = 'yes_no'; + public const KIND_WAIT_UNTIL = 'wait_until'; + public const RELATIVE_TO_SCHEDULE_IN_TIMEZONE = 'schedule_in_timezone'; + public const RELATIVE_TO_LAST_ACTIVE_TIME = 'last_active_time'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_WAIT, + self::KIND_TIME_WINDOW, + self::KIND_SEND_PUSH, + self::KIND_SEND_EMAIL, + self::KIND_SEND_SMS, + self::KIND_SEND_IAM, + self::KIND_SEND_WEBHOOK, + self::KIND_TAG, + self::KIND_SPLIT_RANGE, + self::KIND_YES_NO, + self::KIND_WAIT_UNTIL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelativeToAllowableValues() + { + return [ + self::RELATIVE_TO_SCHEDULE_IN_TIMEZONE, + self::RELATIVE_TO_LAST_ACTIVE_TIME, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['id'] = $data['id'] ?? null; + $this->container['kind'] = $data['kind'] ?? null; + $this->container['client_node_id'] = $data['client_node_id'] ?? null; + $this->container['annotation'] = $data['annotation'] ?? null; + $this->container['duration_seconds'] = $data['duration_seconds'] ?? null; + $this->container['relative_to'] = $data['relative_to'] ?? null; + $this->container['windows'] = $data['windows'] ?? null; + $this->container['time_zone'] = $data['time_zone'] ?? null; + $this->container['use_user_time_zone'] = $data['use_user_time_zone'] ?? null; + $this->container['template_id'] = $data['template_id'] ?? null; + $this->container['iam_id'] = $data['iam_id'] ?? null; + $this->container['user_ttl_seconds'] = $data['user_ttl_seconds'] ?? null; + $this->container['webhook_id'] = $data['webhook_id'] ?? null; + $this->container['assignments'] = $data['assignments'] ?? null; + $this->container['randomize_on_entry'] = $data['randomize_on_entry'] ?? null; + $this->container['branches'] = $data['branches'] ?? null; + $this->container['expiration'] = $data['expiration'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['kind'] === null) { + $invalidProperties[] = "'kind' can't be null"; + } + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] > 31556952)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be smaller than or equal to 31556952."; + } + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] < 60)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be bigger than or equal to 60."; + } + + $allowedValues = $this->getRelativeToAllowableValues(); + if (!is_null($this->container['relative_to']) && !in_array($this->container['relative_to'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relative_to', must be one of '%s'", + $this->container['relative_to'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['user_ttl_seconds']) && ($this->container['user_ttl_seconds'] < 1)) { + $invalidProperties[] = "invalid value for 'user_ttl_seconds', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets kind + * + * @return string + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string $kind Node kind. Selects which other fields apply. + * + * @return self + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + + /** + * Gets client_node_id + * + * @return string|null + */ + public function getClientNodeId() + { + return $this->container['client_node_id']; + } + + /** + * Sets client_node_id + * + * @param string|null $client_node_id Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. + * + * @return self + */ + public function setClientNodeId($client_node_id) + { + $this->container['client_node_id'] = $client_node_id; + + return $this; + } + + /** + * Gets annotation + * + * @return string|null + */ + public function getAnnotation() + { + return $this->container['annotation']; + } + + /** + * Sets annotation + * + * @param string|null $annotation Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + * + * @return self + */ + public function setAnnotation($annotation) + { + $this->container['annotation'] = $annotation; + + return $this; + } + + /** + * Gets duration_seconds + * + * @return int|null + */ + public function getDurationSeconds() + { + return $this->container['duration_seconds']; + } + + /** + * Sets duration_seconds + * + * @param int|null $duration_seconds wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + * + * @return self + */ + public function setDurationSeconds($duration_seconds) + { + + if (!is_null($duration_seconds) && ($duration_seconds > 31556952)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling JourneyNode., must be smaller than or equal to 31556952.'); + } + if (!is_null($duration_seconds) && ($duration_seconds < 60)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling JourneyNode., must be bigger than or equal to 60.'); + } + + $this->container['duration_seconds'] = $duration_seconds; + + return $this; + } + + /** + * Gets relative_to + * + * @return string|null + */ + public function getRelativeTo() + { + return $this->container['relative_to']; + } + + /** + * Sets relative_to + * + * @param string|null $relative_to time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + * + * @return self + */ + public function setRelativeTo($relative_to) + { + $allowedValues = $this->getRelativeToAllowableValues(); + if (!is_null($relative_to) && !in_array($relative_to, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relative_to', must be one of '%s'", + $relative_to, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relative_to'] = $relative_to; + + return $this; + } + + /** + * Gets windows + * + * @return \onesignal\client\model\JourneyTimeWindow[]|null + */ + public function getWindows() + { + return $this->container['windows']; + } + + /** + * Sets windows + * + * @param \onesignal\client\model\JourneyTimeWindow[]|null $windows time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. + * + * @return self + */ + public function setWindows($windows) + { + $this->container['windows'] = $windows; + + return $this; + } + + /** + * Gets time_zone + * + * @return string|null + */ + public function getTimeZone() + { + return $this->container['time_zone']; + } + + /** + * Sets time_zone + * + * @param string|null $time_zone time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + * + * @return self + */ + public function setTimeZone($time_zone) + { + $this->container['time_zone'] = $time_zone; + + return $this; + } + + /** + * Gets use_user_time_zone + * + * @return bool|null + */ + public function getUseUserTimeZone() + { + return $this->container['use_user_time_zone']; + } + + /** + * Sets use_user_time_zone + * + * @param bool|null $use_user_time_zone time_window nodes: when true, uses the user's timezone if available. + * + * @return self + */ + public function setUseUserTimeZone($use_user_time_zone) + { + $this->container['use_user_time_zone'] = $use_user_time_zone; + + return $this; + } + + /** + * Gets template_id + * + * @return string|null + */ + public function getTemplateId() + { + return $this->container['template_id']; + } + + /** + * Sets template_id + * + * @param string|null $template_id send_push, send_email, and send_sms nodes: UUID of the template to send. + * + * @return self + */ + public function setTemplateId($template_id) + { + $this->container['template_id'] = $template_id; + + return $this; + } + + /** + * Gets iam_id + * + * @return string|null + */ + public function getIamId() + { + return $this->container['iam_id']; + } + + /** + * Sets iam_id + * + * @param string|null $iam_id send_iam nodes: UUID of the in-app message to send. + * + * @return self + */ + public function setIamId($iam_id) + { + $this->container['iam_id'] = $iam_id; + + return $this; + } + + /** + * Gets user_ttl_seconds + * + * @return int|null + */ + public function getUserTtlSeconds() + { + return $this->container['user_ttl_seconds']; + } + + /** + * Sets user_ttl_seconds + * + * @param int|null $user_ttl_seconds send_iam nodes: optional time-to-live for the in-app message, in seconds. + * + * @return self + */ + public function setUserTtlSeconds($user_ttl_seconds) + { + + if (!is_null($user_ttl_seconds) && ($user_ttl_seconds < 1)) { + throw new \InvalidArgumentException('invalid value for $user_ttl_seconds when calling JourneyNode., must be bigger than or equal to 1.'); + } + + $this->container['user_ttl_seconds'] = $user_ttl_seconds; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string|null + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string|null $webhook_id send_webhook nodes: UUID of the webhook to send. + * + * @return self + */ + public function setWebhookId($webhook_id) + { + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets assignments + * + * @return array|null + */ + public function getAssignments() + { + return $this->container['assignments']; + } + + /** + * Sets assignments + * + * @param array|null $assignments tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. + * + * @return self + */ + public function setAssignments($assignments) + { + $this->container['assignments'] = $assignments; + + return $this; + } + + /** + * Gets randomize_on_entry + * + * @return bool|null + */ + public function getRandomizeOnEntry() + { + return $this->container['randomize_on_entry']; + } + + /** + * Sets randomize_on_entry + * + * @param bool|null $randomize_on_entry split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + * + * @return self + */ + public function setRandomizeOnEntry($randomize_on_entry) + { + $this->container['randomize_on_entry'] = $randomize_on_entry; + + return $this; + } + + /** + * Gets branches + * + * @return \onesignal\client\model\JourneyBranch[]|null + */ + public function getBranches() + { + return $this->container['branches']; + } + + /** + * Sets branches + * + * @param \onesignal\client\model\JourneyBranch[]|null $branches Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. + * + * @return self + */ + public function setBranches($branches) + { + $this->container['branches'] = $branches; + + return $this; + } + + /** + * Gets expiration + * + * @return \onesignal\client\model\JourneyWaitUntilExpiration|null + */ + public function getExpiration() + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \onesignal\client\model\JourneyWaitUntilExpiration|null $expiration expiration + * + * @return self + */ + public function setExpiration($expiration) + { + $this->container['expiration'] = $expiration; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyNodeStats.php b/lib/model/JourneyNodeStats.php new file mode 100644 index 0000000..a3a9142 --- /dev/null +++ b/lib/model/JourneyNodeStats.php @@ -0,0 +1,495 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyNodeStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyNodeStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'kind' => 'string', + 'waiting' => 'int', + 'completed' => 'int', + 'exited_early' => 'int', + 'message_stats' => '\onesignal\client\model\JourneyMessageStats' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'kind' => null, + 'waiting' => null, + 'completed' => null, + 'exited_early' => null, + 'message_stats' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'kind' => 'kind', + 'waiting' => 'waiting', + 'completed' => 'completed', + 'exited_early' => 'exited_early', + 'message_stats' => 'message_stats' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'kind' => 'setKind', + 'waiting' => 'setWaiting', + 'completed' => 'setCompleted', + 'exited_early' => 'setExitedEarly', + 'message_stats' => 'setMessageStats' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'kind' => 'getKind', + 'waiting' => 'getWaiting', + 'completed' => 'getCompleted', + 'exited_early' => 'getExitedEarly', + 'message_stats' => 'getMessageStats' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const KIND_WAIT = 'wait'; + public const KIND_TIME_WINDOW = 'time_window'; + public const KIND_SEND_PUSH = 'send_push'; + public const KIND_SEND_EMAIL = 'send_email'; + public const KIND_SEND_SMS = 'send_sms'; + public const KIND_SEND_IAM = 'send_iam'; + public const KIND_SEND_WEBHOOK = 'send_webhook'; + public const KIND_TAG = 'tag'; + public const KIND_SPLIT_RANGE = 'split_range'; + public const KIND_YES_NO = 'yes_no'; + public const KIND_WAIT_UNTIL = 'wait_until'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getKindAllowableValues() + { + return [ + self::KIND_WAIT, + self::KIND_TIME_WINDOW, + self::KIND_SEND_PUSH, + self::KIND_SEND_EMAIL, + self::KIND_SEND_SMS, + self::KIND_SEND_IAM, + self::KIND_SEND_WEBHOOK, + self::KIND_TAG, + self::KIND_SPLIT_RANGE, + self::KIND_YES_NO, + self::KIND_WAIT_UNTIL, + ]; + } + + /** + * 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['kind'] = $data['kind'] ?? null; + $this->container['waiting'] = $data['waiting'] ?? null; + $this->container['completed'] = $data['completed'] ?? null; + $this->container['exited_early'] = $data['exited_early'] ?? null; + $this->container['message_stats'] = $data['message_stats'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($this->container['kind']) && !in_array($this->container['kind'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'kind', must be one of '%s'", + $this->container['kind'], + 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 kind + * + * @return string|null + */ + public function getKind() + { + return $this->container['kind']; + } + + /** + * Sets kind + * + * @param string|null $kind Node kind, repeated here so stats can be read without joining against the journey definition. + * + * @return self + */ + public function setKind($kind) + { + $allowedValues = $this->getKindAllowableValues(); + if (!is_null($kind) && !in_array($kind, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'kind', must be one of '%s'", + $kind, + implode("', '", $allowedValues) + ) + ); + } + $this->container['kind'] = $kind; + + return $this; + } + + /** + * Gets waiting + * + * @return int|null + */ + public function getWaiting() + { + return $this->container['waiting']; + } + + /** + * Sets waiting + * + * @param int|null $waiting Users currently held at this node. + * + * @return self + */ + public function setWaiting($waiting) + { + $this->container['waiting'] = $waiting; + + return $this; + } + + /** + * Gets completed + * + * @return int|null + */ + public function getCompleted() + { + return $this->container['completed']; + } + + /** + * Sets completed + * + * @param int|null $completed Users who advanced past this node normally. + * + * @return self + */ + public function setCompleted($completed) + { + $this->container['completed'] = $completed; + + return $this; + } + + /** + * Gets exited_early + * + * @return int|null + */ + public function getExitedEarly() + { + return $this->container['exited_early']; + } + + /** + * Sets exited_early + * + * @param int|null $exited_early Users who left the journey from this node through an early exit rule. + * + * @return self + */ + public function setExitedEarly($exited_early) + { + $this->container['exited_early'] = $exited_early; + + return $this; + } + + /** + * Gets message_stats + * + * @return \onesignal\client\model\JourneyMessageStats|null + */ + public function getMessageStats() + { + return $this->container['message_stats']; + } + + /** + * Sets message_stats + * + * @param \onesignal\client\model\JourneyMessageStats|null $message_stats message_stats + * + * @return self + */ + public function setMessageStats($message_stats) + { + $this->container['message_stats'] = $message_stats; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyReentryRules.php b/lib/model/JourneyReentryRules.php new file mode 100644 index 0000000..1dbdd85 --- /dev/null +++ b/lib/model/JourneyReentryRules.php @@ -0,0 +1,332 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyReentryRules implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyReentryRules'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration_seconds' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration_seconds' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration_seconds' => 'duration_seconds' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration_seconds' => 'setDurationSeconds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration_seconds' => 'getDurationSeconds' + ]; + + /** + * 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->container['duration_seconds'] = $data['duration_seconds'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] < 600)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be bigger than or equal to 600."; + } + + 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 duration_seconds + * + * @return int|null + */ + public function getDurationSeconds() + { + return $this->container['duration_seconds']; + } + + /** + * Sets duration_seconds + * + * @param int|null $duration_seconds Minimum seconds before a user can re-enter. Must be at least 600 (10 minutes). + * + * @return self + */ + public function setDurationSeconds($duration_seconds) + { + + if (!is_null($duration_seconds) && ($duration_seconds < 600)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling JourneyReentryRules., must be bigger than or equal to 600.'); + } + + $this->container['duration_seconds'] = $duration_seconds; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneySchedule.php b/lib/model/JourneySchedule.php new file mode 100644 index 0000000..51ed77e --- /dev/null +++ b/lib/model/JourneySchedule.php @@ -0,0 +1,383 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneySchedule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneySchedule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start_at' => 'string', + 'stop_at' => 'string', + 'error' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start_at' => null, + 'stop_at' => null, + 'error' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start_at' => 'start_at', + 'stop_at' => 'stop_at', + 'error' => 'error' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start_at' => 'setStartAt', + 'stop_at' => 'setStopAt', + 'error' => 'setError' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start_at' => 'getStartAt', + 'stop_at' => 'getStopAt', + 'error' => 'getError' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(?array $data = null) + { + $this->container['start_at'] = $data['start_at'] ?? null; + $this->container['stop_at'] = $data['stop_at'] ?? null; + $this->container['error'] = $data['error'] ?? 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 start_at + * + * @return string|null + */ + public function getStartAt() + { + return $this->container['start_at']; + } + + /** + * Sets start_at + * + * @param string|null $start_at ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. + * + * @return self + */ + public function setStartAt($start_at) + { + $this->container['start_at'] = $start_at; + + return $this; + } + + /** + * Gets stop_at + * + * @return string|null + */ + public function getStopAt() + { + return $this->container['stop_at']; + } + + /** + * Sets stop_at + * + * @param string|null $stop_at ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. + * + * @return self + */ + public function setStopAt($stop_at) + { + $this->container['stop_at'] = $stop_at; + + return $this; + } + + /** + * Gets error + * + * @return string|null + */ + public function getError() + { + return $this->container['error']; + } + + /** + * Sets error + * + * @param string|null $error Read-only. Present when a scheduling error occurred. + * + * @return self + */ + public function setError($error) + { + $this->container['error'] = $error; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyStats.php b/lib/model/JourneyStats.php new file mode 100644 index 0000000..472bb34 --- /dev/null +++ b/lib/model/JourneyStats.php @@ -0,0 +1,473 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyStats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'string', + 'started' => 'int', + 'completed' => 'int', + 'exited_early' => 'int', + 'nodes' => 'array', + 'branches' => 'array' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => null, + 'started' => null, + 'completed' => null, + 'exited_early' => null, + 'nodes' => null, + 'branches' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'started' => 'started', + 'completed' => 'completed', + 'exited_early' => 'exited_early', + 'nodes' => 'nodes', + 'branches' => 'branches' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'started' => 'setStarted', + 'completed' => 'setCompleted', + 'exited_early' => 'setExitedEarly', + 'nodes' => 'setNodes', + 'branches' => 'setBranches' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'started' => 'getStarted', + 'completed' => 'getCompleted', + 'exited_early' => 'getExitedEarly', + 'nodes' => 'getNodes', + 'branches' => 'getBranches' + ]; + + /** + * 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->container['id'] = $data['id'] ?? null; + $this->container['started'] = $data['started'] ?? null; + $this->container['completed'] = $data['completed'] ?? null; + $this->container['exited_early'] = $data['exited_early'] ?? null; + $this->container['nodes'] = $data['nodes'] ?? null; + $this->container['branches'] = $data['branches'] ?? 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 UUID of the journey these stats belong to. + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets started + * + * @return int|null + */ + public function getStarted() + { + return $this->container['started']; + } + + /** + * Sets started + * + * @param int|null $started Users who entered the journey. + * + * @return self + */ + public function setStarted($started) + { + $this->container['started'] = $started; + + return $this; + } + + /** + * Gets completed + * + * @return int|null + */ + public function getCompleted() + { + return $this->container['completed']; + } + + /** + * Sets completed + * + * @param int|null $completed Users who reached the end of the journey normally. + * + * @return self + */ + public function setCompleted($completed) + { + $this->container['completed'] = $completed; + + return $this; + } + + /** + * Gets exited_early + * + * @return int|null + */ + public function getExitedEarly() + { + return $this->container['exited_early']; + } + + /** + * Sets exited_early + * + * @param int|null $exited_early Users who left the journey through an early exit rule. + * + * @return self + */ + public function setExitedEarly($exited_early) + { + $this->container['exited_early'] = $exited_early; + + return $this; + } + + /** + * Gets nodes + * + * @return array|null + */ + public function getNodes() + { + return $this->container['nodes']; + } + + /** + * Sets nodes + * + * @param array|null $nodes Node stats keyed by node id. Includes every node in the graph, at any nesting depth. + * + * @return self + */ + public function setNodes($nodes) + { + $this->container['nodes'] = $nodes; + + return $this; + } + + /** + * Gets branches + * + * @return array|null + */ + public function getBranches() + { + return $this->container['branches']; + } + + /** + * Sets branches + * + * @param array|null $branches Branch stats keyed by branch id. Empty for a journey with no branching nodes. + * + * @return self + */ + public function setBranches($branches) + { + $this->container['branches'] = $branches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyTimePoint.php b/lib/model/JourneyTimePoint.php new file mode 100644 index 0000000..0dc2b2d --- /dev/null +++ b/lib/model/JourneyTimePoint.php @@ -0,0 +1,384 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyTimePoint implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyTimePoint'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hour' => 'int', + 'minute' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hour' => null, + 'minute' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hour' => 'hour', + 'minute' => 'minute' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hour' => 'setHour', + 'minute' => 'setMinute' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hour' => 'getHour', + 'minute' => 'getMinute' + ]; + + /** + * 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->container['hour'] = $data['hour'] ?? null; + $this->container['minute'] = $data['minute'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['hour']) && ($this->container['hour'] > 23)) { + $invalidProperties[] = "invalid value for 'hour', must be smaller than or equal to 23."; + } + + if (!is_null($this->container['hour']) && ($this->container['hour'] < 0)) { + $invalidProperties[] = "invalid value for 'hour', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minute']) && ($this->container['minute'] > 59)) { + $invalidProperties[] = "invalid value for 'minute', must be smaller than or equal to 59."; + } + + if (!is_null($this->container['minute']) && ($this->container['minute'] < 0)) { + $invalidProperties[] = "invalid value for 'minute', must be bigger than or equal to 0."; + } + + 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 hour + * + * @return int|null + */ + public function getHour() + { + return $this->container['hour']; + } + + /** + * Sets hour + * + * @param int|null $hour Hour of day, 0-23. + * + * @return self + */ + public function setHour($hour) + { + + if (!is_null($hour) && ($hour > 23)) { + throw new \InvalidArgumentException('invalid value for $hour when calling JourneyTimePoint., must be smaller than or equal to 23.'); + } + if (!is_null($hour) && ($hour < 0)) { + throw new \InvalidArgumentException('invalid value for $hour when calling JourneyTimePoint., must be bigger than or equal to 0.'); + } + + $this->container['hour'] = $hour; + + return $this; + } + + /** + * Gets minute + * + * @return int|null + */ + public function getMinute() + { + return $this->container['minute']; + } + + /** + * Sets minute + * + * @param int|null $minute Minute of hour, 0-59. Defaults to 0. + * + * @return self + */ + public function setMinute($minute) + { + + if (!is_null($minute) && ($minute > 59)) { + throw new \InvalidArgumentException('invalid value for $minute when calling JourneyTimePoint., must be smaller than or equal to 59.'); + } + if (!is_null($minute) && ($minute < 0)) { + throw new \InvalidArgumentException('invalid value for $minute when calling JourneyTimePoint., must be bigger than or equal to 0.'); + } + + $this->container['minute'] = $minute; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyTimeWindow.php b/lib/model/JourneyTimeWindow.php new file mode 100644 index 0000000..179f668 --- /dev/null +++ b/lib/model/JourneyTimeWindow.php @@ -0,0 +1,399 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyTimeWindow implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyTimeWindow'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'start' => 'JourneyTimePoint', + 'end' => 'JourneyTimePoint', + 'day_of_week' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'start' => null, + 'end' => null, + 'day_of_week' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'start' => 'start', + 'end' => 'end', + 'day_of_week' => 'day_of_week' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'start' => 'setStart', + 'end' => 'setEnd', + 'day_of_week' => 'setDayOfWeek' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'start' => 'getStart', + 'end' => 'getEnd', + 'day_of_week' => 'getDayOfWeek' + ]; + + /** + * 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->container['start'] = $data['start'] ?? null; + $this->container['end'] = $data['end'] ?? null; + $this->container['day_of_week'] = $data['day_of_week'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['day_of_week']) && ($this->container['day_of_week'] > 7)) { + $invalidProperties[] = "invalid value for 'day_of_week', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['day_of_week']) && ($this->container['day_of_week'] < 1)) { + $invalidProperties[] = "invalid value for 'day_of_week', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets start + * + * @return JourneyTimePoint|null + */ + public function getStart() + { + return $this->container['start']; + } + + /** + * Sets start + * + * @param JourneyTimePoint|null $start When the window opens. + * + * @return self + */ + public function setStart($start) + { + $this->container['start'] = $start; + + return $this; + } + + /** + * Gets end + * + * @return JourneyTimePoint|null + */ + public function getEnd() + { + return $this->container['end']; + } + + /** + * Sets end + * + * @param JourneyTimePoint|null $end When the window closes. + * + * @return self + */ + public function setEnd($end) + { + $this->container['end'] = $end; + + return $this; + } + + /** + * Gets day_of_week + * + * @return int|null + */ + public function getDayOfWeek() + { + return $this->container['day_of_week']; + } + + /** + * Sets day_of_week + * + * @param int|null $day_of_week Day of week, 1 = Monday. Omit to apply the window to every day. + * + * @return self + */ + public function setDayOfWeek($day_of_week) + { + + if (!is_null($day_of_week) && ($day_of_week > 7)) { + throw new \InvalidArgumentException('invalid value for $day_of_week when calling JourneyTimeWindow., must be smaller than or equal to 7.'); + } + if (!is_null($day_of_week) && ($day_of_week < 1)) { + throw new \InvalidArgumentException('invalid value for $day_of_week when calling JourneyTimeWindow., must be bigger than or equal to 1.'); + } + + $this->container['day_of_week'] = $day_of_week; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/JourneyWaitUntilExpiration.php b/lib/model/JourneyWaitUntilExpiration.php new file mode 100644 index 0000000..709e4df --- /dev/null +++ b/lib/model/JourneyWaitUntilExpiration.php @@ -0,0 +1,369 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class JourneyWaitUntilExpiration implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'JourneyWaitUntilExpiration'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'duration_seconds' => 'int', + 'exits' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'duration_seconds' => null, + 'exits' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'duration_seconds' => 'duration_seconds', + 'exits' => 'exits' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'duration_seconds' => 'setDurationSeconds', + 'exits' => 'setExits' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'duration_seconds' => 'getDurationSeconds', + 'exits' => 'getExits' + ]; + + /** + * 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->container['duration_seconds'] = $data['duration_seconds'] ?? null; + $this->container['exits'] = $data['exits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] > 31556952)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be smaller than or equal to 31556952."; + } + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] < 60)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be bigger than or equal to 60."; + } + + 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 duration_seconds + * + * @return int|null + */ + public function getDurationSeconds() + { + return $this->container['duration_seconds']; + } + + /** + * Sets duration_seconds + * + * @param int|null $duration_seconds Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). + * + * @return self + */ + public function setDurationSeconds($duration_seconds) + { + + if (!is_null($duration_seconds) && ($duration_seconds > 31556952)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling JourneyWaitUntilExpiration., must be smaller than or equal to 31556952.'); + } + if (!is_null($duration_seconds) && ($duration_seconds < 60)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling JourneyWaitUntilExpiration., must be bigger than or equal to 60.'); + } + + $this->container['duration_seconds'] = $duration_seconds; + + return $this; + } + + /** + * Gets exits + * + * @return bool|null + */ + public function getExits() + { + return $this->container['exits']; + } + + /** + * Sets exits + * + * @param bool|null $exits When true, the user exits the journey when the timer fires; when false, the user continues to convergence. + * + * @return self + */ + public function setExits($exits) + { + $this->container['exits'] = $exits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/UpdateJourneyNodeRequest.php b/lib/model/UpdateJourneyNodeRequest.php new file mode 100644 index 0000000..1cae1ab --- /dev/null +++ b/lib/model/UpdateJourneyNodeRequest.php @@ -0,0 +1,832 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateJourneyNodeRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateJourneyNodeRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'client_node_id' => 'string', + 'annotation' => 'string', + 'duration_seconds' => 'int', + 'relative_to' => 'string', + 'windows' => '\onesignal\client\model\JourneyTimeWindow[]', + 'time_zone' => 'string', + 'use_user_time_zone' => 'bool', + 'template_id' => 'string', + 'iam_id' => 'string', + 'user_ttl_seconds' => 'int', + 'webhook_id' => 'string', + 'assignments' => 'array', + 'randomize_on_entry' => 'bool', + 'branches' => '\onesignal\client\model\JourneyBranch[]', + 'expiration' => '\onesignal\client\model\JourneyWaitUntilExpiration', + 'concurrency_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'client_node_id' => null, + 'annotation' => null, + 'duration_seconds' => null, + 'relative_to' => null, + 'windows' => null, + 'time_zone' => null, + 'use_user_time_zone' => null, + 'template_id' => null, + 'iam_id' => null, + 'user_ttl_seconds' => null, + 'webhook_id' => null, + 'assignments' => null, + 'randomize_on_entry' => null, + 'branches' => null, + 'expiration' => null, + 'concurrency_key' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'client_node_id' => 'client_node_id', + 'annotation' => 'annotation', + 'duration_seconds' => 'duration_seconds', + 'relative_to' => 'relative_to', + 'windows' => 'windows', + 'time_zone' => 'time_zone', + 'use_user_time_zone' => 'use_user_time_zone', + 'template_id' => 'template_id', + 'iam_id' => 'iam_id', + 'user_ttl_seconds' => 'user_ttl_seconds', + 'webhook_id' => 'webhook_id', + 'assignments' => 'assignments', + 'randomize_on_entry' => 'randomize_on_entry', + 'branches' => 'branches', + 'expiration' => 'expiration', + 'concurrency_key' => 'concurrency_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'client_node_id' => 'setClientNodeId', + 'annotation' => 'setAnnotation', + 'duration_seconds' => 'setDurationSeconds', + 'relative_to' => 'setRelativeTo', + 'windows' => 'setWindows', + 'time_zone' => 'setTimeZone', + 'use_user_time_zone' => 'setUseUserTimeZone', + 'template_id' => 'setTemplateId', + 'iam_id' => 'setIamId', + 'user_ttl_seconds' => 'setUserTtlSeconds', + 'webhook_id' => 'setWebhookId', + 'assignments' => 'setAssignments', + 'randomize_on_entry' => 'setRandomizeOnEntry', + 'branches' => 'setBranches', + 'expiration' => 'setExpiration', + 'concurrency_key' => 'setConcurrencyKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'client_node_id' => 'getClientNodeId', + 'annotation' => 'getAnnotation', + 'duration_seconds' => 'getDurationSeconds', + 'relative_to' => 'getRelativeTo', + 'windows' => 'getWindows', + 'time_zone' => 'getTimeZone', + 'use_user_time_zone' => 'getUseUserTimeZone', + 'template_id' => 'getTemplateId', + 'iam_id' => 'getIamId', + 'user_ttl_seconds' => 'getUserTtlSeconds', + 'webhook_id' => 'getWebhookId', + 'assignments' => 'getAssignments', + 'randomize_on_entry' => 'getRandomizeOnEntry', + 'branches' => 'getBranches', + 'expiration' => 'getExpiration', + 'concurrency_key' => 'getConcurrencyKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const RELATIVE_TO_SCHEDULE_IN_TIMEZONE = 'schedule_in_timezone'; + public const RELATIVE_TO_LAST_ACTIVE_TIME = 'last_active_time'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRelativeToAllowableValues() + { + return [ + self::RELATIVE_TO_SCHEDULE_IN_TIMEZONE, + self::RELATIVE_TO_LAST_ACTIVE_TIME, + ]; + } + + /** + * 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['client_node_id'] = $data['client_node_id'] ?? null; + $this->container['annotation'] = $data['annotation'] ?? null; + $this->container['duration_seconds'] = $data['duration_seconds'] ?? null; + $this->container['relative_to'] = $data['relative_to'] ?? null; + $this->container['windows'] = $data['windows'] ?? null; + $this->container['time_zone'] = $data['time_zone'] ?? null; + $this->container['use_user_time_zone'] = $data['use_user_time_zone'] ?? null; + $this->container['template_id'] = $data['template_id'] ?? null; + $this->container['iam_id'] = $data['iam_id'] ?? null; + $this->container['user_ttl_seconds'] = $data['user_ttl_seconds'] ?? null; + $this->container['webhook_id'] = $data['webhook_id'] ?? null; + $this->container['assignments'] = $data['assignments'] ?? null; + $this->container['randomize_on_entry'] = $data['randomize_on_entry'] ?? null; + $this->container['branches'] = $data['branches'] ?? null; + $this->container['expiration'] = $data['expiration'] ?? null; + $this->container['concurrency_key'] = $data['concurrency_key'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] > 31556952)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be smaller than or equal to 31556952."; + } + + if (!is_null($this->container['duration_seconds']) && ($this->container['duration_seconds'] < 60)) { + $invalidProperties[] = "invalid value for 'duration_seconds', must be bigger than or equal to 60."; + } + + $allowedValues = $this->getRelativeToAllowableValues(); + if (!is_null($this->container['relative_to']) && !in_array($this->container['relative_to'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'relative_to', must be one of '%s'", + $this->container['relative_to'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['user_ttl_seconds']) && ($this->container['user_ttl_seconds'] < 1)) { + $invalidProperties[] = "invalid value for 'user_ttl_seconds', must be bigger than or equal to 1."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets client_node_id + * + * @return string|null + */ + public function getClientNodeId() + { + return $this->container['client_node_id']; + } + + /** + * Sets client_node_id + * + * @param string|null $client_node_id Optional client-assigned identifier, unique within the journey. Use it to reference this node from elsewhere in the same request. Persisted and returned on reads. + * + * @return self + */ + public function setClientNodeId($client_node_id) + { + $this->container['client_node_id'] = $client_node_id; + + return $this; + } + + /** + * Gets annotation + * + * @return string|null + */ + public function getAnnotation() + { + return $this->container['annotation']; + } + + /** + * Sets annotation + * + * @param string|null $annotation Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + * + * @return self + */ + public function setAnnotation($annotation) + { + $this->container['annotation'] = $annotation; + + return $this; + } + + /** + * Gets duration_seconds + * + * @return int|null + */ + public function getDurationSeconds() + { + return $this->container['duration_seconds']; + } + + /** + * Sets duration_seconds + * + * @param int|null $duration_seconds wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + * + * @return self + */ + public function setDurationSeconds($duration_seconds) + { + + if (!is_null($duration_seconds) && ($duration_seconds > 31556952)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling UpdateJourneyNodeRequest., must be smaller than or equal to 31556952.'); + } + if (!is_null($duration_seconds) && ($duration_seconds < 60)) { + throw new \InvalidArgumentException('invalid value for $duration_seconds when calling UpdateJourneyNodeRequest., must be bigger than or equal to 60.'); + } + + $this->container['duration_seconds'] = $duration_seconds; + + return $this; + } + + /** + * Gets relative_to + * + * @return string|null + */ + public function getRelativeTo() + { + return $this->container['relative_to']; + } + + /** + * Sets relative_to + * + * @param string|null $relative_to time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + * + * @return self + */ + public function setRelativeTo($relative_to) + { + $allowedValues = $this->getRelativeToAllowableValues(); + if (!is_null($relative_to) && !in_array($relative_to, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'relative_to', must be one of '%s'", + $relative_to, + implode("', '", $allowedValues) + ) + ); + } + $this->container['relative_to'] = $relative_to; + + return $this; + } + + /** + * Gets windows + * + * @return \onesignal\client\model\JourneyTimeWindow[]|null + */ + public function getWindows() + { + return $this->container['windows']; + } + + /** + * Sets windows + * + * @param \onesignal\client\model\JourneyTimeWindow[]|null $windows time_window nodes: one or more time windows. A window with no day_of_week applies to every day. Required when relative_to is schedule_in_timezone; omit when it is last_active_time. + * + * @return self + */ + public function setWindows($windows) + { + $this->container['windows'] = $windows; + + return $this; + } + + /** + * Gets time_zone + * + * @return string|null + */ + public function getTimeZone() + { + return $this->container['time_zone']; + } + + /** + * Sets time_zone + * + * @param string|null $time_zone time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + * + * @return self + */ + public function setTimeZone($time_zone) + { + $this->container['time_zone'] = $time_zone; + + return $this; + } + + /** + * Gets use_user_time_zone + * + * @return bool|null + */ + public function getUseUserTimeZone() + { + return $this->container['use_user_time_zone']; + } + + /** + * Sets use_user_time_zone + * + * @param bool|null $use_user_time_zone time_window nodes: when true, uses the user's timezone if available. + * + * @return self + */ + public function setUseUserTimeZone($use_user_time_zone) + { + $this->container['use_user_time_zone'] = $use_user_time_zone; + + return $this; + } + + /** + * Gets template_id + * + * @return string|null + */ + public function getTemplateId() + { + return $this->container['template_id']; + } + + /** + * Sets template_id + * + * @param string|null $template_id send_push, send_email, and send_sms nodes: UUID of the template to send. + * + * @return self + */ + public function setTemplateId($template_id) + { + $this->container['template_id'] = $template_id; + + return $this; + } + + /** + * Gets iam_id + * + * @return string|null + */ + public function getIamId() + { + return $this->container['iam_id']; + } + + /** + * Sets iam_id + * + * @param string|null $iam_id send_iam nodes: UUID of the in-app message to send. + * + * @return self + */ + public function setIamId($iam_id) + { + $this->container['iam_id'] = $iam_id; + + return $this; + } + + /** + * Gets user_ttl_seconds + * + * @return int|null + */ + public function getUserTtlSeconds() + { + return $this->container['user_ttl_seconds']; + } + + /** + * Sets user_ttl_seconds + * + * @param int|null $user_ttl_seconds send_iam nodes: optional time-to-live for the in-app message, in seconds. + * + * @return self + */ + public function setUserTtlSeconds($user_ttl_seconds) + { + + if (!is_null($user_ttl_seconds) && ($user_ttl_seconds < 1)) { + throw new \InvalidArgumentException('invalid value for $user_ttl_seconds when calling UpdateJourneyNodeRequest., must be bigger than or equal to 1.'); + } + + $this->container['user_ttl_seconds'] = $user_ttl_seconds; + + return $this; + } + + /** + * Gets webhook_id + * + * @return string|null + */ + public function getWebhookId() + { + return $this->container['webhook_id']; + } + + /** + * Sets webhook_id + * + * @param string|null $webhook_id send_webhook nodes: UUID of the webhook to send. + * + * @return self + */ + public function setWebhookId($webhook_id) + { + $this->container['webhook_id'] = $webhook_id; + + return $this; + } + + /** + * Gets assignments + * + * @return array|null + */ + public function getAssignments() + { + return $this->container['assignments']; + } + + /** + * Sets assignments + * + * @param array|null $assignments tag nodes: tag key-value pairs to assign. An empty string value removes the tag. Keys are limited to 255 characters and values to 1024. + * + * @return self + */ + public function setAssignments($assignments) + { + $this->container['assignments'] = $assignments; + + return $this; + } + + /** + * Gets randomize_on_entry + * + * @return bool|null + */ + public function getRandomizeOnEntry() + { + return $this->container['randomize_on_entry']; + } + + /** + * Sets randomize_on_entry + * + * @param bool|null $randomize_on_entry split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + * + * @return self + */ + public function setRandomizeOnEntry($randomize_on_entry) + { + $this->container['randomize_on_entry'] = $randomize_on_entry; + + return $this; + } + + /** + * Gets branches + * + * @return \onesignal\client\model\JourneyBranch[]|null + */ + public function getBranches() + { + return $this->container['branches']; + } + + /** + * Sets branches + * + * @param \onesignal\client\model\JourneyBranch[]|null $branches Branching nodes: nested branches. split_range requires 2-20 weighted branches that sum to 100. yes_no requires exactly 2 branches. wait_until requires 1-10 condition branches. + * + * @return self + */ + public function setBranches($branches) + { + $this->container['branches'] = $branches; + + return $this; + } + + /** + * Gets expiration + * + * @return \onesignal\client\model\JourneyWaitUntilExpiration|null + */ + public function getExpiration() + { + return $this->container['expiration']; + } + + /** + * Sets expiration + * + * @param \onesignal\client\model\JourneyWaitUntilExpiration|null $expiration expiration + * + * @return self + */ + public function setExpiration($expiration) + { + $this->container['expiration'] = $expiration; + + return $this; + } + + /** + * Gets concurrency_key + * + * @return string|null + */ + public function getConcurrencyKey() + { + return $this->container['concurrency_key']; + } + + /** + * Sets concurrency_key + * + * @param string|null $concurrency_key Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. It is not merged onto the node. + * + * @return self + */ + public function setConcurrencyKey($concurrency_key) + { + $this->container['concurrency_key'] = $concurrency_key; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/model/UpdateJourneyRequest.php b/lib/model/UpdateJourneyRequest.php new file mode 100644 index 0000000..32d0d3a --- /dev/null +++ b/lib/model/UpdateJourneyRequest.php @@ -0,0 +1,601 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateJourneyRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UpdateJourneyRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'description' => 'string', + 'audience' => '\onesignal\client\model\JourneyAudience', + 'early_exit' => '\onesignal\client\model\JourneyEarlyExit', + 'reentry_rules' => '\onesignal\client\model\JourneyReentryRules', + 'schedule' => '\onesignal\client\model\JourneySchedule', + 'nodes' => '\onesignal\client\model\JourneyNode[]', + 'state' => 'string', + 'concurrency_key' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null, + 'audience' => null, + 'early_exit' => null, + 'reentry_rules' => null, + 'schedule' => null, + 'nodes' => null, + 'state' => null, + 'concurrency_key' => null + ]; + + /** + * 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 attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'description' => 'description', + 'audience' => 'audience', + 'early_exit' => 'early_exit', + 'reentry_rules' => 'reentry_rules', + 'schedule' => 'schedule', + 'nodes' => 'nodes', + 'state' => 'state', + 'concurrency_key' => 'concurrency_key' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription', + 'audience' => 'setAudience', + 'early_exit' => 'setEarlyExit', + 'reentry_rules' => 'setReentryRules', + 'schedule' => 'setSchedule', + 'nodes' => 'setNodes', + 'state' => 'setState', + 'concurrency_key' => 'setConcurrencyKey' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription', + 'audience' => 'getAudience', + 'early_exit' => 'getEarlyExit', + 'reentry_rules' => 'getReentryRules', + 'schedule' => 'getSchedule', + 'nodes' => 'getNodes', + 'state' => 'getState', + 'concurrency_key' => 'getConcurrencyKey' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + public const STATE_DRAFT = 'draft'; + public const STATE_SCHEDULED = 'scheduled'; + public const STATE_ACTIVE = 'active'; + public const STATE_ARCHIVED = 'archived'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStateAllowableValues() + { + return [ + self::STATE_DRAFT, + self::STATE_SCHEDULED, + self::STATE_ACTIVE, + self::STATE_ARCHIVED, + ]; + } + + /** + * 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; + $this->container['description'] = $data['description'] ?? null; + $this->container['audience'] = $data['audience'] ?? null; + $this->container['early_exit'] = $data['early_exit'] ?? null; + $this->container['reentry_rules'] = $data['reentry_rules'] ?? null; + $this->container['schedule'] = $data['schedule'] ?? null; + $this->container['nodes'] = $data['nodes'] ?? null; + $this->container['state'] = $data['state'] ?? null; + $this->container['concurrency_key'] = $data['concurrency_key'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($this->container['state']) && !in_array($this->container['state'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'state', must be one of '%s'", + $this->container['state'], + 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 name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Journey name. + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Journey description. Send null to clear it. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets audience + * + * @return \onesignal\client\model\JourneyAudience|null + */ + public function getAudience() + { + return $this->container['audience']; + } + + /** + * Sets audience + * + * @param \onesignal\client\model\JourneyAudience|null $audience audience + * + * @return self + */ + public function setAudience($audience) + { + $this->container['audience'] = $audience; + + return $this; + } + + /** + * Gets early_exit + * + * @return \onesignal\client\model\JourneyEarlyExit|null + */ + public function getEarlyExit() + { + return $this->container['early_exit']; + } + + /** + * Sets early_exit + * + * @param \onesignal\client\model\JourneyEarlyExit|null $early_exit early_exit + * + * @return self + */ + public function setEarlyExit($early_exit) + { + $this->container['early_exit'] = $early_exit; + + return $this; + } + + /** + * Gets reentry_rules + * + * @return \onesignal\client\model\JourneyReentryRules|null + */ + public function getReentryRules() + { + return $this->container['reentry_rules']; + } + + /** + * Sets reentry_rules + * + * @param \onesignal\client\model\JourneyReentryRules|null $reentry_rules reentry_rules + * + * @return self + */ + public function setReentryRules($reentry_rules) + { + $this->container['reentry_rules'] = $reentry_rules; + + return $this; + } + + /** + * Gets schedule + * + * @return \onesignal\client\model\JourneySchedule|null + */ + public function getSchedule() + { + return $this->container['schedule']; + } + + /** + * Sets schedule + * + * @param \onesignal\client\model\JourneySchedule|null $schedule schedule + * + * @return self + */ + public function setSchedule($schedule) + { + $this->container['schedule'] = $schedule; + + return $this; + } + + /** + * Gets nodes + * + * @return \onesignal\client\model\JourneyNode[]|null + */ + public function getNodes() + { + return $this->container['nodes']; + } + + /** + * Sets nodes + * + * @param \onesignal\client\model\JourneyNode[]|null $nodes Full ordered list of nodes, which replaces the existing graph wholesale. Preserve each node's server-assigned id from a prior fetch to keep in-flight users on that node; omit id to add a new node. + * + * @return self + */ + public function setNodes($nodes) + { + $this->container['nodes'] = $nodes; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state Target state. Set active to activate a draft journey, or scheduled together with a future schedule.start_at to activate it later. Set archived to stop a running journey; archiving is permanent. Only scheduled and processing journeys can return to draft. + * + * @return self + */ + public function setState($state) + { + $allowedValues = $this->getStateAllowableValues(); + if (!is_null($state) && !in_array($state, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'state', must be one of '%s'", + $state, + implode("', '", $allowedValues) + ) + ); + } + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets concurrency_key + * + * @return string|null + */ + public function getConcurrencyKey() + { + return $this->container['concurrency_key']; + } + + /** + * Sets concurrency_key + * + * @param string|null $concurrency_key Optional optimistic-concurrency token. Pass the concurrency_key from a prior fetch to reject the update with 409 if the journey changed. Omit to skip the check. + * + * @return self + */ + public function setConcurrencyKey($concurrency_key) + { + $this->container['concurrency_key'] = $concurrency_key; + + 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)); + } +} + +