Skip to content

Commit bad0203

Browse files
author
OneSignal
committed
feat: add v5.14.0 package updates
1 parent 6662dea commit bad0203

19 files changed

Lines changed: 1557 additions & 14 deletions

api/openapi.yaml

Lines changed: 144 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,57 @@ paths:
22552255
- rest_api_key: []
22562256
summary: Export CSV of Events
22572257
x-accepts: application/json
2258+
/notifications/count-unsaved:
2259+
post:
2260+
description: "Returns the estimated number of recipients for a notification's\
2261+
\ targeting, without creating or sending anything.\nThe returned `count` reflects\
2262+
\ the same audience-size estimate you would see under \"Choose your target\
2263+
\ audience\" when composing a message. It is based on the user targeting method\
2264+
\ you've set and the specific platforms the message is targeted to send to.\n\
2265+
This endpoint only supports a subset of targeting parameters: `included_segments`\
2266+
\ is required (its `\"All\"` shorthand targets every subscriber), and `excluded_segments`,\
2267+
\ `filters`, `include_aliases`, and `target_channel` narrow that audience\
2268+
\ further. Use `target_channel` to select platforms. `include_subscription_ids`\
2269+
\ and the other raw subscription id/token fields, and the individual `isIos`\
2270+
\ / `isAndroid` / etc. platform flags, are not supported. All other notification\
2271+
\ fields (content, delivery options, and so on) are accepted, but ignored.\n"
2272+
operationId: estimate_notification_recipients
2273+
requestBody:
2274+
content:
2275+
application/json:
2276+
schema:
2277+
$ref: '#/components/schemas/EstimateNotificationRecipientsRequest'
2278+
required: true
2279+
responses:
2280+
default:
2281+
content:
2282+
application/json:
2283+
schema:
2284+
$ref: '#/components/schemas/GenericError'
2285+
description: Unexpected error
2286+
"200":
2287+
content:
2288+
application/json:
2289+
schema:
2290+
$ref: '#/components/schemas/EstimateNotificationRecipientsSuccessResponse'
2291+
description: OK
2292+
"400":
2293+
content:
2294+
application/json:
2295+
schema:
2296+
$ref: '#/components/schemas/GenericError'
2297+
description: Bad Request
2298+
"429":
2299+
content:
2300+
application/json:
2301+
schema:
2302+
$ref: '#/components/schemas/RateLimitError'
2303+
description: Rate Limit Exceeded
2304+
security:
2305+
- rest_api_key: []
2306+
summary: Estimate notification recipients
2307+
x-content-type: application/json
2308+
x-accepts: application/json
22582309
/templates:
22592310
get:
22602311
description: List templates for an app.
@@ -3728,7 +3779,9 @@ components:
37283779
description: "The segment names you want to target. Users in these segments\
37293780
\ will receive a notification. This targeting parameter is only compatible\
37303781
\ with excluded_segments.\nExample: [\"Active Users\", \"Inactive Users\"\
3731-
]\n"
3782+
]\n`\"All\"` is a shorthand for every subscribed user: if the array includes\
3783+
\ the string `\"All\"` and the app has no segment actually named `All`,\
3784+
\ it targets all subscribers instead of a literal segment lookup.\n"
37323785
items:
37333786
type: string
37343787
type: array
@@ -5046,6 +5099,55 @@ components:
50465099
\ be 200 with partial success. Typed SDKs model this loosely so both shapes\
50475100
\ deserialize."
50485101
type: object
5102+
EstimateNotificationRecipientsRequest:
5103+
allOf:
5104+
- $ref: '#/components/schemas/SegmentNotificationTarget'
5105+
- $ref: '#/components/schemas/EstimateNotificationRecipientsRequest_allOf'
5106+
- required:
5107+
- app_id
5108+
description: "The targeting subset of notification fields this endpoint honors.\
5109+
\ `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`,\
5110+
\ `filters`, `include_aliases`, and `target_channel` narrow that segment-based\
5111+
\ audience further when present. Use `target_channel` to select which platforms\
5112+
\ to count. Other notification targeting fields (`include_subscription_ids`\
5113+
\ and the other raw subscription id/token fields, and the individual `isIos`\
5114+
\ / `isAndroid` / etc. platform flags) are not read by this endpoint. All\
5115+
\ non-targeting notification fields (content, delivery options, and so on)\
5116+
\ are accepted, but ignored.\n"
5117+
EstimateNotificationRecipientsSuccessResponse:
5118+
example:
5119+
mobile_suppressed: true
5120+
uncapped_count: 6
5121+
count: 0
5122+
mobile_excluded_count: 1
5123+
cap_applied: true
5124+
properties:
5125+
count:
5126+
description: "The estimated audience size based on the user targeting method\
5127+
\ you've set on the message, and the specific platforms the message is\
5128+
\ targeted to send to."
5129+
type: integer
5130+
uncapped_count:
5131+
description: The estimated audience size before the plan's web push subscriber
5132+
cap is applied. Present only when `cap_applied` is `true`; `null` otherwise.
5133+
nullable: true
5134+
type: integer
5135+
cap_applied:
5136+
description: Whether `count` was reduced because the app is on a plan that
5137+
caps the number of web push subscribers it can send to.
5138+
type: boolean
5139+
mobile_suppressed:
5140+
description: The mobile equivalent of `cap_applied`. Whether mobile push
5141+
deliveries will be dropped for this send because the org is over its plan's
5142+
mobile push subscriber cap. `false` when the notification doesn't target
5143+
any mobile push platforms.
5144+
type: boolean
5145+
mobile_excluded_count:
5146+
description: How many mobile push recipients the `count` excludes due to
5147+
the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is
5148+
`false`.
5149+
type: integer
5150+
type: object
50495151
GenericSuccessBoolResponse:
50505152
example:
50515153
success: true
@@ -9131,6 +9233,47 @@ components:
91319233
unsubscribe link in this email.
91329234
nullable: true
91339235
type: integer
9236+
EstimateNotificationRecipientsRequest_allOf:
9237+
properties:
9238+
app_id:
9239+
description: "The OneSignal App ID for your app, which can be found in Keys\
9240+
\ & IDs."
9241+
type: string
9242+
filters:
9243+
items:
9244+
$ref: '#/components/schemas/FilterExpression'
9245+
nullable: true
9246+
type: array
9247+
include_aliases:
9248+
additionalProperties:
9249+
items:
9250+
type: string
9251+
type: array
9252+
description: "Target specific users by aliases assigned via API. An alias\
9253+
\ can be an external_id, onesignal_id, or a custom alias.\nAccepts an\
9254+
\ object where keys are alias labels and values are arrays of alias IDs\
9255+
\ to include\nExample usage: { \"external_id\": [\"exId1\", \"extId2\"\
9256+
], \"internal_label\": [\"id1\", \"id2\"] }\nKeys must match API spellings\
9257+
\ exactly (for example the label for External ID is the string `external_id`;\
9258+
\ arbitrary keys such as camelCase variants are not aliases and may yield\
9259+
\ no recipients).\nNot compatible with any other targeting parameters.\n\
9260+
REQUIRED: REST API Key Authentication\nLimit of 2,000 entries per REST\
9261+
\ API call\nNote: If targeting push, email, or sms subscribers with same\
9262+
\ ids, use with target_channel to indicate you are sending a push or email\
9263+
\ or sms."
9264+
nullable: true
9265+
type: object
9266+
target_channel:
9267+
description: "Which platforms to count recipients for. Selects the same\
9268+
\ default platforms Create notification would use for the channel. Individual\
9269+
\ platform flags (`isIos`, `isAndroid`, etc.) are not supported by this\
9270+
\ endpoint."
9271+
enum:
9272+
- push
9273+
- email
9274+
- sms
9275+
type: string
9276+
type: object
91349277
CreateUserConflictResponse_errorsItems_meta:
91359278
properties:
91369279
conflicting_aliases:

