diff --git a/Cargo.toml b/Cargo.toml index 67e7810..ba0102b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "onesignal-rust-api" -version = "5.11.2" +version = "5.12.0" authors = ["devrel@onesignal.com"] edition = "2018" description = "A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com" diff --git a/README.md b/README.md index 4d2aac4..0439cb2 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,15 @@ 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 ## Installation Add to `Cargo.toml` under `[dependencies]`: ```toml -onesignal-rust-api = "5.11.2" +onesignal-rust-api = "5.12.0" ``` ## Configuration diff --git a/docs/CreateJourneyRequest.md b/docs/CreateJourneyRequest.md new file mode 100644 index 0000000..c99a6bd --- /dev/null +++ b/docs/CreateJourneyRequest.md @@ -0,0 +1,17 @@ +# CreateJourneyRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Journey name, up to 300 characters. | +**description** | Option<**String**> | Optional journey description, up to 1024 characters. | [optional] +**audience** | Option<[**crate::models::JourneyAudience**](JourneyAudience.md)> | | [optional] +**early_exit** | Option<[**crate::models::JourneyEarlyExit**](JourneyEarlyExit.md)> | | [optional] +**reentry_rules** | Option<[**crate::models::JourneyReentryRules**](JourneyReentryRules.md)> | | [optional] +**schedule** | Option<[**crate::models::JourneySchedule**](JourneySchedule.md)> | | [optional] +**nodes** | Option<[**Vec**](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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 08404e7..3a36eae 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -11,6 +11,7 @@ Method | HTTP request | Description [**create_api_key**](DefaultApi.md#create_api_key) | **POST** /apps/{app_id}/auth/tokens | Create API key [**create_app**](DefaultApi.md#create_app) | **POST** /apps | Create an app [**create_custom_events**](DefaultApi.md#create_custom_events) | **POST** /apps/{app_id}/custom_events | Create custom events +[**create_journey**](DefaultApi.md#create_journey) | **POST** /apps/{app_id}/journeys | Create journey [**create_notification**](DefaultApi.md#create_notification) | **POST** /notifications | Create notification [**create_segment**](DefaultApi.md#create_segment) | **POST** /apps/{app_id}/segments | Create Segment [**create_subscription**](DefaultApi.md#create_subscription) | **POST** /apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions | @@ -18,6 +19,7 @@ Method | HTTP request | Description [**create_user**](DefaultApi.md#create_user) | **POST** /apps/{app_id}/users | [**delete_alias**](DefaultApi.md#delete_alias) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete} | [**delete_api_key**](DefaultApi.md#delete_api_key) | **DELETE** /apps/{app_id}/auth/tokens/{token_id} | Delete API key +[**delete_journey**](DefaultApi.md#delete_journey) | **DELETE** /apps/{app_id}/journeys/{journey_id} | Delete journey [**delete_segment**](DefaultApi.md#delete_segment) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segment [**delete_subscription**](DefaultApi.md#delete_subscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | [**delete_template**](DefaultApi.md#delete_template) | **DELETE** /templates/{template_id} | Delete template @@ -42,6 +44,8 @@ Method | HTTP request | Description [**unsubscribe_email_with_token**](DefaultApi.md#unsubscribe_email_with_token) | **POST** /apps/{app_id}/notifications/{notification_id}/unsubscribe | Unsubscribe with token [**update_api_key**](DefaultApi.md#update_api_key) | **PATCH** /apps/{app_id}/auth/tokens/{token_id} | Update API key [**update_app**](DefaultApi.md#update_app) | **PUT** /apps/{app_id} | Update an app +[**update_journey**](DefaultApi.md#update_journey) | **PATCH** /apps/{app_id}/journeys/{journey_id} | Update journey +[**update_journey_node**](DefaultApi.md#update_journey_node) | **PATCH** /apps/{app_id}/journeys/{journey_id}/nodes/{node_id} | Update journey node [**update_live_activity**](DefaultApi.md#update_live_activity) | **POST** /apps/{app_id}/live_activities/{activity_id}/notifications | Update a Live Activity via Push [**update_segment**](DefaultApi.md#update_segment) | **PATCH** /apps/{app_id}/segments/{segment_id} | Update Segment [**update_subscription**](DefaultApi.md#update_subscription) | **PATCH** /apps/{app_id}/subscriptions/{subscription_id} | @@ -49,6 +53,9 @@ Method | HTTP request | Description [**update_template**](DefaultApi.md#update_template) | **PATCH** /templates/{template_id} | Update template [**update_user**](DefaultApi.md#update_user) | **PATCH** /apps/{app_id}/users/by/{alias_label}/{alias_id} | [**view_api_keys**](DefaultApi.md#view_api_keys) | **GET** /apps/{app_id}/auth/tokens | View API keys +[**view_journey**](DefaultApi.md#view_journey) | **GET** /apps/{app_id}/journeys/{journey_id} | View journey +[**view_journey_stats**](DefaultApi.md#view_journey_stats) | **GET** /apps/{app_id}/journeys/{journey_id}/stats | View journey stats +[**view_journeys**](DefaultApi.md#view_journeys) | **GET** /apps/{app_id}/journeys | View journeys [**view_template**](DefaultApi.md#view_template) | **GET** /templates/{template_id} | View template [**view_templates**](DefaultApi.md#view_templates) | **GET** /templates | View templates @@ -527,6 +534,68 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) +## create_journey + +> crate::models::Journey create_journey(app_id, create_journey_request) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + +use onesignal_rust_api::models; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let create_journey_request: models::CreateJourneyRequest = todo!(); + + match default_api::create_journey(&configuration, app_id, create_journey_request).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("create_journey failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("create_journey failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**create_journey_request** | [**CreateJourneyRequest**](CreateJourneyRequest.md) | | [required] | + +### Return type + +[**crate::models::Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + ## create_notification > crate::models::CreateNotificationSuccessResponse create_notification(notification) @@ -1059,6 +1128,66 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) +## delete_journey + +> crate::models::GenericSuccessBoolResponse delete_journey(app_id, journey_id) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let journey_id: &str = "YOUR_JOURNEY_ID"; + + match default_api::delete_journey(&configuration, app_id, journey_id).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("delete_journey failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("delete_journey failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**journey_id** | **String** | UUID of the journey to delete. | [required] | + +### Return type + +[**crate::models::GenericSuccessBoolResponse**](GenericSuccessBoolResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + ## delete_segment > crate::models::GenericSuccessBoolResponse delete_segment(app_id, segment_id) @@ -2553,6 +2682,136 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) +## update_journey + +> crate::models::Journey update_journey(app_id, journey_id, update_journey_request) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + +use onesignal_rust_api::models; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let journey_id: &str = "YOUR_JOURNEY_ID"; + let update_journey_request: models::UpdateJourneyRequest = todo!(); + + match default_api::update_journey(&configuration, app_id, journey_id, update_journey_request).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("update_journey failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("update_journey failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**journey_id** | **String** | UUID of the journey to update. | [required] | +**update_journey_request** | [**UpdateJourneyRequest**](UpdateJourneyRequest.md) | | [required] | + +### Return type + +[**crate::models::Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + +## update_journey_node + +> crate::models::Journey update_journey_node(app_id, journey_id, node_id, update_journey_node_request) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + +use onesignal_rust_api::models; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let journey_id: &str = "YOUR_JOURNEY_ID"; + let node_id: &str = "YOUR_NODE_ID"; + let update_journey_node_request: models::UpdateJourneyNodeRequest = todo!(); + + match default_api::update_journey_node(&configuration, app_id, journey_id, node_id, update_journey_node_request).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("update_journey_node failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("update_journey_node failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**journey_id** | **String** | UUID of the journey that owns the node. | [required] | +**node_id** | **String** | Server-assigned UUID of the node to update, from a prior View journey fetch. | [required] | +**update_journey_node_request** | [**UpdateJourneyNodeRequest**](UpdateJourneyNodeRequest.md) | | [required] | + +### Return type + +[**crate::models::Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + ## update_live_activity > crate::models::UpdateLiveActivitySuccessResponse update_live_activity(app_id, activity_id, update_live_activity_request) @@ -2999,6 +3258,188 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) +## view_journey + +> crate::models::Journey view_journey(app_id, journey_id) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let journey_id: &str = "YOUR_JOURNEY_ID"; + + match default_api::view_journey(&configuration, app_id, journey_id).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("view_journey failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("view_journey failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**journey_id** | **String** | UUID of the journey to retrieve. | [required] | + +### Return type + +[**crate::models::Journey**](Journey.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + +## view_journey_stats + +> crate::models::JourneyStats view_journey_stats(app_id, journey_id) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let journey_id: &str = "YOUR_JOURNEY_ID"; + + match default_api::view_journey_stats(&configuration, app_id, journey_id).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("view_journey_stats failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("view_journey_stats failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**journey_id** | **String** | UUID of the journey to retrieve stats for. | [required] | + +### Return type + +[**crate::models::JourneyStats**](JourneyStats.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + +## view_journeys + +> crate::models::JourneyListResponse view_journeys(app_id, cursor, limit) +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 + +```rust +use onesignal_rust_api::apis::configuration::Configuration; +use onesignal_rust_api::apis::default_api; + + +#[tokio::main] +async fn main() { + let mut configuration = Configuration::new(); + configuration.rest_api_key_token = Some("YOUR_REST_API_KEY".to_string()); + + + // Realistic values are pulled from the spec's `example:` fields where present. + let app_id: &str = "YOUR_APP_ID"; + let cursor: Option<&str> = None; + let limit: Option = None; + + match default_api::view_journeys(&configuration, app_id, cursor, limit).await { + Ok(resp) => println!("{:?}", resp), + Err(e @ onesignal_rust_api::apis::Error::ResponseError(_)) => { + // `e.error_messages()` flattens any error-envelope shape to a Vec; + // the raw response remains on the ResponseError variant. + eprintln!("view_journeys failed: {:?}", e.error_messages()); + } + Err(e) => eprintln!("view_journeys failed: {:?}", e), + } +} +``` + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**app_id** | **String** | Your OneSignal App ID in UUID v4 format. | [required] | +**cursor** | Option<**String**> | Opaque pagination token from a previous response's next_cursor. Omit for the first page. | | +**limit** | Option<**i32**> | Maximum journeys to return per page. Minimum 1, maximum 50. | |[default to 50] + +### Return type + +[**crate::models::JourneyListResponse**](JourneyListResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-rust-api#configuration) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + ## view_template > crate::models::TemplateResource view_template(template_id, app_id) diff --git a/docs/Journey.md b/docs/Journey.md new file mode 100644 index 0000000..0613c37 --- /dev/null +++ b/docs/Journey.md @@ -0,0 +1,26 @@ +# Journey + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | Journey UUID. Read-only. | [optional] +**app_id** | Option<**String**> | UUID of the app the journey belongs to. Read-only. | [optional] +**name** | Option<**String**> | Journey name, up to 300 characters. | [optional] +**description** | Option<**String**> | Journey description, up to 1024 characters. Defaults to an empty string. | [optional] +**state** | Option<**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** | Option<**String**> | ISO 8601 creation time. Read-only. | [optional] +**updated_at** | Option<**String**> | ISO 8601 last-update time. Read-only. | [optional] +**started_at** | Option<**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** | Option<**String**> | ISO 8601 time the journey was archived, or null. Read-only. | [optional] +**created_source** | Option<**String**> | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] +**audience** | Option<[**crate::models::JourneyAudience**](JourneyAudience.md)> | | [optional] +**early_exit** | Option<[**crate::models::JourneyEarlyExit**](JourneyEarlyExit.md)> | | [optional] +**reentry_rules** | Option<[**crate::models::JourneyReentryRules**](JourneyReentryRules.md)> | | [optional] +**schedule** | Option<[**crate::models::JourneySchedule**](JourneySchedule.md)> | | [optional] +**nodes** | Option<[**Vec**](JourneyNode.md)> | Ordered list of journey nodes. | [optional] +**concurrency_key** | Option<**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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyAudience.md b/docs/JourneyAudience.md new file mode 100644 index 0000000..232de27 --- /dev/null +++ b/docs/JourneyAudience.md @@ -0,0 +1,16 @@ +# JourneyAudience + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | Audience kind. Selects which other fields apply. | +**included_segment_ids** | Option<**Vec**> | segment audiences: Segment UUIDs whose users enter the journey. | [optional] +**excluded_segment_ids** | Option<**Vec**> | segment audiences: Segment UUIDs whose users are excluded. | [optional] +**future_additions_only** | Option<**bool**> | segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. | [optional] +**name** | Option<**String**> | event_trigger audiences: event name that triggers entry, up to 255 characters. | [optional] +**attributes** | Option<[**Vec>**](array.md)> | 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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyBranch.md b/docs/JourneyBranch.md new file mode 100644 index 0000000..2ea46cb --- /dev/null +++ b/docs/JourneyBranch.md @@ -0,0 +1,14 @@ +# JourneyBranch + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. | [optional] +**condition** | Option<[**crate::models::JourneyCondition**](JourneyCondition.md)> | | [optional] +**weight** | Option<**f32**> | Branch weight for split_range nodes. Weights across a node's branches must sum to 100. | [optional] +**nodes** | Option<[**Vec**](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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyBranchStats.md b/docs/JourneyBranchStats.md new file mode 100644 index 0000000..4070c58 --- /dev/null +++ b/docs/JourneyBranchStats.md @@ -0,0 +1,11 @@ +# JourneyBranchStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**completed** | Option<**i32**> | Users who took this branch. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyCondition.md b/docs/JourneyCondition.md new file mode 100644 index 0000000..8400773 --- /dev/null +++ b/docs/JourneyCondition.md @@ -0,0 +1,19 @@ +# JourneyCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | **String** | Condition kind. Selects which other fields apply. | +**included_segment_ids** | Option<**Vec**> | segment_membership conditions: Segment UUIDs the user must belong to. | [optional] +**excluded_segment_ids** | Option<**Vec**> | segment_membership conditions: Segment UUIDs the user must not belong to. | [optional] +**action** | Option<**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** | Option<**String**> | on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. | [optional] +**client_node_id** | Option<**String**> | on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. | [optional] +**name** | Option<**String**> | event_trigger conditions: event name, up to 255 characters. | [optional] +**attributes** | Option<[**Vec>**](array.md)> | 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** | Option<[**Vec**](serde_json::Value.md)> | 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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyEarlyExit.md b/docs/JourneyEarlyExit.md new file mode 100644 index 0000000..2cd50dd --- /dev/null +++ b/docs/JourneyEarlyExit.md @@ -0,0 +1,12 @@ +# JourneyEarlyExit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**rules** | Option<[**crate::models::JourneyEarlyExitRules**](JourneyEarlyExit_rules.md)> | | [optional] +**tag_on_early_exit** | Option<**::std::collections::HashMap**> | Tag key-value pairs applied when a user exits early. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyEarlyExitRules.md b/docs/JourneyEarlyExitRules.md new file mode 100644 index 0000000..f51c087 --- /dev/null +++ b/docs/JourneyEarlyExitRules.md @@ -0,0 +1,14 @@ +# JourneyEarlyExitRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**on_segment** | Option<[**crate::models::JourneyEarlyExitRulesOnSegment**](JourneyEarlyExit_rules_on_segment.md)> | | [optional] +**when_not_in_audience** | Option<**bool**> | Exit when the user no longer matches the journey audience. Defaults to false. | [optional] +**on_session** | Option<**bool**> | Exit on a new session start. Defaults to false. | [optional] +**on_event** | Option<[**crate::models::JourneyEarlyExitRulesOnEvent**](JourneyEarlyExit_rules_on_event.md)> | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyEarlyExitRulesOnEvent.md b/docs/JourneyEarlyExitRulesOnEvent.md new file mode 100644 index 0000000..fdbf5a9 --- /dev/null +++ b/docs/JourneyEarlyExitRulesOnEvent.md @@ -0,0 +1,11 @@ +# 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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyEarlyExitRulesOnSegment.md b/docs/JourneyEarlyExitRulesOnSegment.md new file mode 100644 index 0000000..fdd9d84 --- /dev/null +++ b/docs/JourneyEarlyExitRulesOnSegment.md @@ -0,0 +1,11 @@ +# JourneyEarlyExitRulesOnSegment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**included_segment_ids** | Option<**Vec**> | Exit when the user enters any of these segments. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyEventAttribute.md b/docs/JourneyEventAttribute.md new file mode 100644 index 0000000..7162976 --- /dev/null +++ b/docs/JourneyEventAttribute.md @@ -0,0 +1,13 @@ +# JourneyEventAttribute + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | **String** | Event attribute key. | +**operator** | **String** | Comparison operator. | +**value** | Option<**String**> | Value to compare against. Not required for exists and not_exists. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyListAudience.md b/docs/JourneyListAudience.md new file mode 100644 index 0000000..8f8ab18 --- /dev/null +++ b/docs/JourneyListAudience.md @@ -0,0 +1,11 @@ +# JourneyListAudience + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | Option<**String**> | Audience kind. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyListItem.md b/docs/JourneyListItem.md new file mode 100644 index 0000000..74fa5bc --- /dev/null +++ b/docs/JourneyListItem.md @@ -0,0 +1,22 @@ +# JourneyListItem + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | Journey UUID. Read-only. | [optional] +**app_id** | Option<**String**> | UUID of the app the journey belongs to. Read-only. | [optional] +**name** | Option<**String**> | Journey name, up to 300 characters. | [optional] +**state** | Option<**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** | Option<**String**> | ISO 8601 creation time. Read-only. | [optional] +**updated_at** | Option<**String**> | ISO 8601 last-update time. Read-only. | [optional] +**started_at** | Option<**String**> | ISO 8601 time the journey was activated, or null. Read-only. | [optional] +**archived_at** | Option<**String**> | ISO 8601 time the journey was archived, or null. Read-only. | [optional] +**created_source** | Option<**String**> | Origin of the journey, for example public_api or dashboard. Read-only. | [optional] +**schedule** | Option<[**crate::models::JourneySchedule**](JourneySchedule.md)> | | [optional] +**audience** | Option<[**crate::models::JourneyListAudience**](JourneyListAudience.md)> | | [optional] +**reentry_rules** | Option<[**crate::models::JourneyReentryRules**](JourneyReentryRules.md)> | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyListResponse.md b/docs/JourneyListResponse.md new file mode 100644 index 0000000..691dc4c --- /dev/null +++ b/docs/JourneyListResponse.md @@ -0,0 +1,13 @@ +# JourneyListResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**journeys** | Option<[**Vec**](JourneyListItem.md)> | Journeys ordered by creation time, newest first. | [optional] +**has_more** | Option<**bool**> | true if more journeys exist beyond this page. | [optional] +**next_cursor** | Option<**String**> | Cursor for the next page. Present only when has_more is true. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyMessageStats.md b/docs/JourneyMessageStats.md new file mode 100644 index 0000000..a9e5873 --- /dev/null +++ b/docs/JourneyMessageStats.md @@ -0,0 +1,11 @@ +# JourneyMessageStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**totals** | Option<**::std::collections::HashMap**> | All-time totals for this node, keyed by channel-specific stat name. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyNode.md b/docs/JourneyNode.md new file mode 100644 index 0000000..c8c6df7 --- /dev/null +++ b/docs/JourneyNode.md @@ -0,0 +1,27 @@ +# JourneyNode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**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** | Option<**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** | Option<**String**> | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] +**duration_seconds** | Option<**i32**> | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] +**relative_to** | Option<**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** | Option<[**Vec**](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** | Option<**String**> | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] +**use_user_time_zone** | Option<**bool**> | time_window nodes: when true, uses the user's timezone if available. | [optional] +**template_id** | Option<**String**> | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] +**iam_id** | Option<**String**> | send_iam nodes: UUID of the in-app message to send. | [optional] +**user_ttl_seconds** | Option<**i32**> | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] +**webhook_id** | Option<**String**> | send_webhook nodes: UUID of the webhook to send. | [optional] +**assignments** | Option<**::std::collections::HashMap**> | 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** | Option<**bool**> | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] +**branches** | Option<[**Vec**](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** | Option<[**crate::models::JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md)> | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyNodeStats.md b/docs/JourneyNodeStats.md new file mode 100644 index 0000000..7ae5a3b --- /dev/null +++ b/docs/JourneyNodeStats.md @@ -0,0 +1,15 @@ +# JourneyNodeStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**kind** | Option<**String**> | Node kind, repeated here so stats can be read without joining against the journey definition. | [optional] +**waiting** | Option<**i32**> | Users currently held at this node. | [optional] +**completed** | Option<**i32**> | Users who advanced past this node normally. | [optional] +**exited_early** | Option<**i32**> | Users who left the journey from this node through an early exit rule. | [optional] +**message_stats** | Option<[**crate::models::JourneyMessageStats**](JourneyMessageStats.md)> | | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyReentryRules.md b/docs/JourneyReentryRules.md new file mode 100644 index 0000000..e97b56d --- /dev/null +++ b/docs/JourneyReentryRules.md @@ -0,0 +1,11 @@ +# JourneyReentryRules + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration_seconds** | Option<**i32**> | 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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneySchedule.md b/docs/JourneySchedule.md new file mode 100644 index 0000000..1723ff7 --- /dev/null +++ b/docs/JourneySchedule.md @@ -0,0 +1,13 @@ +# JourneySchedule + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start_at** | Option<**String**> | ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. | [optional] +**stop_at** | Option<**String**> | ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. | [optional] +**error** | Option<**String**> | Read-only. Present when a scheduling error occurred. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyStats.md b/docs/JourneyStats.md new file mode 100644 index 0000000..db2e559 --- /dev/null +++ b/docs/JourneyStats.md @@ -0,0 +1,16 @@ +# JourneyStats + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | Option<**String**> | UUID of the journey these stats belong to. | [optional] +**started** | Option<**i32**> | Users who entered the journey. | [optional] +**completed** | Option<**i32**> | Users who reached the end of the journey normally. | [optional] +**exited_early** | Option<**i32**> | Users who left the journey through an early exit rule. | [optional] +**nodes** | Option<[**::std::collections::HashMap**](JourneyNodeStats.md)> | Node stats keyed by node id. Includes every node in the graph, at any nesting depth. | [optional] +**branches** | Option<[**::std::collections::HashMap**](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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyTimePoint.md b/docs/JourneyTimePoint.md new file mode 100644 index 0000000..e418c3a --- /dev/null +++ b/docs/JourneyTimePoint.md @@ -0,0 +1,12 @@ +# JourneyTimePoint + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hour** | Option<**i32**> | Hour of day, 0-23. | [optional] +**minute** | Option<**i32**> | Minute of hour, 0-59. Defaults to 0. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyTimeWindow.md b/docs/JourneyTimeWindow.md new file mode 100644 index 0000000..5ad4bf7 --- /dev/null +++ b/docs/JourneyTimeWindow.md @@ -0,0 +1,13 @@ +# JourneyTimeWindow + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**start** | Option<[**crate::models::JourneyTimePoint**](JourneyTimePoint.md)> | When the window opens. | [optional] +**end** | Option<[**crate::models::JourneyTimePoint**](JourneyTimePoint.md)> | When the window closes. | [optional] +**day_of_week** | Option<**i32**> | Day of week, 1 = Monday. Omit to apply the window to every day. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/JourneyWaitUntilExpiration.md b/docs/JourneyWaitUntilExpiration.md new file mode 100644 index 0000000..5c7c1bd --- /dev/null +++ b/docs/JourneyWaitUntilExpiration.md @@ -0,0 +1,12 @@ +# JourneyWaitUntilExpiration + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**duration_seconds** | Option<**i32**> | Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). | [optional] +**exits** | Option<**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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/UpdateJourneyNodeRequest.md b/docs/UpdateJourneyNodeRequest.md new file mode 100644 index 0000000..60a2515 --- /dev/null +++ b/docs/UpdateJourneyNodeRequest.md @@ -0,0 +1,26 @@ +# UpdateJourneyNodeRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client_node_id** | Option<**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** | Option<**String**> | Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. | [optional] +**duration_seconds** | Option<**i32**> | wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). | [optional] +**relative_to** | Option<**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** | Option<[**Vec**](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** | Option<**String**> | time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. | [optional] +**use_user_time_zone** | Option<**bool**> | time_window nodes: when true, uses the user's timezone if available. | [optional] +**template_id** | Option<**String**> | send_push, send_email, and send_sms nodes: UUID of the template to send. | [optional] +**iam_id** | Option<**String**> | send_iam nodes: UUID of the in-app message to send. | [optional] +**user_ttl_seconds** | Option<**i32**> | send_iam nodes: optional time-to-live for the in-app message, in seconds. | [optional] +**webhook_id** | Option<**String**> | send_webhook nodes: UUID of the webhook to send. | [optional] +**assignments** | Option<**::std::collections::HashMap**> | 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** | Option<**bool**> | split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. | [optional] +**branches** | Option<[**Vec**](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** | Option<[**crate::models::JourneyWaitUntilExpiration**](JourneyWaitUntilExpiration.md)> | | [optional] +**concurrency_key** | Option<**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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/docs/UpdateJourneyRequest.md b/docs/UpdateJourneyRequest.md new file mode 100644 index 0000000..621ce8c --- /dev/null +++ b/docs/UpdateJourneyRequest.md @@ -0,0 +1,19 @@ +# UpdateJourneyRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | Option<**String**> | Journey name. | [optional] +**description** | Option<**String**> | Journey description. Send null to clear it. | [optional] +**audience** | Option<[**crate::models::JourneyAudience**](JourneyAudience.md)> | | [optional] +**early_exit** | Option<[**crate::models::JourneyEarlyExit**](JourneyEarlyExit.md)> | | [optional] +**reentry_rules** | Option<[**crate::models::JourneyReentryRules**](JourneyReentryRules.md)> | | [optional] +**schedule** | Option<[**crate::models::JourneySchedule**](JourneySchedule.md)> | | [optional] +**nodes** | Option<[**Vec**](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** | Option<**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** | Option<**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-rust-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-rust-api) + + diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs index 9406c17..2d9ab08 100644 --- a/src/apis/configuration.rs +++ b/src/apis/configuration.rs @@ -44,7 +44,7 @@ impl Default for Configuration { fn default() -> Self { Configuration { base_path: "https://api.onesignal.com".to_owned(), - user_agent: Some("OpenAPI-Generator/5.11.2/rust".to_owned()), + user_agent: Some("OpenAPI-Generator/5.12.0/rust".to_owned()), client: reqwest::Client::new(), basic_auth: None, oauth_access_token: None, diff --git a/src/apis/default_api.rs b/src/apis/default_api.rs index b456740..039bb65 100644 --- a/src/apis/default_api.rs +++ b/src/apis/default_api.rs @@ -88,6 +88,17 @@ pub enum CreateCustomEventsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`create_journey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateJourneyError { + Status400(crate::models::GenericError), + Status403(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`create_notification`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -163,6 +174,17 @@ pub enum DeleteApiKeyError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`delete_journey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteJourneyError { + Status403(crate::models::GenericError), + Status404(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`delete_segment`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -415,6 +437,34 @@ pub enum UpdateAppError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`update_journey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateJourneyError { + Status400(crate::models::GenericError), + Status403(crate::models::GenericError), + Status404(crate::models::GenericError), + Status409(crate::models::GenericError), + Status422(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`update_journey_node`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateJourneyNodeError { + Status400(crate::models::GenericError), + Status403(crate::models::GenericError), + Status404(crate::models::GenericError), + Status409(crate::models::GenericError), + Status422(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`update_live_activity`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -488,6 +538,37 @@ pub enum ViewApiKeysError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`view_journey`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ViewJourneyError { + Status404(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`view_journey_stats`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ViewJourneyStatsError { + Status404(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`view_journeys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ViewJourneysError { + Status400(crate::models::GenericError), + Status403(crate::models::GenericError), + Status429(crate::models::RateLimitError), + DefaultResponse(crate::models::GenericError), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`view_template`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -524,7 +605,7 @@ pub async fn cancel_notification(configuration: &configuration::Configuration, a } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -560,7 +641,7 @@ pub async fn copy_template_to_app(configuration: &configuration::Configuration, } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -596,7 +677,7 @@ pub async fn create_alias(configuration: &configuration::Configuration, app_id: } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -632,7 +713,7 @@ pub async fn create_alias_by_subscription(configuration: &configuration::Configu } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -668,7 +749,7 @@ pub async fn create_api_key(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -704,7 +785,7 @@ pub async fn create_app(configuration: &configuration::Configuration, app: crate } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -740,7 +821,7 @@ pub async fn create_custom_events(configuration: &configuration::Configuration, } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -762,6 +843,42 @@ pub async fn create_custom_events(configuration: &configuration::Configuration, } } +/// 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. +pub async fn create_journey(configuration: &configuration::Configuration, app_id: &str, create_journey_request: crate::models::CreateJourneyRequest) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys", configuration.base_path, app_id=crate::apis::urlencode(app_id)); + let mut req_builder = client.request(reqwest::Method::POST, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + req_builder = req_builder.json(&create_journey_request); + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + /// Sends notifications to your users. **Target by External ID (push example):** set `include_aliases` to `{ \"external_id\": [\"your-user-id\"] }` and set `target_channel` to `push` (or `email` / `sms` for those channels). Alias object keys must match API labels exactly (for example `external_id`, not camelCase). **Do not confuse** the notification-level `external_id` field with External ID targeting: top-level `external_id` / `idempotency_key` are for idempotent notification requests only, not for selecting recipients. **Targeting compatibility:** `include_aliases` must not be combined with other targeting modes (segments, filters, subscription IDs, legacy player IDs, etc.). Clients should send only one targeting strategy per request. pub async fn create_notification(configuration: &configuration::Configuration, notification: crate::models::Notification) -> Result> { let configuration = configuration; @@ -776,7 +893,7 @@ pub async fn create_notification(configuration: &configuration::Configuration, n } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -812,7 +929,7 @@ pub async fn create_segment(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -848,7 +965,7 @@ pub async fn create_subscription(configuration: &configuration::Configuration, a } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -884,7 +1001,7 @@ pub async fn create_template(configuration: &configuration::Configuration, creat } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -920,7 +1037,7 @@ pub async fn create_user(configuration: &configuration::Configuration, app_id: & } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -956,7 +1073,7 @@ pub async fn delete_alias(configuration: &configuration::Configuration, app_id: } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -991,7 +1108,7 @@ pub async fn delete_api_key(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1012,6 +1129,41 @@ pub async fn delete_api_key(configuration: &configuration::Configuration, app_id } } +/// 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. +pub async fn delete_journey(configuration: &configuration::Configuration, app_id: &str, journey_id: &str) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys/{journey_id}", configuration.base_path, app_id=crate::apis::urlencode(app_id), journey_id=crate::apis::urlencode(journey_id)); + let mut req_builder = client.request(reqwest::Method::DELETE, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + /// Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. pub async fn delete_segment(configuration: &configuration::Configuration, app_id: &str, segment_id: &str) -> Result> { let configuration = configuration; @@ -1026,7 +1178,7 @@ pub async fn delete_segment(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1061,7 +1213,7 @@ pub async fn delete_subscription(configuration: &configuration::Configuration, a } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1097,7 +1249,7 @@ pub async fn delete_template(configuration: &configuration::Configuration, templ } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1132,7 +1284,7 @@ pub async fn delete_user(configuration: &configuration::Configuration, app_id: & } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1168,7 +1320,7 @@ pub async fn export_events(configuration: &configuration::Configuration, notific } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1203,7 +1355,7 @@ pub async fn export_subscriptions(configuration: &configuration::Configuration, } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1239,7 +1391,7 @@ pub async fn get_aliases(configuration: &configuration::Configuration, app_id: & } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1274,7 +1426,7 @@ pub async fn get_aliases_by_subscription(configuration: &configuration::Configur } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1309,7 +1461,7 @@ pub async fn get_app(configuration: &configuration::Configuration, app_id: &str) } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1344,7 +1496,7 @@ pub async fn get_apps(configuration: &configuration::Configuration, ) -> Result< } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1380,7 +1532,7 @@ pub async fn get_notification(configuration: &configuration::Configuration, app_ } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1415,7 +1567,7 @@ pub async fn get_notification_history(configuration: &configuration::Configurati } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1464,7 +1616,7 @@ pub async fn get_notifications(configuration: &configuration::Configuration, app } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1512,7 +1664,7 @@ pub async fn get_outcomes(configuration: &configuration::Configuration, app_id: } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1550,7 +1702,7 @@ pub async fn get_segment(configuration: &configuration::Configuration, app_id: & } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1591,7 +1743,7 @@ pub async fn get_segments(configuration: &configuration::Configuration, app_id: } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1626,7 +1778,7 @@ pub async fn get_user(configuration: &configuration::Configuration, app_id: &str } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1715,7 +1867,7 @@ pub async fn list_audit_logs(configuration: &configuration::Configuration, organ } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1750,7 +1902,7 @@ pub async fn rotate_api_key(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1785,7 +1937,7 @@ pub async fn start_live_activity(configuration: &configuration::Configuration, a } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1821,7 +1973,7 @@ pub async fn transfer_subscription(configuration: &configuration::Configuration, } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1858,7 +2010,7 @@ pub async fn unsubscribe_email_with_token(configuration: &configuration::Configu } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1893,7 +2045,7 @@ pub async fn update_api_key(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1929,7 +2081,7 @@ pub async fn update_app(configuration: &configuration::Configuration, app_id: &s } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -1951,6 +2103,78 @@ pub async fn update_app(configuration: &configuration::Configuration, app_id: &s } } +/// 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. +pub async fn update_journey(configuration: &configuration::Configuration, app_id: &str, journey_id: &str, update_journey_request: crate::models::UpdateJourneyRequest) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys/{journey_id}", configuration.base_path, app_id=crate::apis::urlencode(app_id), journey_id=crate::apis::urlencode(journey_id)); + let mut req_builder = client.request(reqwest::Method::PATCH, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + req_builder = req_builder.json(&update_journey_request); + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + +/// 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. +pub async fn update_journey_node(configuration: &configuration::Configuration, app_id: &str, journey_id: &str, node_id: &str, update_journey_node_request: crate::models::UpdateJourneyNodeRequest) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys/{journey_id}/nodes/{node_id}", configuration.base_path, app_id=crate::apis::urlencode(app_id), journey_id=crate::apis::urlencode(journey_id), node_id=crate::apis::urlencode(node_id)); + let mut req_builder = client.request(reqwest::Method::PATCH, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + req_builder = req_builder.json(&update_journey_node_request); + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + /// Updates a specified live activity. pub async fn update_live_activity(configuration: &configuration::Configuration, app_id: &str, activity_id: &str, update_live_activity_request: crate::models::UpdateLiveActivityRequest) -> Result> { let configuration = configuration; @@ -1965,7 +2189,7 @@ pub async fn update_live_activity(configuration: &configuration::Configuration, } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2001,7 +2225,7 @@ pub async fn update_segment(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2037,7 +2261,7 @@ pub async fn update_subscription(configuration: &configuration::Configuration, a } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2073,7 +2297,7 @@ pub async fn update_subscription_by_token(configuration: &configuration::Configu } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2110,7 +2334,7 @@ pub async fn update_template(configuration: &configuration::Configuration, templ } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2146,7 +2370,7 @@ pub async fn update_user(configuration: &configuration::Configuration, app_id: & } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2182,7 +2406,7 @@ pub async fn view_api_keys(configuration: &configuration::Configuration, app_id: } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.organization_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2203,6 +2427,117 @@ pub async fn view_api_keys(configuration: &configuration::Configuration, app_id: } } +/// 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. +pub async fn view_journey(configuration: &configuration::Configuration, app_id: &str, journey_id: &str) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys/{journey_id}", configuration.base_path, app_id=crate::apis::urlencode(app_id), journey_id=crate::apis::urlencode(journey_id)); + let mut req_builder = client.request(reqwest::Method::GET, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + +/// 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. +pub async fn view_journey_stats(configuration: &configuration::Configuration, app_id: &str, journey_id: &str) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys/{journey_id}/stats", configuration.base_path, app_id=crate::apis::urlencode(app_id), journey_id=crate::apis::urlencode(journey_id)); + let mut req_builder = client.request(reqwest::Method::GET, uri_str.as_str()); + + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + +/// 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. +pub async fn view_journeys(configuration: &configuration::Configuration, app_id: &str, cursor: Option<&str>, limit: Option) -> Result> { + let configuration = configuration; + + let client = &configuration.client; + + let uri_str = format!("{}/apps/{app_id}/journeys", configuration.base_path, app_id=crate::apis::urlencode(app_id)); + let mut req_builder = client.request(reqwest::Method::GET, uri_str.as_str()); + + if let Some(ref str) = cursor { + req_builder = req_builder.query(&[("cursor", &str.to_string())]); + } + if let Some(ref str) = limit { + req_builder = req_builder.query(&[("limit", &str.to_string())]); + } + if let Some(ref user_agent) = configuration.user_agent { + req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone()); + } + + // Adds a telemetry header + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); + + if let Some(ref token) = configuration.rest_api_key_token { + req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); + } + + let req = req_builder.build()?; + let resp = client.execute(req).await?; + + let status = resp.status(); + let content = resp.text().await?; + + if !status.is_client_error() && !status.is_server_error() { + serde_json::from_str(&content).map_err(Error::from) + } else { + let entity: Option = serde_json::from_str(&content).ok(); + let error = ResponseContent { status: status, content: content, entity: entity }; + Err(Error::ResponseError(error)) + } +} + /// Fetch a single template by id. pub async fn view_template(configuration: &configuration::Configuration, template_id: &str, app_id: &str) -> Result> { let configuration = configuration; @@ -2218,7 +2553,7 @@ pub async fn view_template(configuration: &configuration::Configuration, templat } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); @@ -2263,7 +2598,7 @@ pub async fn view_templates(configuration: &configuration::Configuration, app_id } // Adds a telemetry header - req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.11.2"); + req_builder = req_builder.header("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-rust, version=5.12.0"); if let Some(ref token) = configuration.rest_api_key_token { req_builder = req_builder.header("Authorization", format!("Key {}", token.to_owned())); diff --git a/src/models/create_journey_request.rs b/src/models/create_journey_request.rs new file mode 100644 index 0000000..4cbcf8c --- /dev/null +++ b/src/models/create_journey_request.rs @@ -0,0 +1,50 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// CreateJourneyRequest : Writable fields for Create journey. Journeys are always created in the draft state. Server-controlled fields such as state or id are rejected. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct CreateJourneyRequest { + /// Journey name, up to 300 characters. + #[serde(rename = "name")] + pub name: String, + /// Optional journey description, up to 1024 characters. + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "audience", skip_serializing_if = "Option::is_none")] + pub audience: Option>, + #[serde(rename = "early_exit", skip_serializing_if = "Option::is_none")] + pub early_exit: Option>, + #[serde(rename = "reentry_rules", skip_serializing_if = "Option::is_none")] + pub reentry_rules: Option>, + #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")] + pub schedule: Option>, + /// Ordered list of journey nodes. Server-assigned id fields are rejected on create. + #[serde(rename = "nodes", skip_serializing_if = "Option::is_none")] + pub nodes: Option>, +} + +impl CreateJourneyRequest { + /// Writable fields for Create journey. Journeys are always created in the draft state. Server-controlled fields such as state or id are rejected. + pub fn new(name: String) -> CreateJourneyRequest { + CreateJourneyRequest { + name, + description: None, + audience: None, + early_exit: None, + reentry_rules: None, + schedule: None, + nodes: None, + } + } +} + + diff --git a/src/models/journey.rs b/src/models/journey.rs new file mode 100644 index 0000000..e8d06dd --- /dev/null +++ b/src/models/journey.rs @@ -0,0 +1,106 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// Journey : Full journey representation returned by the detail, create, and update endpoints. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Journey { + /// Journey UUID. Read-only. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// UUID of the app the journey belongs to. Read-only. + #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")] + pub app_id: Option, + /// Journey name, up to 300 characters. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Journey description, up to 1024 characters. Defaults to an empty string. + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + /// 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. + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, + /// ISO 8601 creation time. Read-only. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// ISO 8601 last-update time. Read-only. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// 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. + #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] + pub started_at: Option, + /// ISO 8601 time the journey was archived, or null. Read-only. + #[serde(rename = "archived_at", skip_serializing_if = "Option::is_none")] + pub archived_at: Option, + /// Origin of the journey, for example public_api or dashboard. Read-only. + #[serde(rename = "created_source", skip_serializing_if = "Option::is_none")] + pub created_source: Option, + #[serde(rename = "audience", skip_serializing_if = "Option::is_none")] + pub audience: Option>, + #[serde(rename = "early_exit", skip_serializing_if = "Option::is_none")] + pub early_exit: Option>, + #[serde(rename = "reentry_rules", skip_serializing_if = "Option::is_none")] + pub reentry_rules: Option>, + #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")] + pub schedule: Option>, + /// Ordered list of journey nodes. + #[serde(rename = "nodes", skip_serializing_if = "Option::is_none")] + pub nodes: Option>, + /// 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. + #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")] + pub concurrency_key: Option, +} + +impl Journey { + /// Full journey representation returned by the detail, create, and update endpoints. + pub fn new() -> Journey { + Journey { + id: None, + app_id: None, + name: None, + description: None, + state: None, + created_at: None, + updated_at: None, + started_at: None, + archived_at: None, + created_source: None, + audience: None, + early_exit: None, + reentry_rules: None, + schedule: None, + nodes: None, + concurrency_key: None, + } + } +} + +/// 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. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum StateType { + #[serde(rename = "draft")] + Draft, + #[serde(rename = "scheduled")] + Scheduled, + #[serde(rename = "processing")] + Processing, + #[serde(rename = "active")] + Active, + #[serde(rename = "archived")] + Archived, +} + +impl Default for StateType { + fn default() -> StateType { + Self::Draft + } +} + diff --git a/src/models/journey_audience.rs b/src/models/journey_audience.rs new file mode 100644 index 0000000..88b43bc --- /dev/null +++ b/src/models/journey_audience.rs @@ -0,0 +1,64 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyAudience : The journey entry audience. The kind field selects which other fields apply. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyAudience { + /// Audience kind. Selects which other fields apply. + #[serde(rename = "kind")] + pub kind: KindType, + /// segment audiences: Segment UUIDs whose users enter the journey. + #[serde(rename = "included_segment_ids", skip_serializing_if = "Option::is_none")] + pub included_segment_ids: Option>, + /// segment audiences: Segment UUIDs whose users are excluded. + #[serde(rename = "excluded_segment_ids", skip_serializing_if = "Option::is_none")] + pub excluded_segment_ids: Option>, + /// segment audiences: when true, only users who newly match the segment after activation enter the journey. Defaults to false. + #[serde(rename = "future_additions_only", skip_serializing_if = "Option::is_none")] + pub future_additions_only: Option, + /// event_trigger audiences: event name that triggers entry, up to 255 characters. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 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. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub attributes: Option>>, +} + +impl JourneyAudience { + /// The journey entry audience. The kind field selects which other fields apply. + pub fn new(kind: KindType) -> JourneyAudience { + JourneyAudience { + kind, + included_segment_ids: None, + excluded_segment_ids: None, + future_additions_only: None, + name: None, + attributes: None, + } + } +} + +/// Audience kind. Selects which other fields apply. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum KindType { + #[serde(rename = "segment")] + Segment, + #[serde(rename = "event_trigger")] + EventTrigger, +} + +impl Default for KindType { + fn default() -> KindType { + Self::Segment + } +} + diff --git a/src/models/journey_branch.rs b/src/models/journey_branch.rs new file mode 100644 index 0000000..ee1c055 --- /dev/null +++ b/src/models/journey_branch.rs @@ -0,0 +1,39 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyBranch { + /// Server-assigned branch identifier. Read-only on create; echo it on update to keep the branch. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "condition", skip_serializing_if = "Option::is_none")] + pub condition: Option>, + /// Branch weight for split_range nodes. Weights across a node's branches must sum to 100. + #[serde(rename = "weight", skip_serializing_if = "Option::is_none")] + pub weight: Option, + /// Nodes run when this branch is taken, before flow converges to the next sibling node. + #[serde(rename = "nodes", skip_serializing_if = "Option::is_none")] + pub nodes: Option>, +} + +impl JourneyBranch { + pub fn new() -> JourneyBranch { + JourneyBranch { + id: None, + condition: None, + weight: None, + nodes: None, + } + } +} + + diff --git a/src/models/journey_branch_stats.rs b/src/models/journey_branch_stats.rs new file mode 100644 index 0000000..b2cc96b --- /dev/null +++ b/src/models/journey_branch_stats.rs @@ -0,0 +1,30 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyBranchStats : Stats for a single branch of a branching node. Keyed in the response by the branch's server-assigned id. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyBranchStats { + /// Users who took this branch. + #[serde(rename = "completed", skip_serializing_if = "Option::is_none")] + pub completed: Option, +} + +impl JourneyBranchStats { + /// Stats for a single branch of a branching node. Keyed in the response by the branch's server-assigned id. + pub fn new() -> JourneyBranchStats { + JourneyBranchStats { + completed: None, + } + } +} + + diff --git a/src/models/journey_condition.rs b/src/models/journey_condition.rs new file mode 100644 index 0000000..a0135da --- /dev/null +++ b/src/models/journey_condition.rs @@ -0,0 +1,94 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyCondition : A branch condition. The kind field selects which other fields apply. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyCondition { + /// Condition kind. Selects which other fields apply. + #[serde(rename = "kind")] + pub kind: KindType, + /// segment_membership conditions: Segment UUIDs the user must belong to. + #[serde(rename = "included_segment_ids", skip_serializing_if = "Option::is_none")] + pub included_segment_ids: Option>, + /// segment_membership conditions: Segment UUIDs the user must not belong to. + #[serde(rename = "excluded_segment_ids", skip_serializing_if = "Option::is_none")] + pub excluded_segment_ids: Option>, + /// on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. + #[serde(rename = "action", skip_serializing_if = "Option::is_none")] + pub action: Option, + /// on_notification_action conditions: id of the sending node this action refers to. Returned on reads; accepted on write. + #[serde(rename = "sending_node_id", skip_serializing_if = "Option::is_none")] + pub sending_node_id: Option, + /// on_notification_action conditions: write-only alternative to sending_node_id. References the sending node by its client_node_id. + #[serde(rename = "client_node_id", skip_serializing_if = "Option::is_none")] + pub client_node_id: Option, + /// event_trigger conditions: event name, up to 255 characters. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 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. + #[serde(rename = "attributes", skip_serializing_if = "Option::is_none")] + pub attributes: Option>>, + /// event_trigger conditions: match incoming event properties against the journey's entry event. Only valid on event-triggered journeys. + #[serde(rename = "entry_event_match_attributes", skip_serializing_if = "Option::is_none")] + pub entry_event_match_attributes: Option>, +} + +impl JourneyCondition { + /// A branch condition. The kind field selects which other fields apply. + pub fn new(kind: KindType) -> JourneyCondition { + JourneyCondition { + kind, + included_segment_ids: None, + excluded_segment_ids: None, + action: None, + sending_node_id: None, + client_node_id: None, + name: None, + attributes: None, + entry_event_match_attributes: None, + } + } +} + +/// Condition kind. Selects which other fields apply. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum KindType { + #[serde(rename = "segment_membership")] + SegmentMembership, + #[serde(rename = "on_notification_action")] + OnNotificationAction, + #[serde(rename = "event_trigger")] + EventTrigger, +} + +impl Default for KindType { + fn default() -> KindType { + Self::SegmentMembership + } +} +/// on_notification_action conditions: the notification action to branch on. Which actions apply depends on the sending node's channel. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum ActionType { + #[serde(rename = "received")] + Received, + #[serde(rename = "clicked")] + Clicked, + #[serde(rename = "opened")] + Opened, +} + +impl Default for ActionType { + fn default() -> ActionType { + Self::Received + } +} + diff --git a/src/models/journey_early_exit.rs b/src/models/journey_early_exit.rs new file mode 100644 index 0000000..d35e0e0 --- /dev/null +++ b/src/models/journey_early_exit.rs @@ -0,0 +1,33 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyEarlyExit : Conditions that remove a user from the journey before it completes. At least one rule must be set under rules. Send null to remove early exit entirely. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyEarlyExit { + #[serde(rename = "rules", skip_serializing_if = "Option::is_none")] + pub rules: Option>, + /// Tag key-value pairs applied when a user exits early. + #[serde(rename = "tag_on_early_exit", skip_serializing_if = "Option::is_none")] + pub tag_on_early_exit: Option<::std::collections::HashMap>, +} + +impl JourneyEarlyExit { + /// Conditions that remove a user from the journey before it completes. At least one rule must be set under rules. Send null to remove early exit entirely. + pub fn new() -> JourneyEarlyExit { + JourneyEarlyExit { + rules: None, + tag_on_early_exit: None, + } + } +} + + diff --git a/src/models/journey_early_exit_rules.rs b/src/models/journey_early_exit_rules.rs new file mode 100644 index 0000000..9f0230f --- /dev/null +++ b/src/models/journey_early_exit_rules.rs @@ -0,0 +1,38 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyEarlyExitRules { + #[serde(rename = "on_segment", skip_serializing_if = "Option::is_none")] + pub on_segment: Option>, + /// Exit when the user no longer matches the journey audience. Defaults to false. + #[serde(rename = "when_not_in_audience", skip_serializing_if = "Option::is_none")] + pub when_not_in_audience: Option, + /// Exit on a new session start. Defaults to false. + #[serde(rename = "on_session", skip_serializing_if = "Option::is_none")] + pub on_session: Option, + #[serde(rename = "on_event", skip_serializing_if = "Option::is_none")] + pub on_event: Option>, +} + +impl JourneyEarlyExitRules { + pub fn new() -> JourneyEarlyExitRules { + JourneyEarlyExitRules { + on_segment: None, + when_not_in_audience: None, + on_session: None, + on_event: None, + } + } +} + + diff --git a/src/models/journey_early_exit_rules_on_event.rs b/src/models/journey_early_exit_rules_on_event.rs new file mode 100644 index 0000000..6da0cc6 --- /dev/null +++ b/src/models/journey_early_exit_rules_on_event.rs @@ -0,0 +1,28 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyEarlyExitRulesOnEvent { + /// Exit when this event occurs. Up to 255 characters. + #[serde(rename = "name")] + pub name: String, +} + +impl JourneyEarlyExitRulesOnEvent { + pub fn new(name: String) -> JourneyEarlyExitRulesOnEvent { + JourneyEarlyExitRulesOnEvent { + name, + } + } +} + + diff --git a/src/models/journey_early_exit_rules_on_segment.rs b/src/models/journey_early_exit_rules_on_segment.rs new file mode 100644 index 0000000..2311606 --- /dev/null +++ b/src/models/journey_early_exit_rules_on_segment.rs @@ -0,0 +1,28 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyEarlyExitRulesOnSegment { + /// Exit when the user enters any of these segments. + #[serde(rename = "included_segment_ids", skip_serializing_if = "Option::is_none")] + pub included_segment_ids: Option>, +} + +impl JourneyEarlyExitRulesOnSegment { + pub fn new() -> JourneyEarlyExitRulesOnSegment { + JourneyEarlyExitRulesOnSegment { + included_segment_ids: None, + } + } +} + + diff --git a/src/models/journey_event_attribute.rs b/src/models/journey_event_attribute.rs new file mode 100644 index 0000000..2ac0224 --- /dev/null +++ b/src/models/journey_event_attribute.rs @@ -0,0 +1,70 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyEventAttribute { + /// Event attribute key. + #[serde(rename = "key")] + pub key: String, + /// Comparison operator. + #[serde(rename = "operator")] + pub operator: OperatorType, + /// Value to compare against. Not required for exists and not_exists. + #[serde(rename = "value", skip_serializing_if = "Option::is_none")] + pub value: Option, +} + +impl JourneyEventAttribute { + pub fn new(key: String, operator: OperatorType) -> JourneyEventAttribute { + JourneyEventAttribute { + key, + operator, + value: None, + } + } +} + +/// Comparison operator. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum OperatorType { + #[serde(rename = "equal")] + Equal, + #[serde(rename = "not_equal")] + NotEqual, + #[serde(rename = "less")] + Less, + #[serde(rename = "less_or_equal")] + LessOrEqual, + #[serde(rename = "greater_or_equal")] + GreaterOrEqual, + #[serde(rename = "greater")] + Greater, + #[serde(rename = "is")] + Is, + #[serde(rename = "is_not")] + IsNot, + #[serde(rename = "exists")] + Exists, + #[serde(rename = "not_exists")] + NotExists, + #[serde(rename = "before")] + Before, + #[serde(rename = "after")] + After, +} + +impl Default for OperatorType { + fn default() -> OperatorType { + Self::Equal + } +} + diff --git a/src/models/journey_list_audience.rs b/src/models/journey_list_audience.rs new file mode 100644 index 0000000..672af28 --- /dev/null +++ b/src/models/journey_list_audience.rs @@ -0,0 +1,44 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyListAudience : Entry audience reduced to its kind. Use View journey for the full audience configuration. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyListAudience { + /// Audience kind. + #[serde(rename = "kind", skip_serializing_if = "Option::is_none")] + pub kind: Option, +} + +impl JourneyListAudience { + /// Entry audience reduced to its kind. Use View journey for the full audience configuration. + pub fn new() -> JourneyListAudience { + JourneyListAudience { + kind: None, + } + } +} + +/// Audience kind. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum KindType { + #[serde(rename = "segment")] + Segment, + #[serde(rename = "event_trigger")] + EventTrigger, +} + +impl Default for KindType { + fn default() -> KindType { + Self::Segment + } +} + diff --git a/src/models/journey_list_item.rs b/src/models/journey_list_item.rs new file mode 100644 index 0000000..e13f407 --- /dev/null +++ b/src/models/journey_list_item.rs @@ -0,0 +1,91 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyListItem : Summary journey representation returned by the list endpoint. Excludes description, nodes, early-exit configuration, and concurrency_key. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyListItem { + /// Journey UUID. Read-only. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// UUID of the app the journey belongs to. Read-only. + #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")] + pub app_id: Option, + /// Journey name, up to 300 characters. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// 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. + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, + /// ISO 8601 creation time. Read-only. + #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")] + pub created_at: Option, + /// ISO 8601 last-update time. Read-only. + #[serde(rename = "updated_at", skip_serializing_if = "Option::is_none")] + pub updated_at: Option, + /// ISO 8601 time the journey was activated, or null. Read-only. + #[serde(rename = "started_at", skip_serializing_if = "Option::is_none")] + pub started_at: Option, + /// ISO 8601 time the journey was archived, or null. Read-only. + #[serde(rename = "archived_at", skip_serializing_if = "Option::is_none")] + pub archived_at: Option, + /// Origin of the journey, for example public_api or dashboard. Read-only. + #[serde(rename = "created_source", skip_serializing_if = "Option::is_none")] + pub created_source: Option, + #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")] + pub schedule: Option>, + #[serde(rename = "audience", skip_serializing_if = "Option::is_none")] + pub audience: Option>, + #[serde(rename = "reentry_rules", skip_serializing_if = "Option::is_none")] + pub reentry_rules: Option>, +} + +impl JourneyListItem { + /// Summary journey representation returned by the list endpoint. Excludes description, nodes, early-exit configuration, and concurrency_key. + pub fn new() -> JourneyListItem { + JourneyListItem { + id: None, + app_id: None, + name: None, + state: None, + created_at: None, + updated_at: None, + started_at: None, + archived_at: None, + created_source: None, + schedule: None, + audience: None, + reentry_rules: None, + } + } +} + +/// 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. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum StateType { + #[serde(rename = "draft")] + Draft, + #[serde(rename = "scheduled")] + Scheduled, + #[serde(rename = "processing")] + Processing, + #[serde(rename = "active")] + Active, + #[serde(rename = "archived")] + Archived, +} + +impl Default for StateType { + fn default() -> StateType { + Self::Draft + } +} + diff --git a/src/models/journey_list_response.rs b/src/models/journey_list_response.rs new file mode 100644 index 0000000..bd42beb --- /dev/null +++ b/src/models/journey_list_response.rs @@ -0,0 +1,36 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyListResponse { + /// Journeys ordered by creation time, newest first. + #[serde(rename = "journeys", skip_serializing_if = "Option::is_none")] + pub journeys: Option>, + /// true if more journeys exist beyond this page. + #[serde(rename = "has_more", skip_serializing_if = "Option::is_none")] + pub has_more: Option, + /// Cursor for the next page. Present only when has_more is true. + #[serde(rename = "next_cursor", skip_serializing_if = "Option::is_none")] + pub next_cursor: Option, +} + +impl JourneyListResponse { + pub fn new() -> JourneyListResponse { + JourneyListResponse { + journeys: None, + has_more: None, + next_cursor: None, + } + } +} + + diff --git a/src/models/journey_message_stats.rs b/src/models/journey_message_stats.rs new file mode 100644 index 0000000..9a29dd8 --- /dev/null +++ b/src/models/journey_message_stats.rs @@ -0,0 +1,30 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyMessageStats : Delivery stats for a message-sending node. Present only on send_push, send_email, send_sms, send_iam, and send_webhook nodes. The keys inside totals depend on the node's channel. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyMessageStats { + /// All-time totals for this node, keyed by channel-specific stat name. + #[serde(rename = "totals", skip_serializing_if = "Option::is_none")] + pub totals: Option<::std::collections::HashMap>, +} + +impl JourneyMessageStats { + /// Delivery stats for a message-sending node. Present only on send_push, send_email, send_sms, send_iam, and send_webhook nodes. The keys inside totals depend on the node's channel. + pub fn new() -> JourneyMessageStats { + JourneyMessageStats { + totals: None, + } + } +} + + diff --git a/src/models/journey_node.rs b/src/models/journey_node.rs new file mode 100644 index 0000000..400f1fd --- /dev/null +++ b/src/models/journey_node.rs @@ -0,0 +1,139 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyNode : A journey node. The kind field selects which other fields apply. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyNode { + /// Server-assigned node UUID. Returned on reads. Required on update to keep an existing node. Rejected on create with a 400 validation error. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Node kind. Selects which other fields apply. + #[serde(rename = "kind")] + pub kind: KindType, + /// 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. + #[serde(rename = "client_node_id", skip_serializing_if = "Option::is_none")] + pub client_node_id: Option, + /// Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + #[serde(rename = "annotation", skip_serializing_if = "Option::is_none")] + pub annotation: Option, + /// wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + #[serde(rename = "duration_seconds", skip_serializing_if = "Option::is_none")] + pub duration_seconds: Option, + /// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + #[serde(rename = "relative_to", skip_serializing_if = "Option::is_none")] + pub relative_to: Option, + /// 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. + #[serde(rename = "windows", skip_serializing_if = "Option::is_none")] + pub windows: Option>, + /// time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + #[serde(rename = "time_zone", skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + /// time_window nodes: when true, uses the user's timezone if available. + #[serde(rename = "use_user_time_zone", skip_serializing_if = "Option::is_none")] + pub use_user_time_zone: Option, + /// send_push, send_email, and send_sms nodes: UUID of the template to send. + #[serde(rename = "template_id", skip_serializing_if = "Option::is_none")] + pub template_id: Option, + /// send_iam nodes: UUID of the in-app message to send. + #[serde(rename = "iam_id", skip_serializing_if = "Option::is_none")] + pub iam_id: Option, + /// send_iam nodes: optional time-to-live for the in-app message, in seconds. + #[serde(rename = "user_ttl_seconds", skip_serializing_if = "Option::is_none")] + pub user_ttl_seconds: Option, + /// send_webhook nodes: UUID of the webhook to send. + #[serde(rename = "webhook_id", skip_serializing_if = "Option::is_none")] + pub webhook_id: Option, + /// 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. + #[serde(rename = "assignments", skip_serializing_if = "Option::is_none")] + pub assignments: Option<::std::collections::HashMap>, + /// split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + #[serde(rename = "randomize_on_entry", skip_serializing_if = "Option::is_none")] + pub randomize_on_entry: Option, + /// 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. + #[serde(rename = "branches", skip_serializing_if = "Option::is_none")] + pub branches: Option>, + #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")] + pub expiration: Option>, +} + +impl JourneyNode { + /// A journey node. The kind field selects which other fields apply. Branching nodes (split_range, yes_no, wait_until) nest their sub-graphs inline via branches[].nodes. + pub fn new(kind: KindType) -> JourneyNode { + JourneyNode { + id: None, + kind, + client_node_id: None, + annotation: None, + duration_seconds: None, + relative_to: None, + windows: None, + time_zone: None, + use_user_time_zone: None, + template_id: None, + iam_id: None, + user_ttl_seconds: None, + webhook_id: None, + assignments: None, + randomize_on_entry: None, + branches: None, + expiration: None, + } + } +} + +/// Node kind. Selects which other fields apply. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum KindType { + #[serde(rename = "wait")] + Wait, + #[serde(rename = "time_window")] + TimeWindow, + #[serde(rename = "send_push")] + SendPush, + #[serde(rename = "send_email")] + SendEmail, + #[serde(rename = "send_sms")] + SendSms, + #[serde(rename = "send_iam")] + SendIam, + #[serde(rename = "send_webhook")] + SendWebhook, + #[serde(rename = "tag")] + Tag, + #[serde(rename = "split_range")] + SplitRange, + #[serde(rename = "yes_no")] + YesNo, + #[serde(rename = "wait_until")] + WaitUntil, +} + +impl Default for KindType { + fn default() -> KindType { + Self::Wait + } +} +/// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum RelativeToType { + #[serde(rename = "schedule_in_timezone")] + ScheduleInTimezone, + #[serde(rename = "last_active_time")] + LastActiveTime, +} + +impl Default for RelativeToType { + fn default() -> RelativeToType { + Self::ScheduleInTimezone + } +} + diff --git a/src/models/journey_node_stats.rs b/src/models/journey_node_stats.rs new file mode 100644 index 0000000..203154d --- /dev/null +++ b/src/models/journey_node_stats.rs @@ -0,0 +1,77 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyNodeStats : Stats for a single node. Keyed in the response by the node's server-assigned id. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyNodeStats { + /// Node kind, repeated here so stats can be read without joining against the journey definition. + #[serde(rename = "kind", skip_serializing_if = "Option::is_none")] + pub kind: Option, + /// Users currently held at this node. + #[serde(rename = "waiting", skip_serializing_if = "Option::is_none")] + pub waiting: Option, + /// Users who advanced past this node normally. + #[serde(rename = "completed", skip_serializing_if = "Option::is_none")] + pub completed: Option, + /// Users who left the journey from this node through an early exit rule. + #[serde(rename = "exited_early", skip_serializing_if = "Option::is_none")] + pub exited_early: Option, + #[serde(rename = "message_stats", skip_serializing_if = "Option::is_none")] + pub message_stats: Option>, +} + +impl JourneyNodeStats { + /// Stats for a single node. Keyed in the response by the node's server-assigned id. + pub fn new() -> JourneyNodeStats { + JourneyNodeStats { + kind: None, + waiting: None, + completed: None, + exited_early: None, + message_stats: None, + } + } +} + +/// Node kind, repeated here so stats can be read without joining against the journey definition. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum KindType { + #[serde(rename = "wait")] + Wait, + #[serde(rename = "time_window")] + TimeWindow, + #[serde(rename = "send_push")] + SendPush, + #[serde(rename = "send_email")] + SendEmail, + #[serde(rename = "send_sms")] + SendSms, + #[serde(rename = "send_iam")] + SendIam, + #[serde(rename = "send_webhook")] + SendWebhook, + #[serde(rename = "tag")] + Tag, + #[serde(rename = "split_range")] + SplitRange, + #[serde(rename = "yes_no")] + YesNo, + #[serde(rename = "wait_until")] + WaitUntil, +} + +impl Default for KindType { + fn default() -> KindType { + Self::Wait + } +} + diff --git a/src/models/journey_reentry_rules.rs b/src/models/journey_reentry_rules.rs new file mode 100644 index 0000000..f950513 --- /dev/null +++ b/src/models/journey_reentry_rules.rs @@ -0,0 +1,30 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyReentryRules : Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyReentryRules { + /// Minimum seconds before a user can re-enter. Must be at least 600 (10 minutes). + #[serde(rename = "duration_seconds", skip_serializing_if = "Option::is_none")] + pub duration_seconds: Option, +} + +impl JourneyReentryRules { + /// Controls whether and how soon a user can re-enter the journey. null means re-entry is not allowed. + pub fn new() -> JourneyReentryRules { + JourneyReentryRules { + duration_seconds: None, + } + } +} + + diff --git a/src/models/journey_schedule.rs b/src/models/journey_schedule.rs new file mode 100644 index 0000000..3296208 --- /dev/null +++ b/src/models/journey_schedule.rs @@ -0,0 +1,38 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneySchedule : Optional future start and/or stop time. null means no scheduled activation. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneySchedule { + /// ISO 8601 start time. Use UTC (Z or +00:00). Must be at least 5 minutes in the future. + #[serde(rename = "start_at", skip_serializing_if = "Option::is_none")] + pub start_at: Option, + /// ISO 8601 stop time. Use UTC (Z or +00:00). Must be in the future and later than start_at. + #[serde(rename = "stop_at", skip_serializing_if = "Option::is_none")] + pub stop_at: Option, + /// Read-only. Present when a scheduling error occurred. + #[serde(rename = "error", skip_serializing_if = "Option::is_none")] + pub error: Option, +} + +impl JourneySchedule { + /// Optional future start and/or stop time. null means no scheduled activation. + pub fn new() -> JourneySchedule { + JourneySchedule { + start_at: None, + stop_at: None, + error: None, + } + } +} + + diff --git a/src/models/journey_stats.rs b/src/models/journey_stats.rs new file mode 100644 index 0000000..015577c --- /dev/null +++ b/src/models/journey_stats.rs @@ -0,0 +1,50 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyStats : Journey-level counts plus flat, id-keyed maps of node and branch stats. Contains no definition detail; join it by id against the journey from View journey. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyStats { + /// UUID of the journey these stats belong to. + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + /// Users who entered the journey. + #[serde(rename = "started", skip_serializing_if = "Option::is_none")] + pub started: Option, + /// Users who reached the end of the journey normally. + #[serde(rename = "completed", skip_serializing_if = "Option::is_none")] + pub completed: Option, + /// Users who left the journey through an early exit rule. + #[serde(rename = "exited_early", skip_serializing_if = "Option::is_none")] + pub exited_early: Option, + /// Node stats keyed by node id. Includes every node in the graph, at any nesting depth. + #[serde(rename = "nodes", skip_serializing_if = "Option::is_none")] + pub nodes: Option<::std::collections::HashMap>, + /// Branch stats keyed by branch id. Empty for a journey with no branching nodes. + #[serde(rename = "branches", skip_serializing_if = "Option::is_none")] + pub branches: Option<::std::collections::HashMap>, +} + +impl JourneyStats { + /// Journey-level counts plus flat, id-keyed maps of node and branch stats. Contains no definition detail; join it by id against the journey from View journey. + pub fn new() -> JourneyStats { + JourneyStats { + id: None, + started: None, + completed: None, + exited_early: None, + nodes: None, + branches: None, + } + } +} + + diff --git a/src/models/journey_time_point.rs b/src/models/journey_time_point.rs new file mode 100644 index 0000000..0517711 --- /dev/null +++ b/src/models/journey_time_point.rs @@ -0,0 +1,32 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyTimePoint { + /// Hour of day, 0-23. + #[serde(rename = "hour", skip_serializing_if = "Option::is_none")] + pub hour: Option, + /// Minute of hour, 0-59. Defaults to 0. + #[serde(rename = "minute", skip_serializing_if = "Option::is_none")] + pub minute: Option, +} + +impl JourneyTimePoint { + pub fn new() -> JourneyTimePoint { + JourneyTimePoint { + hour: None, + minute: None, + } + } +} + + diff --git a/src/models/journey_time_window.rs b/src/models/journey_time_window.rs new file mode 100644 index 0000000..5373c41 --- /dev/null +++ b/src/models/journey_time_window.rs @@ -0,0 +1,38 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyTimeWindow : A wall-clock window. Each window must span at least 15 minutes. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyTimeWindow { + /// When the window opens. + #[serde(rename = "start", skip_serializing_if = "Option::is_none")] + pub start: Option>, + /// When the window closes. + #[serde(rename = "end", skip_serializing_if = "Option::is_none")] + pub end: Option>, + /// Day of week, 1 = Monday. Omit to apply the window to every day. + #[serde(rename = "day_of_week", skip_serializing_if = "Option::is_none")] + pub day_of_week: Option, +} + +impl JourneyTimeWindow { + /// A wall-clock window. Each window must span at least 15 minutes. + pub fn new() -> JourneyTimeWindow { + JourneyTimeWindow { + start: None, + end: None, + day_of_week: None, + } + } +} + + diff --git a/src/models/journey_wait_until_expiration.rs b/src/models/journey_wait_until_expiration.rs new file mode 100644 index 0000000..a05c3ba --- /dev/null +++ b/src/models/journey_wait_until_expiration.rs @@ -0,0 +1,34 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// JourneyWaitUntilExpiration : Optional expiration timer. null waits indefinitely. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct JourneyWaitUntilExpiration { + /// Seconds to wait before the timer fires. Minimum 60, maximum 31556952 (1 year). + #[serde(rename = "duration_seconds", skip_serializing_if = "Option::is_none")] + pub duration_seconds: Option, + /// When true, the user exits the journey when the timer fires; when false, the user continues to convergence. + #[serde(rename = "exits", skip_serializing_if = "Option::is_none")] + pub exits: Option, +} + +impl JourneyWaitUntilExpiration { + /// Optional expiration timer. null waits indefinitely. + pub fn new() -> JourneyWaitUntilExpiration { + JourneyWaitUntilExpiration { + duration_seconds: None, + exits: None, + } + } +} + + diff --git a/src/models/mod.rs b/src/models/mod.rs index bec6ea8..b1d07e5 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -26,6 +26,8 @@ pub mod create_api_key_request; pub use self::create_api_key_request::CreateApiKeyRequest; pub mod create_api_key_response; pub use self::create_api_key_response::CreateApiKeyResponse; +pub mod create_journey_request; +pub use self::create_journey_request::CreateJourneyRequest; pub mod create_notification_success_response; pub use self::create_notification_success_response::CreateNotificationSuccessResponse; pub mod create_segment_conflict_response; @@ -66,6 +68,50 @@ pub mod get_segment_success_response; pub use self::get_segment_success_response::GetSegmentSuccessResponse; pub mod get_segments_success_response; pub use self::get_segments_success_response::GetSegmentsSuccessResponse; +pub mod journey; +pub use self::journey::Journey; +pub mod journey_audience; +pub use self::journey_audience::JourneyAudience; +pub mod journey_branch; +pub use self::journey_branch::JourneyBranch; +pub mod journey_branch_stats; +pub use self::journey_branch_stats::JourneyBranchStats; +pub mod journey_condition; +pub use self::journey_condition::JourneyCondition; +pub mod journey_early_exit; +pub use self::journey_early_exit::JourneyEarlyExit; +pub mod journey_early_exit_rules; +pub use self::journey_early_exit_rules::JourneyEarlyExitRules; +pub mod journey_early_exit_rules_on_event; +pub use self::journey_early_exit_rules_on_event::JourneyEarlyExitRulesOnEvent; +pub mod journey_early_exit_rules_on_segment; +pub use self::journey_early_exit_rules_on_segment::JourneyEarlyExitRulesOnSegment; +pub mod journey_event_attribute; +pub use self::journey_event_attribute::JourneyEventAttribute; +pub mod journey_list_audience; +pub use self::journey_list_audience::JourneyListAudience; +pub mod journey_list_item; +pub use self::journey_list_item::JourneyListItem; +pub mod journey_list_response; +pub use self::journey_list_response::JourneyListResponse; +pub mod journey_message_stats; +pub use self::journey_message_stats::JourneyMessageStats; +pub mod journey_node; +pub use self::journey_node::JourneyNode; +pub mod journey_node_stats; +pub use self::journey_node_stats::JourneyNodeStats; +pub mod journey_reentry_rules; +pub use self::journey_reentry_rules::JourneyReentryRules; +pub mod journey_schedule; +pub use self::journey_schedule::JourneySchedule; +pub mod journey_stats; +pub use self::journey_stats::JourneyStats; +pub mod journey_time_point; +pub use self::journey_time_point::JourneyTimePoint; +pub mod journey_time_window; +pub use self::journey_time_window::JourneyTimeWindow; +pub mod journey_wait_until_expiration; +pub use self::journey_wait_until_expiration::JourneyWaitUntilExpiration; pub mod language_string_map; pub use self::language_string_map::LanguageStringMap; pub mod list_audit_logs_success_response; @@ -132,6 +178,10 @@ pub mod transfer_subscription_request_body; pub use self::transfer_subscription_request_body::TransferSubscriptionRequestBody; pub mod update_api_key_request; pub use self::update_api_key_request::UpdateApiKeyRequest; +pub mod update_journey_node_request; +pub use self::update_journey_node_request::UpdateJourneyNodeRequest; +pub mod update_journey_request; +pub use self::update_journey_request::UpdateJourneyRequest; pub mod update_live_activity_request; pub use self::update_live_activity_request::UpdateLiveActivityRequest; pub mod update_live_activity_success_response; diff --git a/src/models/update_journey_node_request.rs b/src/models/update_journey_node_request.rs new file mode 100644 index 0000000..c6c0e54 --- /dev/null +++ b/src/models/update_journey_node_request.rs @@ -0,0 +1,103 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// UpdateJourneyNodeRequest : Node fields to change, merged onto the current node. Send only the fields you want to change. The node's kind and id cannot be changed. Send null to clear a nullable field. Which other fields apply depends on the node's kind, matching JourneyNode. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct UpdateJourneyNodeRequest { + /// 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. + #[serde(rename = "client_node_id", skip_serializing_if = "Option::is_none")] + pub client_node_id: Option, + /// Optional free-text label, up to 255 characters. Stored and returned as-is with no effect on journey behavior. + #[serde(rename = "annotation", skip_serializing_if = "Option::is_none")] + pub annotation: Option, + /// wait nodes: seconds to hold the user. Minimum 60, maximum 31556952 (1 year). + #[serde(rename = "duration_seconds", skip_serializing_if = "Option::is_none")] + pub duration_seconds: Option, + /// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. + #[serde(rename = "relative_to", skip_serializing_if = "Option::is_none")] + pub relative_to: Option, + /// 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. + #[serde(rename = "windows", skip_serializing_if = "Option::is_none")] + pub windows: Option>, + /// time_window nodes: IANA timezone identifier used when the user's timezone is unavailable. + #[serde(rename = "time_zone", skip_serializing_if = "Option::is_none")] + pub time_zone: Option, + /// time_window nodes: when true, uses the user's timezone if available. + #[serde(rename = "use_user_time_zone", skip_serializing_if = "Option::is_none")] + pub use_user_time_zone: Option, + /// send_push, send_email, and send_sms nodes: UUID of the template to send. + #[serde(rename = "template_id", skip_serializing_if = "Option::is_none")] + pub template_id: Option, + /// send_iam nodes: UUID of the in-app message to send. + #[serde(rename = "iam_id", skip_serializing_if = "Option::is_none")] + pub iam_id: Option, + /// send_iam nodes: optional time-to-live for the in-app message, in seconds. + #[serde(rename = "user_ttl_seconds", skip_serializing_if = "Option::is_none")] + pub user_ttl_seconds: Option, + /// send_webhook nodes: UUID of the webhook to send. + #[serde(rename = "webhook_id", skip_serializing_if = "Option::is_none")] + pub webhook_id: Option, + /// 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. + #[serde(rename = "assignments", skip_serializing_if = "Option::is_none")] + pub assignments: Option<::std::collections::HashMap>, + /// split_range nodes: when true, assigns each user to a branch at random on entry. Defaults to false. + #[serde(rename = "randomize_on_entry", skip_serializing_if = "Option::is_none")] + pub randomize_on_entry: Option, + /// 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. + #[serde(rename = "branches", skip_serializing_if = "Option::is_none")] + pub branches: Option>, + #[serde(rename = "expiration", skip_serializing_if = "Option::is_none")] + pub expiration: Option>, + /// 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. + #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")] + pub concurrency_key: Option, +} + +impl UpdateJourneyNodeRequest { + /// Node fields to change, merged onto the current node. Send only the fields you want to change. The node's kind and id cannot be changed. Send null to clear a nullable field. Which other fields apply depends on the node's kind, matching JourneyNode. + pub fn new() -> UpdateJourneyNodeRequest { + UpdateJourneyNodeRequest { + client_node_id: None, + annotation: None, + duration_seconds: None, + relative_to: None, + windows: None, + time_zone: None, + use_user_time_zone: None, + template_id: None, + iam_id: None, + user_ttl_seconds: None, + webhook_id: None, + assignments: None, + randomize_on_entry: None, + branches: None, + expiration: None, + concurrency_key: None, + } + } +} + +/// time_window nodes: schedule_in_timezone uses the configured windows; last_active_time holds relative to the user's last active time. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum RelativeToType { + #[serde(rename = "schedule_in_timezone")] + ScheduleInTimezone, + #[serde(rename = "last_active_time")] + LastActiveTime, +} + +impl Default for RelativeToType { + fn default() -> RelativeToType { + Self::ScheduleInTimezone + } +} + diff --git a/src/models/update_journey_request.rs b/src/models/update_journey_request.rs new file mode 100644 index 0000000..2b8ce12 --- /dev/null +++ b/src/models/update_journey_request.rs @@ -0,0 +1,76 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://openapi-generator.tech + */ + +/// UpdateJourneyRequest : Partial update applied with JSON Merge Patch (RFC 7396). Send only the fields you want to change. A null value clears a nullable field. Arrays such as nodes are replaced wholesale. + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct UpdateJourneyRequest { + /// Journey name. + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] + pub name: Option, + /// Journey description. Send null to clear it. + #[serde(rename = "description", skip_serializing_if = "Option::is_none")] + pub description: Option, + #[serde(rename = "audience", skip_serializing_if = "Option::is_none")] + pub audience: Option>, + #[serde(rename = "early_exit", skip_serializing_if = "Option::is_none")] + pub early_exit: Option>, + #[serde(rename = "reentry_rules", skip_serializing_if = "Option::is_none")] + pub reentry_rules: Option>, + #[serde(rename = "schedule", skip_serializing_if = "Option::is_none")] + pub schedule: Option>, + /// 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. + #[serde(rename = "nodes", skip_serializing_if = "Option::is_none")] + pub nodes: Option>, + /// 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. + #[serde(rename = "state", skip_serializing_if = "Option::is_none")] + pub state: Option, + /// 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. + #[serde(rename = "concurrency_key", skip_serializing_if = "Option::is_none")] + pub concurrency_key: Option, +} + +impl UpdateJourneyRequest { + /// Partial update applied with JSON Merge Patch (RFC 7396). Send only the fields you want to change. A null value clears a nullable field. Arrays such as nodes are replaced wholesale. + pub fn new() -> UpdateJourneyRequest { + UpdateJourneyRequest { + name: None, + description: None, + audience: None, + early_exit: None, + reentry_rules: None, + schedule: None, + nodes: None, + state: None, + concurrency_key: None, + } + } +} + +/// 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. +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum StateType { + #[serde(rename = "draft")] + Draft, + #[serde(rename = "scheduled")] + Scheduled, + #[serde(rename = "active")] + Active, + #[serde(rename = "archived")] + Archived, +} + +impl Default for StateType { + fn default() -> StateType { + Self::Draft + } +} +