diff --git a/docs/BasicNotification.md b/docs/BasicNotification.md index 3c90856..f884ca0 100644 --- a/docs/BasicNotification.md +++ b/docs/BasicNotification.md @@ -4,7 +4,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 79c75d3..615667c 100644 --- a/docs/DefaultApi.md +++ b/docs/DefaultApi.md @@ -24,6 +24,7 @@ Method | HTTP request | Description [**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 | @@ -1898,6 +1899,88 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) + +# **EstimateNotificationRecipients** +> EstimateNotificationRecipientsSuccessResponse EstimateNotificationRecipients (EstimateNotificationRecipientsRequest 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 +```csharp +using System; +using System.Collections.Generic; +using System.Diagnostics; +using OneSignalApi.Api; +using OneSignalApi.Client; +using OneSignalApi.Model; + +namespace Example +{ + public class EstimateNotificationRecipientsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "https://api.onesignal.com"; + // Configure Bearer token for authorization: rest_api_key + config.AccessToken = "YOUR_REST_API_KEY"; + + var apiInstance = new DefaultApi(config); + var estimateNotificationRecipientsRequest = new EstimateNotificationRecipientsRequest(); // EstimateNotificationRecipientsRequest | + + try + { + // Estimate notification recipients + EstimateNotificationRecipientsSuccessResponse result = apiInstance.EstimateNotificationRecipients(estimateNotificationRecipientsRequest); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.EstimateNotificationRecipients: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + // e.ErrorMessages flattens any error-envelope shape to an IReadOnlyList; + // the raw body remains on e.ErrorContent. + Debug.Print("Error Messages: " + string.Join(", ", e.ErrorMessages)); + Debug.Print("Response Body: " + e.ErrorContent); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **estimateNotificationRecipientsRequest** | [**EstimateNotificationRecipientsRequest**](EstimateNotificationRecipientsRequest.md)| | + +### Return type + +[**EstimateNotificationRecipientsSuccessResponse**](EstimateNotificationRecipientsSuccessResponse.md) + +### Authorization + +[rest_api_key](https://github.com/OneSignal/onesignal-dotnet-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 | - | + +[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) + # **ExportEvents** > ExportEventsSuccessResponse ExportEvents (string notificationId, string appId) diff --git a/docs/EstimateNotificationRecipientsRequest.md b/docs/EstimateNotificationRecipientsRequest.md new file mode 100644 index 0000000..3835828 --- /dev/null +++ b/docs/EstimateNotificationRecipientsRequest.md @@ -0,0 +1,16 @@ +# OneSignalApi.Model.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** | **Dictionary<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** | **string** | 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] + +[[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) + diff --git a/docs/EstimateNotificationRecipientsRequestAllOf.md b/docs/EstimateNotificationRecipientsRequestAllOf.md new file mode 100644 index 0000000..b1ba9b6 --- /dev/null +++ b/docs/EstimateNotificationRecipientsRequestAllOf.md @@ -0,0 +1,13 @@ +# OneSignalApi.Model.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** | **Dictionary<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** | **string** | 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] + +[[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) + diff --git a/docs/EstimateNotificationRecipientsSuccessResponse.md b/docs/EstimateNotificationRecipientsSuccessResponse.md new file mode 100644 index 0000000..02f0425 --- /dev/null +++ b/docs/EstimateNotificationRecipientsSuccessResponse.md @@ -0,0 +1,14 @@ +# OneSignalApi.Model.EstimateNotificationRecipientsSuccessResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Count** | **int** | 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** | **int?** | 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** | **bool** | 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** | **bool** | 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** | **int** | How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. | [optional] + +[[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) + diff --git a/docs/Notification.md b/docs/Notification.md index 7cd7c49..af4c546 100644 --- a/docs/Notification.md +++ b/docs/Notification.md @@ -4,7 +4,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 5e9e303..236972a 100644 --- a/docs/NotificationTarget.md +++ b/docs/NotificationTarget.md @@ -4,7 +4,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 e7cdd18..9be15ba 100644 --- a/docs/NotificationWithMeta.md +++ b/docs/NotificationWithMeta.md @@ -4,7 +4,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 f8975aa..c591a79 100644 --- a/docs/SegmentNotificationTarget.md +++ b/docs/SegmentNotificationTarget.md @@ -4,7 +4,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] [[Back to API list]](https://github.com/OneSignal/onesignal-dotnet-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-dotnet-api) diff --git a/src/OneSignalApi/Api/DefaultApi.cs b/src/OneSignalApi/Api/DefaultApi.cs index 417227d..9837a93 100644 --- a/src/OneSignalApi/Api/DefaultApi.cs +++ b/src/OneSignalApi/Api/DefaultApi.cs @@ -539,6 +539,29 @@ public interface IDefaultApiSync : IApiAccessor /// ApiResponse of Object(void) ApiResponse DeleteUserWithHttpInfo(string appId, string aliasLabel, string aliasId, int operationIndex = 0); /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// EstimateNotificationRecipientsSuccessResponse + EstimateNotificationRecipientsSuccessResponse EstimateNotificationRecipients(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0); + + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of EstimateNotificationRecipientsSuccessResponse + ApiResponse EstimateNotificationRecipientsWithHttpInfo(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0); + /// /// Export CSV of Events /// /// @@ -2020,6 +2043,31 @@ public interface IDefaultApiAsync : IApiAccessor /// Task of ApiResponse System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string appId, string aliasLabel, string aliasId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of EstimateNotificationRecipientsSuccessResponse + System.Threading.Tasks.Task EstimateNotificationRecipientsAsync(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (EstimateNotificationRecipientsSuccessResponse) + System.Threading.Tasks.Task> EstimateNotificationRecipientsWithHttpInfoAsync(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Export CSV of Events /// /// @@ -6723,6 +6771,164 @@ public OneSignalApi.Client.ApiResponse DeleteUserWithHttpInfo(string app return localVarResponse; } + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// EstimateNotificationRecipientsSuccessResponse + public EstimateNotificationRecipientsSuccessResponse EstimateNotificationRecipients(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0) + { + OneSignalApi.Client.ApiResponse localVarResponse = EstimateNotificationRecipientsWithHttpInfo(estimateNotificationRecipientsRequest); + return localVarResponse.Data; + } + + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of EstimateNotificationRecipientsSuccessResponse + public OneSignalApi.Client.ApiResponse EstimateNotificationRecipientsWithHttpInfo(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0) + { + // verify the required parameter 'estimateNotificationRecipientsRequest' is set + if (estimateNotificationRecipientsRequest == null) + { + throw new OneSignalApi.Client.ApiException(400, "Missing required parameter 'estimateNotificationRecipientsRequest' when calling DefaultApi->EstimateNotificationRecipients"); + } + + OneSignalApi.Client.RequestOptions localVarRequestOptions = new OneSignalApi.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = OneSignalApi.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = OneSignalApi.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = estimateNotificationRecipientsRequest; + + localVarRequestOptions.Operation = "DefaultApi.EstimateNotificationRecipients"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (rest_api_key) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Key " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/notifications/count-unsaved", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("EstimateNotificationRecipients", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of EstimateNotificationRecipientsSuccessResponse + public async System.Threading.Tasks.Task EstimateNotificationRecipientsAsync(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + OneSignalApi.Client.ApiResponse localVarResponse = await EstimateNotificationRecipientsWithHttpInfoAsync(estimateNotificationRecipientsRequest, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// 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. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (EstimateNotificationRecipientsSuccessResponse) + public async System.Threading.Tasks.Task> EstimateNotificationRecipientsWithHttpInfoAsync(EstimateNotificationRecipientsRequest estimateNotificationRecipientsRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // verify the required parameter 'estimateNotificationRecipientsRequest' is set + if (estimateNotificationRecipientsRequest == null) + { + throw new OneSignalApi.Client.ApiException(400, "Missing required parameter 'estimateNotificationRecipientsRequest' when calling DefaultApi->EstimateNotificationRecipients"); + } + + + OneSignalApi.Client.RequestOptions localVarRequestOptions = new OneSignalApi.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = OneSignalApi.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = OneSignalApi.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = estimateNotificationRecipientsRequest; + + localVarRequestOptions.Operation = "DefaultApi.EstimateNotificationRecipients"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (rest_api_key) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Key " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/notifications/count-unsaved", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("EstimateNotificationRecipients", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + /// /// Export CSV of Events Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time. /// diff --git a/src/OneSignalApi/Model/BasicNotification.cs b/src/OneSignalApi/Model/BasicNotification.cs index 874ea2e..f573698 100644 --- a/src/OneSignalApi/Model/BasicNotification.cs +++ b/src/OneSignalApi/Model/BasicNotification.cs @@ -216,7 +216,7 @@ protected BasicNotification() { } /// /// Initializes a new instance of the class. /// - /// 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. . /// 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\"] . /// 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 . /// 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. . @@ -462,9 +462,9 @@ protected BasicNotification() { } } /// - /// 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. /// - /// 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. [DataMember(Name = "included_segments", EmitDefaultValue = false)] public List IncludedSegments { get; set; } diff --git a/src/OneSignalApi/Model/EstimateNotificationRecipientsRequest.cs b/src/OneSignalApi/Model/EstimateNotificationRecipientsRequest.cs new file mode 100644 index 0000000..9dc2b0e --- /dev/null +++ b/src/OneSignalApi/Model/EstimateNotificationRecipientsRequest.cs @@ -0,0 +1,260 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = OneSignalApi.Client.OpenAPIDateConverter; + +namespace OneSignalApi.Model +{ + /// + /// 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. + /// + [DataContract(Name = "EstimateNotificationRecipientsRequest")] + public partial class EstimateNotificationRecipientsRequest : IEquatable, IValidatableObject + { + /// + /// 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. + /// + /// 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. + [JsonConverter(typeof(StringEnumConverter))] + public enum TargetChannelEnum + { + /// + /// Enum Push for value: push + /// + [EnumMember(Value = "push")] + Push = 1, + + /// + /// Enum Email for value: email + /// + [EnumMember(Value = "email")] + Email = 2, + + /// + /// Enum Sms for value: sms + /// + [EnumMember(Value = "sms")] + Sms = 3 + + } + + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "target_channel", EmitDefaultValue = false)] + public TargetChannelEnum? TargetChannel { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected EstimateNotificationRecipientsRequest() { } + /// + /// Initializes a new instance of the class. + /// + /// 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. . + /// 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\"] . + /// The OneSignal App ID for your app, which can be found in Keys & IDs. (required). + /// filters. + /// 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.. + /// 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 EstimateNotificationRecipientsRequest(List includedSegments = default(List), List excludedSegments = default(List), string appId = default(string), List filters = default(List), Dictionary> includeAliases = default(Dictionary>), TargetChannelEnum? targetChannel = default(TargetChannelEnum?)) + { + // to ensure "appId" is required (not null) + if (appId == null) + { + throw new ArgumentNullException("appId is a required property for EstimateNotificationRecipientsRequest and cannot be null"); + } + this.AppId = appId; + this.IncludedSegments = includedSegments; + this.ExcludedSegments = excludedSegments; + this.Filters = filters; + this.IncludeAliases = includeAliases; + this.TargetChannel = targetChannel; + } + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "included_segments", EmitDefaultValue = false)] + public List IncludedSegments { get; set; } + + /// + /// 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\"] + /// + /// 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\"] + [DataMember(Name = "excluded_segments", EmitDefaultValue = false)] + public List ExcludedSegments { get; set; } + + /// + /// The OneSignal App ID for your app, which can be found in Keys & IDs. + /// + /// The OneSignal App ID for your app, which can be found in Keys & IDs. + [DataMember(Name = "app_id", IsRequired = true, EmitDefaultValue = false)] + public string AppId { get; set; } + + /// + /// Gets or Sets Filters + /// + [DataMember(Name = "filters", EmitDefaultValue = true)] + public List Filters { get; set; } + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "include_aliases", EmitDefaultValue = true)] + public Dictionary> IncludeAliases { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EstimateNotificationRecipientsRequest {\n"); + sb.Append(" IncludedSegments: ").Append(IncludedSegments).Append("\n"); + sb.Append(" ExcludedSegments: ").Append(ExcludedSegments).Append("\n"); + sb.Append(" AppId: ").Append(AppId).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" IncludeAliases: ").Append(IncludeAliases).Append("\n"); + sb.Append(" TargetChannel: ").Append(TargetChannel).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EstimateNotificationRecipientsRequest); + } + + /// + /// Returns true if EstimateNotificationRecipientsRequest instances are equal + /// + /// Instance of EstimateNotificationRecipientsRequest to be compared + /// Boolean + public bool Equals(EstimateNotificationRecipientsRequest input) + { + if (input == null) + { + return false; + } + return + ( + this.IncludedSegments == input.IncludedSegments || + this.IncludedSegments != null && + input.IncludedSegments != null && + this.IncludedSegments.SequenceEqual(input.IncludedSegments) + ) && + ( + this.ExcludedSegments == input.ExcludedSegments || + this.ExcludedSegments != null && + input.ExcludedSegments != null && + this.ExcludedSegments.SequenceEqual(input.ExcludedSegments) + ) && + ( + this.AppId == input.AppId || + (this.AppId != null && + this.AppId.Equals(input.AppId)) + ) && + ( + this.Filters == input.Filters || + this.Filters != null && + input.Filters != null && + this.Filters.SequenceEqual(input.Filters) + ) && + ( + this.IncludeAliases == input.IncludeAliases || + this.IncludeAliases != null && + input.IncludeAliases != null && + this.IncludeAliases.SequenceEqual(input.IncludeAliases) + ) && + ( + this.TargetChannel == input.TargetChannel || + this.TargetChannel.Equals(input.TargetChannel) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.IncludedSegments != null) + { + hashCode = (hashCode * 59) + this.IncludedSegments.GetHashCode(); + } + if (this.ExcludedSegments != null) + { + hashCode = (hashCode * 59) + this.ExcludedSegments.GetHashCode(); + } + if (this.AppId != null) + { + hashCode = (hashCode * 59) + this.AppId.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.IncludeAliases != null) + { + hashCode = (hashCode * 59) + this.IncludeAliases.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TargetChannel.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/OneSignalApi/Model/EstimateNotificationRecipientsRequestAllOf.cs b/src/OneSignalApi/Model/EstimateNotificationRecipientsRequestAllOf.cs new file mode 100644 index 0000000..96d0d85 --- /dev/null +++ b/src/OneSignalApi/Model/EstimateNotificationRecipientsRequestAllOf.cs @@ -0,0 +1,210 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = OneSignalApi.Client.OpenAPIDateConverter; + +namespace OneSignalApi.Model +{ + /// + /// EstimateNotificationRecipientsRequestAllOf + /// + [DataContract(Name = "EstimateNotificationRecipientsRequest_allOf")] + public partial class EstimateNotificationRecipientsRequestAllOf : IEquatable, IValidatableObject + { + /// + /// 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. + /// + /// 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. + [JsonConverter(typeof(StringEnumConverter))] + public enum TargetChannelEnum + { + /// + /// Enum Push for value: push + /// + [EnumMember(Value = "push")] + Push = 1, + + /// + /// Enum Email for value: email + /// + [EnumMember(Value = "email")] + Email = 2, + + /// + /// Enum Sms for value: sms + /// + [EnumMember(Value = "sms")] + Sms = 3 + + } + + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "target_channel", EmitDefaultValue = false)] + public TargetChannelEnum? TargetChannel { get; set; } + /// + /// Initializes a new instance of the class. + /// + /// The OneSignal App ID for your app, which can be found in Keys & IDs.. + /// filters. + /// 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.. + /// 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 EstimateNotificationRecipientsRequestAllOf(string appId = default(string), List filters = default(List), Dictionary> includeAliases = default(Dictionary>), TargetChannelEnum? targetChannel = default(TargetChannelEnum?)) + { + this.AppId = appId; + this.Filters = filters; + this.IncludeAliases = includeAliases; + this.TargetChannel = targetChannel; + } + + /// + /// The OneSignal App ID for your app, which can be found in Keys & IDs. + /// + /// The OneSignal App ID for your app, which can be found in Keys & IDs. + [DataMember(Name = "app_id", EmitDefaultValue = false)] + public string AppId { get; set; } + + /// + /// Gets or Sets Filters + /// + [DataMember(Name = "filters", EmitDefaultValue = true)] + public List Filters { get; set; } + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "include_aliases", EmitDefaultValue = true)] + public Dictionary> IncludeAliases { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EstimateNotificationRecipientsRequestAllOf {\n"); + sb.Append(" AppId: ").Append(AppId).Append("\n"); + sb.Append(" Filters: ").Append(Filters).Append("\n"); + sb.Append(" IncludeAliases: ").Append(IncludeAliases).Append("\n"); + sb.Append(" TargetChannel: ").Append(TargetChannel).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EstimateNotificationRecipientsRequestAllOf); + } + + /// + /// Returns true if EstimateNotificationRecipientsRequestAllOf instances are equal + /// + /// Instance of EstimateNotificationRecipientsRequestAllOf to be compared + /// Boolean + public bool Equals(EstimateNotificationRecipientsRequestAllOf input) + { + if (input == null) + { + return false; + } + return + ( + this.AppId == input.AppId || + (this.AppId != null && + this.AppId.Equals(input.AppId)) + ) && + ( + this.Filters == input.Filters || + this.Filters != null && + input.Filters != null && + this.Filters.SequenceEqual(input.Filters) + ) && + ( + this.IncludeAliases == input.IncludeAliases || + this.IncludeAliases != null && + input.IncludeAliases != null && + this.IncludeAliases.SequenceEqual(input.IncludeAliases) + ) && + ( + this.TargetChannel == input.TargetChannel || + this.TargetChannel.Equals(input.TargetChannel) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.AppId != null) + { + hashCode = (hashCode * 59) + this.AppId.GetHashCode(); + } + if (this.Filters != null) + { + hashCode = (hashCode * 59) + this.Filters.GetHashCode(); + } + if (this.IncludeAliases != null) + { + hashCode = (hashCode * 59) + this.IncludeAliases.GetHashCode(); + } + hashCode = (hashCode * 59) + this.TargetChannel.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/OneSignalApi/Model/EstimateNotificationRecipientsSuccessResponse.cs b/src/OneSignalApi/Model/EstimateNotificationRecipientsSuccessResponse.cs new file mode 100644 index 0000000..8c38d06 --- /dev/null +++ b/src/OneSignalApi/Model/EstimateNotificationRecipientsSuccessResponse.cs @@ -0,0 +1,189 @@ +/* + * OneSignal + * + * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + * + * Contact: devrel@onesignal.com + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = OneSignalApi.Client.OpenAPIDateConverter; + +namespace OneSignalApi.Model +{ + /// + /// EstimateNotificationRecipientsSuccessResponse + /// + [DataContract(Name = "EstimateNotificationRecipientsSuccessResponse")] + public partial class EstimateNotificationRecipientsSuccessResponse : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// 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.. + /// The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise.. + /// Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to.. + /// 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.. + /// How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`.. + public EstimateNotificationRecipientsSuccessResponse(int count = default(int), int? uncappedCount = default(int?), bool capApplied = default(bool), bool mobileSuppressed = default(bool), int mobileExcludedCount = default(int)) + { + this.Count = count; + this.UncappedCount = uncappedCount; + this.CapApplied = capApplied; + this.MobileSuppressed = mobileSuppressed; + this.MobileExcludedCount = mobileExcludedCount; + } + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "count", EmitDefaultValue = false)] + public int Count { get; set; } + + /// + /// The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. + /// + /// The estimated audience size before the plan's web push subscriber cap is applied. Present only when `cap_applied` is `true`; `null` otherwise. + [DataMember(Name = "uncapped_count", EmitDefaultValue = true)] + public int? UncappedCount { get; set; } + + /// + /// Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to. + /// + /// Whether `count` was reduced because the app is on a plan that caps the number of web push subscribers it can send to. + [DataMember(Name = "cap_applied", EmitDefaultValue = true)] + public bool CapApplied { get; set; } + + /// + /// 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. + /// + /// 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. + [DataMember(Name = "mobile_suppressed", EmitDefaultValue = true)] + public bool MobileSuppressed { get; set; } + + /// + /// How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. + /// + /// How many mobile push recipients the `count` excludes due to the plan's mobile push subscriber cap. `0` when `mobile_suppressed` is `false`. + [DataMember(Name = "mobile_excluded_count", EmitDefaultValue = false)] + public int MobileExcludedCount { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EstimateNotificationRecipientsSuccessResponse {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" UncappedCount: ").Append(UncappedCount).Append("\n"); + sb.Append(" CapApplied: ").Append(CapApplied).Append("\n"); + sb.Append(" MobileSuppressed: ").Append(MobileSuppressed).Append("\n"); + sb.Append(" MobileExcludedCount: ").Append(MobileExcludedCount).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as EstimateNotificationRecipientsSuccessResponse); + } + + /// + /// Returns true if EstimateNotificationRecipientsSuccessResponse instances are equal + /// + /// Instance of EstimateNotificationRecipientsSuccessResponse to be compared + /// Boolean + public bool Equals(EstimateNotificationRecipientsSuccessResponse input) + { + if (input == null) + { + return false; + } + return + ( + this.Count == input.Count || + this.Count.Equals(input.Count) + ) && + ( + this.UncappedCount == input.UncappedCount || + (this.UncappedCount != null && + this.UncappedCount.Equals(input.UncappedCount)) + ) && + ( + this.CapApplied == input.CapApplied || + this.CapApplied.Equals(input.CapApplied) + ) && + ( + this.MobileSuppressed == input.MobileSuppressed || + this.MobileSuppressed.Equals(input.MobileSuppressed) + ) && + ( + this.MobileExcludedCount == input.MobileExcludedCount || + this.MobileExcludedCount.Equals(input.MobileExcludedCount) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.Count.GetHashCode(); + if (this.UncappedCount != null) + { + hashCode = (hashCode * 59) + this.UncappedCount.GetHashCode(); + } + hashCode = (hashCode * 59) + this.CapApplied.GetHashCode(); + hashCode = (hashCode * 59) + this.MobileSuppressed.GetHashCode(); + hashCode = (hashCode * 59) + this.MobileExcludedCount.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + public IEnumerable Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/src/OneSignalApi/Model/Notification.cs b/src/OneSignalApi/Model/Notification.cs index 6948035..cb17f99 100644 --- a/src/OneSignalApi/Model/Notification.cs +++ b/src/OneSignalApi/Model/Notification.cs @@ -216,7 +216,7 @@ protected Notification() { } /// /// Initializes a new instance of the class. /// - /// 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. . /// 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\"] . /// 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 . /// 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. . @@ -464,9 +464,9 @@ protected Notification() { } } /// - /// 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. /// - /// 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. [DataMember(Name = "included_segments", EmitDefaultValue = false)] public List IncludedSegments { get; set; } diff --git a/src/OneSignalApi/Model/NotificationWithMeta.cs b/src/OneSignalApi/Model/NotificationWithMeta.cs index 88c3260..e085760 100644 --- a/src/OneSignalApi/Model/NotificationWithMeta.cs +++ b/src/OneSignalApi/Model/NotificationWithMeta.cs @@ -216,7 +216,7 @@ protected NotificationWithMeta() { } /// /// Initializes a new instance of the class. /// - /// 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. . /// 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\"] . /// 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 . /// 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. . @@ -488,9 +488,9 @@ protected NotificationWithMeta() { } } /// - /// 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. /// - /// 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. [DataMember(Name = "included_segments", EmitDefaultValue = false)] public List IncludedSegments { get; set; } diff --git a/src/OneSignalApi/Model/SegmentNotificationTarget.cs b/src/OneSignalApi/Model/SegmentNotificationTarget.cs index ae30877..11d3a2d 100644 --- a/src/OneSignalApi/Model/SegmentNotificationTarget.cs +++ b/src/OneSignalApi/Model/SegmentNotificationTarget.cs @@ -34,7 +34,7 @@ public partial class SegmentNotificationTarget : IEquatable /// Initializes a new instance of the class. /// - /// 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. . /// 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 SegmentNotificationTarget(List includedSegments = default(List), List excludedSegments = default(List)) { @@ -43,9 +43,9 @@ public partial class SegmentNotificationTarget : IEquatable - /// 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. /// - /// 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. [DataMember(Name = "included_segments", EmitDefaultValue = false)] public List IncludedSegments { get; set; }