docs/BasicNotification.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
| Name | Type | Description | Notes |
99
|------------ | ------------- | ------------- | -------------|
10-
|**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] |
10+
|**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] |
1111
|**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] |
1212
|**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] |
1313
|**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] |

docs/DefaultApi.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All URIs are relative to *https://api.onesignal.com*
2424
| [**deleteSubscription**](DefaultApi.md#deleteSubscription) | **DELETE** /apps/{app_id}/subscriptions/{subscription_id} | |
2525
| [**deleteTemplate**](DefaultApi.md#deleteTemplate) | **DELETE** /templates/{template_id} | Delete template |
2626
| [**deleteUser**](DefaultApi.md#deleteUser) | **DELETE** /apps/{app_id}/users/by/{alias_label}/{alias_id} | |
27+
| [**estimateNotificationRecipients**](DefaultApi.md#estimateNotificationRecipients) | **POST** /notifications/count-unsaved | Estimate notification recipients |
2728
| [**exportEvents**](DefaultApi.md#exportEvents) | **POST** /notifications/{notification_id}/export_events | Export CSV of Events |
2829
| [**exportSubscriptions**](DefaultApi.md#exportSubscriptions) | **POST** /players/csv_export?app_id={app_id} | Export CSV of Subscriptions |
2930
| [**getAliases**](DefaultApi.md#getAliases) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id}/identity | |
@@ -1729,6 +1730,79 @@ null (empty response body)
17291730
| **429** | Rate Limit Exceeded | - |
17301731
| **0** | Unexpected error | - |
17311732

1733+
<a name="estimateNotificationRecipients"></a>
1734+
# **estimateNotificationRecipients**
1735+
> EstimateNotificationRecipientsSuccessResponse estimateNotificationRecipients(estimateNotificationRecipientsRequest)
1736+
1737+
Estimate notification recipients
1738+
1739+
Returns the estimated number of recipients for a notification&#39;s targeting, without creating or sending anything. The returned &#x60;count&#x60; reflects the same audience-size estimate you would see under \&quot;Choose your target audience\&quot; when composing a message. It is based on the user targeting method you&#39;ve set and the specific platforms the message is targeted to send to. This endpoint only supports a subset of targeting parameters: &#x60;included_segments&#x60; is required (its &#x60;\&quot;All\&quot;&#x60; shorthand targets every subscriber), and &#x60;excluded_segments&#x60;, &#x60;filters&#x60;, &#x60;include_aliases&#x60;, and &#x60;target_channel&#x60; narrow that audience further. Use &#x60;target_channel&#x60; to select platforms. &#x60;include_subscription_ids&#x60; and the other raw subscription id/token fields, and the individual &#x60;isIos&#x60; / &#x60;isAndroid&#x60; / etc. platform flags, are not supported. All other notification fields (content, delivery options, and so on) are accepted, but ignored.
1740+
1741+
### Example
1742+
```java
1743+
// Import classes:
1744+
import com.onesignal.client.ApiClient;
1745+
import com.onesignal.client.ApiException;
1746+
import com.onesignal.client.Configuration;
1747+
import com.onesignal.client.auth.*;
1748+
import com.onesignal.client.model.*;
1749+
import com.onesignal.client.api.DefaultApi;
1750+
1751+
public class Example {
1752+
public static void main(String[] args) {
1753+
ApiClient defaultClient = Configuration.getDefaultApiClient();
1754+
defaultClient.setBasePath("https://api.onesignal.com");
1755+
1756+
// Configure HTTP bearer authorization: rest_api_key
1757+
HttpBearerAuth rest_api_key = (HttpBearerAuth) defaultClient.getAuthentication("rest_api_key");
1758+
rest_api_key.setBearerToken("YOUR_REST_API_KEY");
1759+
1760+
DefaultApi apiInstance = new DefaultApi(defaultClient);
1761+
EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest = new EstimateNotificationRecipientsRequest(); // EstimateNotificationRecipientsRequest |
1762+
try {
1763+
EstimateNotificationRecipientsSuccessResponse result = apiInstance.estimateNotificationRecipients(estimateNotificationRecipientsRequest);
1764+
System.out.println(result);
1765+
} catch (ApiException e) {
1766+
System.err.println("Exception when calling DefaultApi#estimateNotificationRecipients");
1767+
System.err.println("Status code: " + e.getCode());
1768+
// getErrorMessages() flattens any error-envelope shape to a List<String>;
1769+
// the raw body remains on getResponseBody().
1770+
System.err.println("Error messages: " + e.getErrorMessages());
1771+
System.err.println("Reason: " + e.getResponseBody());
1772+
System.err.println("Response headers: " + e.getResponseHeaders());
1773+
e.printStackTrace();
1774+
}
1775+
}
1776+
}
1777+
```
1778+
1779+
### Parameters
1780+
1781+
| Name | Type | Description | Notes |
1782+
|------------- | ------------- | ------------- | -------------|
1783+
| **estimateNotificationRecipientsRequest** | [**EstimateNotificationRecipientsRequest**](EstimateNotificationRecipientsRequest.md)| | |
1784+
1785+
### Return type
1786+
1787+
[**EstimateNotificationRecipientsSuccessResponse**](EstimateNotificationRecipientsSuccessResponse.md)
1788+
1789+
### Authorization
1790+
1791+
[rest_api_key](https://github.com/OneSignal/onesignal-java-api#configuration)
1792+
1793+
### HTTP request headers
1794+
1795+
- **Content-Type**: application/json
1796+
- **Accept**: application/json
1797+
1798+
### HTTP response details
1799+
| Status code | Description | Response headers |
1800+
|-------------|-------------|------------------|
1801+
| **200** | OK | - |
1802+
| **400** | Bad Request | - |
1803+
| **429** | Rate Limit Exceeded | - |
1804+
| **0** | Unexpected error | - |
1805+
17321806
<a name="exportEvents"></a>
17331807
# **exportEvents**
17341808
> ExportEventsSuccessResponse exportEvents(notificationId, appId)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
3+
# EstimateNotificationRecipientsRequest
4+
5+
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.
6+
7+
## Properties
8+
9+
| Name | Type | Description | Notes |
10+
|------------ | ------------- | ------------- | -------------|
11+
|**includedSegments** | **List&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] &#x60;\&quot;All\&quot;&#x60; is a shorthand for every subscribed user: if the array includes the string &#x60;\&quot;All\&quot;&#x60; and the app has no segment actually named &#x60;All&#x60;, it targets all subscribers instead of a literal segment lookup. | [optional] |
12+
|**excludedSegments** | **List&lt;String&gt;** | 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: [\&quot;Active Users\&quot;, \&quot;Inactive Users\&quot;] | [optional] |
13+
|**appId** | **String** | The OneSignal App ID for your app, which can be found in Keys &amp; IDs. | |
14+
|**filters** | [**List&lt;FilterExpression&gt;**](FilterExpression.md) | | [optional] |
15+
|**includeAliases** | **Map&lt;String, List&lt;String&gt;&gt;** | 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: { \&quot;external_id\&quot;: [\&quot;exId1\&quot;, \&quot;extId2\&quot;], \&quot;internal_label\&quot;: [\&quot;id1\&quot;, \&quot;id2\&quot;] } Keys must match API spellings exactly (for example the label for External ID is the string &#x60;external_id&#x60;; 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] |
16+
|**targetChannel** | [**TargetChannelEnum**](#TargetChannelEnum) | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (&#x60;isIos&#x60;, &#x60;isAndroid&#x60;, etc.) are not supported by this endpoint. | [optional] |
17+
18+
19+
20+
## Enum: TargetChannelEnum
21+
22+
| Name | Value |
23+
|---- | -----|
24+
| PUSH | &quot;push&quot; |
25+
| EMAIL | &quot;email&quot; |
26+
| SMS | &quot;sms&quot; |
27+
28+
29+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
3+
# EstimateNotificationRecipientsRequestAllOf
4+
5+
6+
## Properties
7+
8+
| Name | Type | Description | Notes |
9+
|------------ | ------------- | ------------- | -------------|
10+
|**appId** | **String** | The OneSignal App ID for your app, which can be found in Keys &amp; IDs. | [optional] |
11+
|**filters** | [**List&lt;FilterExpression&gt;**](FilterExpression.md) | | [optional] |
12+
|**includeAliases** | **Map&lt;String, List&lt;String&gt;&gt;** | 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: { \&quot;external_id\&quot;: [\&quot;exId1\&quot;, \&quot;extId2\&quot;], \&quot;internal_label\&quot;: [\&quot;id1\&quot;, \&quot;id2\&quot;] } Keys must match API spellings exactly (for example the label for External ID is the string &#x60;external_id&#x60;; 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] |
13+
|**targetChannel** | [**TargetChannelEnum**](#TargetChannelEnum) | Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (&#x60;isIos&#x60;, &#x60;isAndroid&#x60;, etc.) are not supported by this endpoint. | [optional] |
14+
15+
16+
17+
## Enum: TargetChannelEnum
18+
19+
| Name | Value |
20+
|---- | -----|
21+
| PUSH | &quot;push&quot; |
22+
| EMAIL | &quot;email&quot; |
23+
| SMS | &quot;sms&quot; |
24+
25+
26+

0 commit comments

Comments
 (0)