From ba024935b12413d6fd04c03888bee20c1766f3b2 Mon Sep 17 00:00:00 2001 From: OneSignal Date: Mon, 31 Aug 2026 23:12:25 +0000 Subject: [PATCH] feat: add v5.15.0 package updates --- README.md | 6 +- api/openapi.yaml | 147 +++++- build.gradle | 2 +- build.sbt | 2 +- docs/BasicNotification.md | 2 +- docs/DefaultApi.md | 74 +++ docs/EstimateNotificationRecipientsRequest.md | 29 ++ ...imateNotificationRecipientsRequestAllOf.md | 26 ++ ...teNotificationRecipientsSuccessResponse.md | 17 + docs/Notification.md | 2 +- docs/NotificationTarget.md | 2 +- docs/NotificationWithMeta.md | 2 +- docs/SegmentNotificationTarget.md | 2 +- pom.xml | 2 +- .../java/com/onesignal/client/ApiClient.java | 2 +- src/main/java/com/onesignal/client/JSON.java | 3 + .../com/onesignal/client/api/DefaultApi.java | 251 +++++++--- .../client/model/BasicNotification.java | 4 +- ...EstimateNotificationRecipientsRequest.java | 436 ++++++++++++++++++ ...ateNotificationRecipientsRequestAllOf.java | 356 ++++++++++++++ ...NotificationRecipientsSuccessResponse.java | 316 +++++++++++++ .../onesignal/client/model/Notification.java | 4 +- .../client/model/NotificationWithMeta.java | 4 +- .../model/SegmentNotificationTarget.java | 4 +- 24 files changed, 1619 insertions(+), 76 deletions(-) create mode 100644 docs/EstimateNotificationRecipientsRequest.md create mode 100644 docs/EstimateNotificationRecipientsRequestAllOf.md create mode 100644 docs/EstimateNotificationRecipientsSuccessResponse.md create mode 100644 src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequest.java create mode 100644 src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequestAllOf.java create mode 100644 src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsSuccessResponse.java diff --git a/README.md b/README.md index 9bce7ed1..63a5e6bf 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ > **Building with an AI agent or LLM?** See [AGENTS.md](https://github.com/OneSignal/onesignal-java-api/blob/main/AGENTS.md) for an agent-oriented integration guide — authentication, calling conventions, idempotent retries, and the full API reference. OneSignal -- API version: 5.14.0 +- API version: 5.15.0 A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com @@ -21,14 +21,14 @@ Building the API client library requires: com.onesignal onesignal-java-client - 5.14.0 + 5.15.0 ``` ### Gradle ```groovy -implementation "com.onesignal:onesignal-java-client:5.14.0" +implementation "com.onesignal:onesignal-java-client:5.15.0" ``` ## Configuration diff --git a/api/openapi.yaml b/api/openapi.yaml index e0dc964f..a47ba1ca 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -8,7 +8,7 @@ info: customer engagement strategies. Learn more at onesignal.com termsOfService: https://onesignal.com/tos title: OneSignal - version: 5.14.0 + version: 5.15.0 servers: - url: https://api.onesignal.com paths: @@ -2255,6 +2255,57 @@ paths: - rest_api_key: [] summary: Export CSV of Events x-accepts: application/json + /notifications/count-unsaved: + post: + description: "Returns the estimated number of recipients for a notification's\ + \ targeting, without creating or sending anything.\nThe returned `count` reflects\ + \ the same audience-size estimate you would see under \"Choose your target\ + \ audience\" when composing a message. It is based on the user targeting method\ + \ you've set and the specific platforms the message is targeted to send to.\n\ + This endpoint only supports a subset of targeting parameters: `included_segments`\ + \ is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`,\ + \ `filters`, `include_aliases`, and `target_channel` narrow that audience\ + \ further. Use `target_channel` to select platforms. `include_subscription_ids`\ + \ and the other raw subscription id/token fields, and the individual `isIos`\ + \ / `isAndroid` / etc. platform flags, are not supported. All other notification\ + \ fields (content, delivery options, and so on) are accepted, but ignored.\n" + operationId: estimate_notification_recipients + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EstimateNotificationRecipientsRequest' + required: true + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: Unexpected error + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EstimateNotificationRecipientsSuccessResponse' + description: OK + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/GenericError' + description: Bad Request + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/RateLimitError' + description: Rate Limit Exceeded + security: + - rest_api_key: [] + summary: Estimate notification recipients + x-content-type: application/json + x-accepts: application/json /templates: get: description: List templates for an app. @@ -3728,7 +3779,9 @@ components: description: "The segment names you want to target. Users in these segments\ \ will receive a notification. This targeting parameter is only compatible\ \ with excluded_segments.\nExample: [\"Active Users\", \"Inactive Users\"\ - ]\n" + ]\n`\"All\"` is a shorthand for every subscribed user: if the array includes\ + \ the string `\"All\"` and the app has no segment actually named `All`,\ + \ it targets all subscribers instead of a literal segment lookup.\n" items: type: string type: array @@ -5046,6 +5099,55 @@ components: \ be 200 with partial success. Typed SDKs model this loosely so both shapes\ \ deserialize." type: object + EstimateNotificationRecipientsRequest: + allOf: + - $ref: '#/components/schemas/SegmentNotificationTarget' + - $ref: '#/components/schemas/EstimateNotificationRecipientsRequest_allOf' + - required: + - app_id + description: "The targeting subset of notification fields this endpoint honors.\ + \ `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`,\ + \ `filters`, `include_aliases`, and `target_channel` narrow that segment-based\ + \ audience further when present. Use `target_channel` to select which platforms\ + \ to count. Other notification targeting fields (`include_subscription_ids`\ + \ and the other raw subscription id/token fields, and the individual `isIos`\ + \ / `isAndroid` / etc. platform flags) are not read by this endpoint. All\ + \ non-targeting notification fields (content, delivery options, and so on)\ + \ are accepted, but ignored.\n" + EstimateNotificationRecipientsSuccessResponse: + example: + mobile_suppressed: true + uncapped_count: 6 + count: 0 + mobile_excluded_count: 1 + cap_applied: true + properties: + count: + description: "The estimated audience size based on the user targeting method\ + \ you've set on the message, and the specific platforms the message is\ + \ targeted to send to." + type: integer + uncapped_count: + description: The estimated audience size before the plan's web push subscriber + cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. + nullable: true + type: integer + cap_applied: + description: Whether `count` was reduced because the app is on a plan that + caps the number of web push subscribers it can send to. + type: boolean + mobile_suppressed: + description: The mobile equivalent of `cap_applied`. Whether mobile push + deliveries will be dropped for this send because the org is over its plan's + mobile push subscriber cap. `false` when the notification doesn't target + any mobile push platforms. + type: boolean + mobile_excluded_count: + description: How many mobile push recipients the `count` excludes due to + the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is + `false`. + type: integer + type: object GenericSuccessBoolResponse: example: success: true @@ -9131,6 +9233,47 @@ components: unsubscribe link in this email. nullable: true type: integer + EstimateNotificationRecipientsRequest_allOf: + properties: + app_id: + description: "The OneSignal App ID for your app, which can be found in Keys\ + \ & IDs." + type: string + filters: + items: + $ref: '#/components/schemas/FilterExpression' + nullable: true + type: array + include_aliases: + additionalProperties: + items: + type: string + type: array + description: "Target specific users by aliases assigned via API. An alias\ + \ can be an external_id, onesignal_id, or a custom alias.\nAccepts an\ + \ object where keys are alias labels and values are arrays of alias IDs\ + \ to include\nExample usage: { \"external_id\": [\"exId1\", \"extId2\"\ + ], \"internal_label\": [\"id1\", \"id2\"] }\nKeys must match API spellings\ + \ exactly (for example the label for External ID is the string `external_id`;\ + \ arbitrary keys such as camelCase variants are not aliases and may yield\ + \ no recipients).\nNot compatible with any other targeting parameters.\n\ + REQUIRED: REST API Key Authentication\nLimit of 2,000 entries per REST\ + \ API call\nNote: If targeting push, email, or sms subscribers with same\ + \ ids, use with target_channel to indicate you are sending a push or email\ + \ or sms." + nullable: true + type: object + target_channel: + description: "Which platforms to count recipients for. Selects the same\ + \ default platforms Create notification would use for the channel. Individual\ + \ platform flags (`isIos`, `isAndroid`, etc.) are not supported by this\ + \ endpoint." + enum: + - push + - email + - sms + type: string + type: object CreateUserConflictResponse_errorsItems_meta: properties: conflicting_aliases: diff --git a/build.gradle b/build.gradle index b756aece..fc69ede1 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'com.diffplug.spotless' apply plugin: 'com.vanniktech.maven.publish' group = 'com.onesignal' -version = '5.14.0' +version = '5.15.0' buildscript { repositories { diff --git a/build.sbt b/build.sbt index 5917c235..7cc26bd2 100644 --- a/build.sbt +++ b/build.sbt @@ -2,7 +2,7 @@ lazy val root = (project in file(".")). settings( organization := "com.onesignal", name := "onesignal-java-client", - version := "5.14.0", + version := "5.15.0", scalaVersion := "2.11.4", scalacOptions ++= Seq("-feature"), javacOptions in compile ++= Seq("-Xlint:deprecation"), diff --git a/docs/BasicNotification.md b/docs/BasicNotification.md index e3ba1eaf..d9bfd065 100644 --- a/docs/BasicNotification.md +++ b/docs/BasicNotification.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | |**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | |**includeSubscriptionIds** | **List<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | |**includeEmailTokens** | **List<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] | diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md index 13000b61..ff73cef3 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -24,6 +24,7 @@ All URIs are relative to *https://api.onesignal.com* | [**deleteSubscription**](DefaultApi.md#deleteSubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | | | [**deleteTemplate**](DefaultApi.md#deleteTemplate) | **DELETE** /templates/{template_id} | Delete template | | [**deleteUser**](DefaultApi.md#deleteUser) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | | +| [**estimateNotificationRecipients**](DefaultApi.md#estimateNotificationRecipients) | **POST** /notifications/count-unsaved | Estimate notification recipients | | [**exportEvents**](DefaultApi.md#exportEvents) | **POST** /notifications/{notification_id}/export_events | Export CSV of Events | | [**exportSubscriptions**](DefaultApi.md#exportSubscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions | | [**getAliases**](DefaultApi.md#getAliases) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | | @@ -1729,6 +1730,79 @@ null (empty response body) | **429** | Rate Limit Exceeded | - | | **0** | Unexpected error | - | + +# **estimateNotificationRecipients** +> EstimateNotificationRecipientsSuccessResponse estimateNotificationRecipients(estimateNotificationRecipientsRequest) + +Estimate notification recipients + +Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored. + +### Example +```java +// Import classes: +import com.onesignal.client.ApiClient; +import com.onesignal.client.ApiException; +import com.onesignal.client.Configuration; +import com.onesignal.client.auth.*; +import com.onesignal.client.model.*; +import com.onesignal.client.api.DefaultApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("https://api.onesignal.com"); + + // Configure HTTP bearer authorization: rest_api_key + HttpBearerAuth rest_api_key = (HttpBearerAuth) defaultClient.getAuthentication("rest_api_key"); + rest_api_key.setBearerToken("YOUR_REST_API_KEY"); + + DefaultApi apiInstance = new DefaultApi(defaultClient); + EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest = new EstimateNotificationRecipientsRequest(); // EstimateNotificationRecipientsRequest | + try { + EstimateNotificationRecipientsSuccessResponse result = apiInstance.estimateNotificationRecipients(estimateNotificationRecipientsRequest); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling DefaultApi#estimateNotificationRecipients"); + System.err.println("Status code: " + e.getCode()); + // getErrorMessages() flattens any error-envelope shape to a List; + // the raw body remains on getResponseBody(). + System.err.println("Error messages: " + e.getErrorMessages()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------------- | ------------- | ------------- | -------------| +| **estimateNotificationRecipientsRequest** | [**EstimateNotificationRecipientsRequest**](EstimateNotificationRecipientsRequest.md)| | | + +### Return type + +[**EstimateNotificationRecipientsSuccessResponse**](EstimateNotificationRecipientsSuccessResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-java-api#configuration) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | +| **400** | Bad Request | - | +| **429** | Rate Limit Exceeded | - | +| **0** | Unexpected error | - | + # **exportEvents** > ExportEventsSuccessResponse exportEvents(notificationId, appId) diff --git a/docs/EstimateNotificationRecipientsRequest.md b/docs/EstimateNotificationRecipientsRequest.md new file mode 100644 index 00000000..6ca21579 --- /dev/null +++ b/docs/EstimateNotificationRecipientsRequest.md @@ -0,0 +1,29 @@ + + +# EstimateNotificationRecipientsRequest + +The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored. + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | +|**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**appId** | **String** | The OneSignal App ID for your app, which can be found in Keys & IDs. | | +|**filters** | [**List<FilterExpression>**](FilterExpression.md) | | [optional] | +|**includeAliases** | **Map<String, List<String>>** | Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. | [optional] | +|**targetChannel** | [**TargetChannelEnum**](#TargetChannelEnum) | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. | [optional] | + + + +## Enum: TargetChannelEnum + +| Name | Value | +|---- | -----| +| PUSH | "push" | +| EMAIL | "email" | +| SMS | "sms" | + + + diff --git a/docs/EstimateNotificationRecipientsRequestAllOf.md b/docs/EstimateNotificationRecipientsRequestAllOf.md new file mode 100644 index 00000000..086cc992 --- /dev/null +++ b/docs/EstimateNotificationRecipientsRequestAllOf.md @@ -0,0 +1,26 @@ + + +# EstimateNotificationRecipientsRequestAllOf + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**appId** | **String** | The OneSignal App ID for your app, which can be found in Keys & IDs. | [optional] | +|**filters** | [**List<FilterExpression>**](FilterExpression.md) | | [optional] | +|**includeAliases** | **Map<String, List<String>>** | Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. | [optional] | +|**targetChannel** | [**TargetChannelEnum**](#TargetChannelEnum) | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. | [optional] | + + + +## Enum: TargetChannelEnum + +| Name | Value | +|---- | -----| +| PUSH | "push" | +| EMAIL | "email" | +| SMS | "sms" | + + + diff --git a/docs/EstimateNotificationRecipientsSuccessResponse.md b/docs/EstimateNotificationRecipientsSuccessResponse.md new file mode 100644 index 00000000..1f0e5ff9 --- /dev/null +++ b/docs/EstimateNotificationRecipientsSuccessResponse.md @@ -0,0 +1,17 @@ + + +# EstimateNotificationRecipientsSuccessResponse + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**count** | **Integer** | The estimated audience size based on the user targeting method you've set on the message, and the specific platforms the message is targeted to send to. | [optional] | +|**uncappedCount** | **Integer** | The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. | [optional] | +|**capApplied** | **Boolean** | Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to. | [optional] | +|**mobileSuppressed** | **Boolean** | The mobile equivalent of `cap_applied`. Whether mobile push deliveries will be dropped for this send because the org is over its plan's mobile push subscriber cap. `false` when the notification doesn't target any mobile push platforms. | [optional] | +|**mobileExcludedCount** | **Integer** | How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. | [optional] | + + + diff --git a/docs/Notification.md b/docs/Notification.md index 49c003e9..24606e76 100644 --- a/docs/Notification.md +++ b/docs/Notification.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | |**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | |**includeSubscriptionIds** | **List<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | |**includeEmailTokens** | **List<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] | diff --git a/docs/NotificationTarget.md b/docs/NotificationTarget.md index db4e8cdd..f701356c 100644 --- a/docs/NotificationTarget.md +++ b/docs/NotificationTarget.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | |**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | |**includeSubscriptionIds** | **List<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | |**includeEmailTokens** | **List<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] | diff --git a/docs/NotificationWithMeta.md b/docs/NotificationWithMeta.md index 51b71def..f3890a3d 100644 --- a/docs/NotificationWithMeta.md +++ b/docs/NotificationWithMeta.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | |**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | |**includeSubscriptionIds** | **List<String>** | Specific subscription ids to send your notification to. _Does not require API Auth Key._ Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | |**includeEmailTokens** | **List<String>** | Deprecated alias for `email_to`. Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts. Limit of 2,000 entries per REST API call. Prefer `email_to` in new integrations. | [optional] | diff --git a/docs/SegmentNotificationTarget.md b/docs/SegmentNotificationTarget.md index 9fe33468..3b727630 100644 --- a/docs/SegmentNotificationTarget.md +++ b/docs/SegmentNotificationTarget.md @@ -7,7 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +|**includedSegments** | **List<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. | [optional] | |**excludedSegments** | **List<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | diff --git a/pom.xml b/pom.xml index f9f13405..f77aae35 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ onesignal-java-client jar onesignal-java-client - 5.14.0 + 5.15.0 https://github.com/OneSignal/onesignal-java-api OneSignal Java API Client diff --git a/src/main/java/com/onesignal/client/ApiClient.java b/src/main/java/com/onesignal/client/ApiClient.java index 9fc642a1..d4b66658 100644 --- a/src/main/java/com/onesignal/client/ApiClient.java +++ b/src/main/java/com/onesignal/client/ApiClient.java @@ -132,7 +132,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/5.14.0/java"); + setUserAgent("OpenAPI-Generator/5.15.0/java"); authentications = new HashMap(); } diff --git a/src/main/java/com/onesignal/client/JSON.java b/src/main/java/com/onesignal/client/JSON.java index 7755a66f..a519fca3 100644 --- a/src/main/java/com/onesignal/client/JSON.java +++ b/src/main/java/com/onesignal/client/JSON.java @@ -120,6 +120,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri .registerTypeAdapterFactory(new com.onesignal.client.model.EmailWarmUp.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new com.onesignal.client.model.EmailWarmUpRequest.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new com.onesignal.client.model.EmailWarmUpStage.CustomTypeAdapterFactory()) + .registerTypeAdapterFactory(new com.onesignal.client.model.EstimateNotificationRecipientsRequest.CustomTypeAdapterFactory()) + .registerTypeAdapterFactory(new com.onesignal.client.model.EstimateNotificationRecipientsRequestAllOf.CustomTypeAdapterFactory()) + .registerTypeAdapterFactory(new com.onesignal.client.model.EstimateNotificationRecipientsSuccessResponse.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new com.onesignal.client.model.ExportEventsSuccessResponse.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new com.onesignal.client.model.ExportSubscriptionsRequestBody.CustomTypeAdapterFactory()) .registerTypeAdapterFactory(new com.onesignal.client.model.ExportSubscriptionsSuccessResponse.CustomTypeAdapterFactory()) diff --git a/src/main/java/com/onesignal/client/api/DefaultApi.java b/src/main/java/com/onesignal/client/api/DefaultApi.java index 047163e3..12854639 100644 --- a/src/main/java/com/onesignal/client/api/DefaultApi.java +++ b/src/main/java/com/onesignal/client/api/DefaultApi.java @@ -38,6 +38,8 @@ import com.onesignal.client.model.CreateTemplateRequest; import com.onesignal.client.model.CreateUserConflictResponse; import com.onesignal.client.model.CustomEventsRequest; +import com.onesignal.client.model.EstimateNotificationRecipientsRequest; +import com.onesignal.client.model.EstimateNotificationRecipientsSuccessResponse; import com.onesignal.client.model.ExportEventsSuccessResponse; import com.onesignal.client.model.ExportSubscriptionsRequestBody; import com.onesignal.client.model.ExportSubscriptionsSuccessResponse; @@ -164,7 +166,7 @@ public okhttp3.Call cancelNotificationCall(String appId, String notificationId, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -322,7 +324,7 @@ public okhttp3.Call copyTemplateToAppCall(String templateId, String appId, CopyT Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -488,7 +490,7 @@ public okhttp3.Call createAliasCall(String appId, String aliasLabel, String alia Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -665,7 +667,7 @@ public okhttp3.Call createAliasBySubscriptionCall(String appId, String subscript Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -829,7 +831,7 @@ public okhttp3.Call createApiKeyCall(String appId, CreateApiKeyRequest createApi Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -975,7 +977,7 @@ public okhttp3.Call createAppCall(App app, final ApiCallback _callback) throws A Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1119,7 +1121,7 @@ public okhttp3.Call createCustomEventsCall(String appId, CustomEventsRequest cus Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1274,7 +1276,7 @@ public okhttp3.Call createJourneyCall(String appId, CreateJourneyRequest createJ Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1426,7 +1428,7 @@ public okhttp3.Call createNotificationCall(Notification notification, final ApiC Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1570,7 +1572,7 @@ public okhttp3.Call createSegmentCall(String appId, Segment segment, final ApiCa Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1726,7 +1728,7 @@ public okhttp3.Call createSubscriptionCall(String appId, String aliasLabel, Stri Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -1900,7 +1902,7 @@ public okhttp3.Call createTemplateCall(CreateTemplateRequest createTemplateReque Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2046,7 +2048,7 @@ public okhttp3.Call createUserCall(String appId, User user, final ApiCallback _c Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2213,7 +2215,7 @@ public okhttp3.Call deleteAliasCall(String appId, String aliasLabel, String alia Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2386,7 +2388,7 @@ public okhttp3.Call deleteApiKeyCall(String appId, String tokenId, final ApiCall Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2536,7 +2538,7 @@ public okhttp3.Call deleteJourneyCall(String appId, String journeyId, final ApiC Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2692,7 +2694,7 @@ public okhttp3.Call deleteSegmentCall(String appId, String segmentId, final ApiC Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -2849,7 +2851,7 @@ public okhttp3.Call deleteSubscriptionCall(String appId, String subscriptionId, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -3002,7 +3004,7 @@ public okhttp3.Call deleteTemplateCall(String templateId, String appId, final Ap Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -3161,7 +3163,7 @@ public okhttp3.Call deleteUserCall(String appId, String aliasLabel, String alias Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -3276,6 +3278,147 @@ public okhttp3.Call deleteUserAsync(String appId, String aliasLabel, String alia localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } + /** + * Build call for estimateNotificationRecipients + * @param estimateNotificationRecipientsRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Rate Limit Exceeded -
0 Unexpected error -
+ */ + public okhttp3.Call estimateNotificationRecipientsCall(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = estimateNotificationRecipientsRequest; + + // create path and map variables + String localVarPath = "/notifications/count-unsaved"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + // Adds client sdk version header + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "rest_api_key" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call estimateNotificationRecipientsValidateBeforeCall(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, final ApiCallback _callback) throws ApiException { + + // verify the required parameter 'estimateNotificationRecipientsRequest' is set + if (estimateNotificationRecipientsRequest == null) { + throw new ApiException("Missing the required parameter 'estimateNotificationRecipientsRequest' when calling estimateNotificationRecipients(Async)"); + } + + + okhttp3.Call localVarCall = estimateNotificationRecipientsCall(estimateNotificationRecipientsRequest, _callback); + return localVarCall; + + } + + /** + * Estimate notification recipients + * Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored. + * @param estimateNotificationRecipientsRequest (required) + * @return EstimateNotificationRecipientsSuccessResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Rate Limit Exceeded -
0 Unexpected error -
+ */ + public EstimateNotificationRecipientsSuccessResponse estimateNotificationRecipients(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest) throws ApiException { + ApiResponse localVarResp = estimateNotificationRecipientsWithHttpInfo(estimateNotificationRecipientsRequest); + return localVarResp.getData(); + } + + /** + * Estimate notification recipients + * Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored. + * @param estimateNotificationRecipientsRequest (required) + * @return ApiResponse<EstimateNotificationRecipientsSuccessResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Rate Limit Exceeded -
0 Unexpected error -
+ */ + public ApiResponse estimateNotificationRecipientsWithHttpInfo(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest) throws ApiException { + okhttp3.Call localVarCall = estimateNotificationRecipientsValidateBeforeCall(estimateNotificationRecipientsRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Estimate notification recipients (asynchronously) + * Returns the estimated number of recipients for a notification's targeting, without creating or sending anything. The returned `count` reflects the same audience-size estimate you would see under \"Choose your target audience\" when composing a message. It is based on the user targeting method you've set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: `included_segments` is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that audience further. Use `target_channel` to select platforms. `include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored. + * @param estimateNotificationRecipientsRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Rate Limit Exceeded -
0 Unexpected error -
+ */ + public okhttp3.Call estimateNotificationRecipientsAsync(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = estimateNotificationRecipientsValidateBeforeCall(estimateNotificationRecipientsRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for exportEvents * @param notificationId The ID of the notification to export events from. (required) @@ -3320,7 +3463,7 @@ public okhttp3.Call exportEventsCall(String notificationId, String appId, final Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -3478,7 +3621,7 @@ public okhttp3.Call exportSubscriptionsCall(String appId, ExportSubscriptionsReq Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -3628,7 +3771,7 @@ public okhttp3.Call getAliasesCall(String appId, String aliasLabel, String alias Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -3791,7 +3934,7 @@ public okhttp3.Call getAliasesBySubscriptionCall(String appId, String subscripti Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -3941,7 +4084,7 @@ public okhttp3.Call getAppCall(String appId, final ApiCallback _callback) throws Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -4081,7 +4224,7 @@ public okhttp3.Call getAppsCall(final ApiCallback _callback) throws ApiException Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -4217,7 +4360,7 @@ public okhttp3.Call getNotificationCall(String appId, String notificationId, fin Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -4376,7 +4519,7 @@ public okhttp3.Call getNotificationHistoryCall(String notificationId, GetNotific Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -4532,7 +4675,7 @@ public okhttp3.Call getNotificationsCall(String appId, Integer limit, Integer of Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -4711,7 +4854,7 @@ public okhttp3.Call getOutcomesCall(String appId, String outcomeNames, String ou Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (outcomeNames != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("outcome_names", outcomeNames)); @@ -4897,7 +5040,7 @@ public okhttp3.Call getSegmentCall(String appId, String segmentId, Boolean inclu Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (includeSegmentDetail != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("include-segment-detail", includeSegmentDetail)); @@ -5059,7 +5202,7 @@ public okhttp3.Call getSegmentsCall(String appId, Integer offset, Integer limit, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (offset != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("offset", offset)); @@ -5220,7 +5363,7 @@ public okhttp3.Call getUserCall(String appId, String aliasLabel, String aliasId, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -5394,7 +5537,7 @@ public okhttp3.Call listAuditLogsCall(String organizationId, String startTime, S Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (startTime != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("start_time", startTime)); @@ -5620,7 +5763,7 @@ public okhttp3.Call rotateApiKeyCall(String appId, String tokenId, final ApiCall Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -5770,7 +5913,7 @@ public okhttp3.Call startLiveActivityCall(String appId, String activityType, Sta Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -5933,7 +6076,7 @@ public okhttp3.Call transferSubscriptionCall(String appId, String subscriptionId Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -6100,7 +6243,7 @@ public okhttp3.Call unsubscribeEmailWithTokenCall(String appId, String notificat Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (token != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("token", token)); @@ -6264,7 +6407,7 @@ public okhttp3.Call updateApiKeyCall(String appId, String tokenId, UpdateApiKeyR Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -6420,7 +6563,7 @@ public okhttp3.Call updateAppCall(String appId, App app, final ApiCallback _call Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -6577,7 +6720,7 @@ public okhttp3.Call updateJourneyCall(String appId, String journeyId, UpdateJour Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -6756,7 +6899,7 @@ public okhttp3.Call updateJourneyNodeCall(String appId, String journeyId, String Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -6937,7 +7080,7 @@ public okhttp3.Call updateLiveActivityCall(String appId, String activityId, Upda Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -7100,7 +7243,7 @@ public okhttp3.Call updateSegmentCall(String appId, String segmentId, UpdateSegm Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -7264,7 +7407,7 @@ public okhttp3.Call updateSubscriptionCall(String appId, String subscriptionId, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -7429,7 +7572,7 @@ public okhttp3.Call updateSubscriptionByTokenCall(String appId, String tokenType Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -7596,7 +7739,7 @@ public okhttp3.Call updateTemplateCall(String templateId, String appId, UpdateTe Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -7761,7 +7904,7 @@ public okhttp3.Call updateUserCall(String appId, String aliasLabel, String alias Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -7929,7 +8072,7 @@ public okhttp3.Call viewApiKeysCall(String appId, final ApiCallback _callback) t Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -8070,7 +8213,7 @@ public okhttp3.Call viewJourneyCall(String appId, String journeyId, final ApiCal Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -8222,7 +8365,7 @@ public okhttp3.Call viewJourneyStatsCall(String appId, String journeyId, final A Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); final String[] localVarAccepts = { "application/json" @@ -8375,7 +8518,7 @@ public okhttp3.Call viewJourneysCall(String appId, String cursor, Integer limit, Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (cursor != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("cursor", cursor)); @@ -8535,7 +8678,7 @@ public okhttp3.Call viewTemplateCall(String templateId, String appId, final ApiC Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); @@ -8691,7 +8834,7 @@ public okhttp3.Call viewTemplatesCall(String appId, Integer limit, Integer offse Map localVarFormParams = new HashMap(); // Adds client sdk version header - localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.14.0"); + localVarHeaderParams.put("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-java, version=5.15.0"); if (appId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("app_id", appId)); diff --git a/src/main/java/com/onesignal/client/model/BasicNotification.java b/src/main/java/com/onesignal/client/model/BasicNotification.java index 5a1124cd..e84e5df2 100644 --- a/src/main/java/com/onesignal/client/model/BasicNotification.java +++ b/src/main/java/com/onesignal/client/model/BasicNotification.java @@ -781,11 +781,11 @@ public BasicNotification addIncludedSegmentsItem(String includedSegmentsItem) { } /** - * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] + * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. * @return includedSegments **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] ") + @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. ") public List getIncludedSegments() { return includedSegments; diff --git a/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequest.java b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequest.java new file mode 100644 index 00000000..7a93cd20 --- /dev/null +++ b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequest.java @@ -0,0 +1,436 @@ +/* + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onesignal.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.onesignal.client.model.EstimateNotificationRecipientsRequestAllOf; +import com.onesignal.client.model.FilterExpression; +import com.onesignal.client.model.SegmentNotificationTarget; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.onesignal.client.JSON; + +/** + * The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored. + */ +@ApiModel(description = "The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored. ") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EstimateNotificationRecipientsRequest { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_INCLUDED_SEGMENTS = "included_segments"; + @SerializedName(SERIALIZED_NAME_INCLUDED_SEGMENTS) + private List includedSegments = null; + + public static final String SERIALIZED_NAME_EXCLUDED_SEGMENTS = "excluded_segments"; + @SerializedName(SERIALIZED_NAME_EXCLUDED_SEGMENTS) + private List excludedSegments = null; + + public static final String SERIALIZED_NAME_APP_ID = "app_id"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + private List filters = null; + + public static final String SERIALIZED_NAME_INCLUDE_ALIASES = "include_aliases"; + @SerializedName(SERIALIZED_NAME_INCLUDE_ALIASES) + private Map> includeAliases = null; + + /** + * Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. + */ + @JsonAdapter(TargetChannelEnum.Adapter.class) + public enum TargetChannelEnum { + PUSH("push"), + + EMAIL("email"), + + SMS("sms"); + + private String value; + + TargetChannelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TargetChannelEnum fromValue(String value) { + for (TargetChannelEnum b : TargetChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TargetChannelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TargetChannelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TargetChannelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TARGET_CHANNEL = "target_channel"; + @SerializedName(SERIALIZED_NAME_TARGET_CHANNEL) + private TargetChannelEnum targetChannel; + + public EstimateNotificationRecipientsRequest() { + } + + public EstimateNotificationRecipientsRequest includedSegments(List includedSegments) { + + this.includedSegments = includedSegments; + return this; + } + + public EstimateNotificationRecipientsRequest addIncludedSegmentsItem(String includedSegmentsItem) { + if (this.includedSegments == null) { + this.includedSegments = new ArrayList<>(); + } + this.includedSegments.add(includedSegmentsItem); + return this; + } + + /** + * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. + * @return includedSegments + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. ") + + public List getIncludedSegments() { + return includedSegments; + } + + + public void setIncludedSegments(List includedSegments) { + this.includedSegments = includedSegments; + } + + + public EstimateNotificationRecipientsRequest excludedSegments(List excludedSegments) { + + this.excludedSegments = excludedSegments; + return this; + } + + public EstimateNotificationRecipientsRequest addExcludedSegmentsItem(String excludedSegmentsItem) { + if (this.excludedSegments == null) { + this.excludedSegments = new ArrayList<>(); + } + this.excludedSegments.add(excludedSegmentsItem); + return this; + } + + /** + * Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] + * @return excludedSegments + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] ") + + public List getExcludedSegments() { + return excludedSegments; + } + + + public void setExcludedSegments(List excludedSegments) { + this.excludedSegments = excludedSegments; + } + + + public EstimateNotificationRecipientsRequest appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * The OneSignal App ID for your app, which can be found in Keys & IDs. + * @return appId + **/ + @javax.annotation.Nonnull + @ApiModelProperty(required = true, value = "The OneSignal App ID for your app, which can be found in Keys & IDs.") + + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public EstimateNotificationRecipientsRequest filters(List filters) { + + this.filters = filters; + return this; + } + + public EstimateNotificationRecipientsRequest addFiltersItem(FilterExpression filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * @return filters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getFilters() { + return filters; + } + + + public void setFilters(List filters) { + this.filters = filters; + } + + + public EstimateNotificationRecipientsRequest includeAliases(Map> includeAliases) { + + this.includeAliases = includeAliases; + return this; + } + + public EstimateNotificationRecipientsRequest putIncludeAliasesItem(String key, List includeAliasesItem) { + if (this.includeAliases == null) { + this.includeAliases = new HashMap<>(); + } + this.includeAliases.put(key, includeAliasesItem); + return this; + } + + /** + * Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. + * @return includeAliases + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms.") + + public Map> getIncludeAliases() { + return includeAliases; + } + + + public void setIncludeAliases(Map> includeAliases) { + this.includeAliases = includeAliases; + } + + + public EstimateNotificationRecipientsRequest targetChannel(TargetChannelEnum targetChannel) { + + this.targetChannel = targetChannel; + return this; + } + + /** + * Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. + * @return targetChannel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.") + + public TargetChannelEnum getTargetChannel() { + return targetChannel; + } + + + public void setTargetChannel(TargetChannelEnum targetChannel) { + this.targetChannel = targetChannel; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest = (EstimateNotificationRecipientsRequest) o; + return Objects.equals(this.includedSegments, estimateNotificationRecipientsRequest.includedSegments) && + Objects.equals(this.excludedSegments, estimateNotificationRecipientsRequest.excludedSegments) && + Objects.equals(this.appId, estimateNotificationRecipientsRequest.appId) && + Objects.equals(this.filters, estimateNotificationRecipientsRequest.filters) && + Objects.equals(this.includeAliases, estimateNotificationRecipientsRequest.includeAliases) && + Objects.equals(this.targetChannel, estimateNotificationRecipientsRequest.targetChannel); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(includedSegments, excludedSegments, appId, filters, includeAliases, targetChannel); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EstimateNotificationRecipientsRequest {\n"); + sb.append(" includedSegments: ").append(toIndentedString(includedSegments)).append("\n"); + sb.append(" excludedSegments: ").append(toIndentedString(excludedSegments)).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" includeAliases: ").append(toIndentedString(includeAliases)).append("\n"); + sb.append(" targetChannel: ").append(toIndentedString(targetChannel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("included_segments"); + openapiFields.add("excluded_segments"); + openapiFields.add("app_id"); + openapiFields.add("filters"); + openapiFields.add("include_aliases"); + openapiFields.add("target_channel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("app_id"); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EstimateNotificationRecipientsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EstimateNotificationRecipientsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EstimateNotificationRecipientsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EstimateNotificationRecipientsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EstimateNotificationRecipientsRequest read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EstimateNotificationRecipientsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of EstimateNotificationRecipientsRequest + * @throws IOException if the JSON string is invalid with respect to EstimateNotificationRecipientsRequest + */ + public static EstimateNotificationRecipientsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EstimateNotificationRecipientsRequest.class); + } + + /** + * Convert an instance of EstimateNotificationRecipientsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequestAllOf.java b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequestAllOf.java new file mode 100644 index 00000000..f7975eb2 --- /dev/null +++ b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsRequestAllOf.java @@ -0,0 +1,356 @@ +/* + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onesignal.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.onesignal.client.model.FilterExpression; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.onesignal.client.JSON; + +/** + * EstimateNotificationRecipientsRequestAllOf + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EstimateNotificationRecipientsRequestAllOf { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_APP_ID = "app_id"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + + public static final String SERIALIZED_NAME_FILTERS = "filters"; + @SerializedName(SERIALIZED_NAME_FILTERS) + private List filters = null; + + public static final String SERIALIZED_NAME_INCLUDE_ALIASES = "include_aliases"; + @SerializedName(SERIALIZED_NAME_INCLUDE_ALIASES) + private Map> includeAliases = null; + + /** + * Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. + */ + @JsonAdapter(TargetChannelEnum.Adapter.class) + public enum TargetChannelEnum { + PUSH("push"), + + EMAIL("email"), + + SMS("sms"); + + private String value; + + TargetChannelEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static TargetChannelEnum fromValue(String value) { + for (TargetChannelEnum b : TargetChannelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TargetChannelEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public TargetChannelEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TargetChannelEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_TARGET_CHANNEL = "target_channel"; + @SerializedName(SERIALIZED_NAME_TARGET_CHANNEL) + private TargetChannelEnum targetChannel; + + public EstimateNotificationRecipientsRequestAllOf() { + } + + public EstimateNotificationRecipientsRequestAllOf appId(String appId) { + + this.appId = appId; + return this; + } + + /** + * The OneSignal App ID for your app, which can be found in Keys & IDs. + * @return appId + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The OneSignal App ID for your app, which can be found in Keys & IDs.") + + public String getAppId() { + return appId; + } + + + public void setAppId(String appId) { + this.appId = appId; + } + + + public EstimateNotificationRecipientsRequestAllOf filters(List filters) { + + this.filters = filters; + return this; + } + + public EstimateNotificationRecipientsRequestAllOf addFiltersItem(FilterExpression filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * @return filters + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public List getFilters() { + return filters; + } + + + public void setFilters(List filters) { + this.filters = filters; + } + + + public EstimateNotificationRecipientsRequestAllOf includeAliases(Map> includeAliases) { + + this.includeAliases = includeAliases; + return this; + } + + public EstimateNotificationRecipientsRequestAllOf putIncludeAliasesItem(String key, List includeAliasesItem) { + if (this.includeAliases == null) { + this.includeAliases = new HashMap<>(); + } + this.includeAliases.put(key, includeAliasesItem); + return this; + } + + /** + * Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms. + * @return includeAliases + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms.") + + public Map> getIncludeAliases() { + return includeAliases; + } + + + public void setIncludeAliases(Map> includeAliases) { + this.includeAliases = includeAliases; + } + + + public EstimateNotificationRecipientsRequestAllOf targetChannel(TargetChannelEnum targetChannel) { + + this.targetChannel = targetChannel; + return this; + } + + /** + * Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint. + * @return targetChannel + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.") + + public TargetChannelEnum getTargetChannel() { + return targetChannel; + } + + + public void setTargetChannel(TargetChannelEnum targetChannel) { + this.targetChannel = targetChannel; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EstimateNotificationRecipientsRequestAllOf estimateNotificationRecipientsRequestAllOf = (EstimateNotificationRecipientsRequestAllOf) o; + return Objects.equals(this.appId, estimateNotificationRecipientsRequestAllOf.appId) && + Objects.equals(this.filters, estimateNotificationRecipientsRequestAllOf.filters) && + Objects.equals(this.includeAliases, estimateNotificationRecipientsRequestAllOf.includeAliases) && + Objects.equals(this.targetChannel, estimateNotificationRecipientsRequestAllOf.targetChannel); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(appId, filters, includeAliases, targetChannel); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EstimateNotificationRecipientsRequestAllOf {\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" includeAliases: ").append(toIndentedString(includeAliases)).append("\n"); + sb.append(" targetChannel: ").append(toIndentedString(targetChannel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("app_id"); + openapiFields.add("filters"); + openapiFields.add("include_aliases"); + openapiFields.add("target_channel"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EstimateNotificationRecipientsRequestAllOf.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EstimateNotificationRecipientsRequestAllOf' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EstimateNotificationRecipientsRequestAllOf.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EstimateNotificationRecipientsRequestAllOf value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EstimateNotificationRecipientsRequestAllOf read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EstimateNotificationRecipientsRequestAllOf given an JSON string + * + * @param jsonString JSON string + * @return An instance of EstimateNotificationRecipientsRequestAllOf + * @throws IOException if the JSON string is invalid with respect to EstimateNotificationRecipientsRequestAllOf + */ + public static EstimateNotificationRecipientsRequestAllOf fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EstimateNotificationRecipientsRequestAllOf.class); + } + + /** + * Convert an instance of EstimateNotificationRecipientsRequestAllOf to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsSuccessResponse.java b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsSuccessResponse.java new file mode 100644 index 00000000..45ebf13b --- /dev/null +++ b/src/main/java/com/onesignal/client/model/EstimateNotificationRecipientsSuccessResponse.java @@ -0,0 +1,316 @@ +/* + * 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 + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.onesignal.client.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import org.openapitools.jackson.nullable.JsonNullable; +import java.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import com.onesignal.client.JSON; + +/** + * EstimateNotificationRecipientsSuccessResponse + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class EstimateNotificationRecipientsSuccessResponse { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + private Integer count; + + public static final String SERIALIZED_NAME_UNCAPPED_COUNT = "uncapped_count"; + @SerializedName(SERIALIZED_NAME_UNCAPPED_COUNT) + private Integer uncappedCount; + + public static final String SERIALIZED_NAME_CAP_APPLIED = "cap_applied"; + @SerializedName(SERIALIZED_NAME_CAP_APPLIED) + private Boolean capApplied; + + public static final String SERIALIZED_NAME_MOBILE_SUPPRESSED = "mobile_suppressed"; + @SerializedName(SERIALIZED_NAME_MOBILE_SUPPRESSED) + private Boolean mobileSuppressed; + + public static final String SERIALIZED_NAME_MOBILE_EXCLUDED_COUNT = "mobile_excluded_count"; + @SerializedName(SERIALIZED_NAME_MOBILE_EXCLUDED_COUNT) + private Integer mobileExcludedCount; + + public EstimateNotificationRecipientsSuccessResponse() { + } + + public EstimateNotificationRecipientsSuccessResponse count(Integer count) { + + this.count = count; + return this; + } + + /** + * The estimated audience size based on the user targeting method you've set on the message, and the specific platforms the message is targeted to send to. + * @return count + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The estimated audience size based on the user targeting method you've set on the message, and the specific platforms the message is targeted to send to.") + + public Integer getCount() { + return count; + } + + + public void setCount(Integer count) { + this.count = count; + } + + + public EstimateNotificationRecipientsSuccessResponse uncappedCount(Integer uncappedCount) { + + this.uncappedCount = uncappedCount; + return this; + } + + /** + * The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. + * @return uncappedCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise.") + + public Integer getUncappedCount() { + return uncappedCount; + } + + + public void setUncappedCount(Integer uncappedCount) { + this.uncappedCount = uncappedCount; + } + + + public EstimateNotificationRecipientsSuccessResponse capApplied(Boolean capApplied) { + + this.capApplied = capApplied; + return this; + } + + /** + * Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to. + * @return capApplied + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to.") + + public Boolean getCapApplied() { + return capApplied; + } + + + public void setCapApplied(Boolean capApplied) { + this.capApplied = capApplied; + } + + + public EstimateNotificationRecipientsSuccessResponse mobileSuppressed(Boolean mobileSuppressed) { + + this.mobileSuppressed = mobileSuppressed; + return this; + } + + /** + * The mobile equivalent of `cap_applied`. Whether mobile push deliveries will be dropped for this send because the org is over its plan's mobile push subscriber cap. `false` when the notification doesn't target any mobile push platforms. + * @return mobileSuppressed + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "The mobile equivalent of `cap_applied`. Whether mobile push deliveries will be dropped for this send because the org is over its plan's mobile push subscriber cap. `false` when the notification doesn't target any mobile push platforms.") + + public Boolean getMobileSuppressed() { + return mobileSuppressed; + } + + + public void setMobileSuppressed(Boolean mobileSuppressed) { + this.mobileSuppressed = mobileSuppressed; + } + + + public EstimateNotificationRecipientsSuccessResponse mobileExcludedCount(Integer mobileExcludedCount) { + + this.mobileExcludedCount = mobileExcludedCount; + return this; + } + + /** + * How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. + * @return mobileExcludedCount + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`.") + + public Integer getMobileExcludedCount() { + return mobileExcludedCount; + } + + + public void setMobileExcludedCount(Integer mobileExcludedCount) { + this.mobileExcludedCount = mobileExcludedCount; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EstimateNotificationRecipientsSuccessResponse estimateNotificationRecipientsSuccessResponse = (EstimateNotificationRecipientsSuccessResponse) o; + return Objects.equals(this.count, estimateNotificationRecipientsSuccessResponse.count) && + Objects.equals(this.uncappedCount, estimateNotificationRecipientsSuccessResponse.uncappedCount) && + Objects.equals(this.capApplied, estimateNotificationRecipientsSuccessResponse.capApplied) && + Objects.equals(this.mobileSuppressed, estimateNotificationRecipientsSuccessResponse.mobileSuppressed) && + Objects.equals(this.mobileExcludedCount, estimateNotificationRecipientsSuccessResponse.mobileExcludedCount); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + + @Override + public int hashCode() { + return Objects.hash(count, uncappedCount, capApplied, mobileSuppressed, mobileExcludedCount); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EstimateNotificationRecipientsSuccessResponse {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" uncappedCount: ").append(toIndentedString(uncappedCount)).append("\n"); + sb.append(" capApplied: ").append(toIndentedString(capApplied)).append("\n"); + sb.append(" mobileSuppressed: ").append(toIndentedString(mobileSuppressed)).append("\n"); + sb.append(" mobileExcludedCount: ").append(toIndentedString(mobileExcludedCount)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("count"); + openapiFields.add("uncapped_count"); + openapiFields.add("cap_applied"); + openapiFields.add("mobile_suppressed"); + openapiFields.add("mobile_excluded_count"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EstimateNotificationRecipientsSuccessResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EstimateNotificationRecipientsSuccessResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EstimateNotificationRecipientsSuccessResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EstimateNotificationRecipientsSuccessResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EstimateNotificationRecipientsSuccessResponse read(JsonReader in) throws IOException { + JsonObject jsonObj = elementAdapter.read(in).getAsJsonObject(); + + return thisAdapter.fromJsonTree(jsonObj); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of EstimateNotificationRecipientsSuccessResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of EstimateNotificationRecipientsSuccessResponse + * @throws IOException if the JSON string is invalid with respect to EstimateNotificationRecipientsSuccessResponse + */ + public static EstimateNotificationRecipientsSuccessResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EstimateNotificationRecipientsSuccessResponse.class); + } + + /** + * Convert an instance of EstimateNotificationRecipientsSuccessResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/onesignal/client/model/Notification.java b/src/main/java/com/onesignal/client/model/Notification.java index ae888f43..26f078f3 100644 --- a/src/main/java/com/onesignal/client/model/Notification.java +++ b/src/main/java/com/onesignal/client/model/Notification.java @@ -786,11 +786,11 @@ public Notification addIncludedSegmentsItem(String includedSegmentsItem) { } /** - * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] + * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. * @return includedSegments **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] ") + @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. ") public List getIncludedSegments() { return includedSegments; diff --git a/src/main/java/com/onesignal/client/model/NotificationWithMeta.java b/src/main/java/com/onesignal/client/model/NotificationWithMeta.java index eceaa93d..dc399457 100644 --- a/src/main/java/com/onesignal/client/model/NotificationWithMeta.java +++ b/src/main/java/com/onesignal/client/model/NotificationWithMeta.java @@ -837,11 +837,11 @@ public NotificationWithMeta addIncludedSegmentsItem(String includedSegmentsItem) } /** - * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] + * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. * @return includedSegments **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] ") + @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. ") public List getIncludedSegments() { return includedSegments; diff --git a/src/main/java/com/onesignal/client/model/SegmentNotificationTarget.java b/src/main/java/com/onesignal/client/model/SegmentNotificationTarget.java index a1675b74..8e7ac3ee 100644 --- a/src/main/java/com/onesignal/client/model/SegmentNotificationTarget.java +++ b/src/main/java/com/onesignal/client/model/SegmentNotificationTarget.java @@ -79,11 +79,11 @@ public SegmentNotificationTarget addIncludedSegmentsItem(String includedSegments } /** - * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] + * The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. * @return includedSegments **/ @javax.annotation.Nullable - @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] ") + @ApiModelProperty(value = "The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup. ") public List getIncludedSegments() { return includedSegments;