Skip to content

Commit

Permalink
Merge pull request #80 from OneSignal/api
Browse files Browse the repository at this point in the history
Release 5.0.0-alpha-01
  • Loading branch information
nan-li authored May 2, 2024
2 parents e942dd2 + c7ce91a commit c5c1f5a
Show file tree
Hide file tree
Showing 83 changed files with 2,253 additions and 4,252 deletions.
1,179 changes: 401 additions & 778 deletions DefaultApi.md

Large diffs are not rendered by default.

1,898 changes: 682 additions & 1,216 deletions apis/DefaultApi.ts

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface TokenProvider {
/**
* Applies http authentication to the request context.
*/
export class AppKeyAuthentication implements SecurityAuthentication {
export class RestApiKeyAuthentication implements SecurityAuthentication {
/**
* Configures the http authentication with the required details.
*
Expand All @@ -36,7 +36,7 @@ export class AppKeyAuthentication implements SecurityAuthentication {
public constructor(private tokenProvider: TokenProvider) {}

public getName(): string {
return "app_key";
return "rest_api_key";
}

public async applySecurityAuthentication(context: RequestContext) {
Expand All @@ -47,7 +47,7 @@ export class AppKeyAuthentication implements SecurityAuthentication {
/**
* Applies http authentication to the request context.
*/
export class UserKeyAuthentication implements SecurityAuthentication {
export class UserAuthKeyAuthentication implements SecurityAuthentication {
/**
* Configures the http authentication with the required details.
*
Expand All @@ -56,7 +56,7 @@ export class UserKeyAuthentication implements SecurityAuthentication {
public constructor(private tokenProvider: TokenProvider) {}

public getName(): string {
return "user_key";
return "user_auth_key";
}

public async applySecurityAuthentication(context: RequestContext) {
Expand All @@ -67,8 +67,8 @@ export class UserKeyAuthentication implements SecurityAuthentication {

export type AuthMethods = {
"default"?: SecurityAuthentication,
"app_key"?: SecurityAuthentication,
"user_key"?: SecurityAuthentication
"rest_api_key"?: SecurityAuthentication,
"user_auth_key"?: SecurityAuthentication
}

export type ApiKeyConfiguration = string;
Expand All @@ -78,8 +78,8 @@ export type OAuth2Configuration = { accessToken: string };

export type AuthMethodsConfiguration = {
"default"?: SecurityAuthentication,
"app_key"?: HttpBearerConfiguration,
"user_key"?: HttpBearerConfiguration
"rest_api_key"?: HttpBearerConfiguration,
"user_auth_key"?: HttpBearerConfiguration
}

/**
Expand All @@ -94,15 +94,15 @@ export function configureAuthMethods(config: AuthMethodsConfiguration | undefine
}
authMethods["default"] = config["default"]

if (config["app_key"]) {
authMethods["app_key"] = new AppKeyAuthentication(
config["app_key"]["tokenProvider"]
if (config["rest_api_key"]) {
authMethods["rest_api_key"] = new RestApiKeyAuthentication(
config["rest_api_key"]["tokenProvider"]
);
}

if (config["user_key"]) {
authMethods["user_key"] = new UserKeyAuthentication(
config["user_key"]["tokenProvider"]
if (config["user_auth_key"]) {
authMethods["user_auth_key"] = new UserAuthKeyAuthentication(
config["user_auth_key"]["tokenProvider"]
);
}

Expand Down
12 changes: 6 additions & 6 deletions configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export interface ConfigurationParameters {
/**
* Faster way to configure authentication methods
*/
appKey?: string;
userKey?: string;
restApiKey?: string;
userAuthKey?: string;
}

/**
Expand All @@ -58,14 +58,14 @@ export interface ConfigurationParameters {
export function createConfiguration(conf: ConfigurationParameters): Configuration {

const authMethods: AuthMethodsConfiguration = {
'app_key': {
'rest_api_key': {
tokenProvider: {
getToken: () => conf.appKey || ''
getToken: () => conf.restApiKey || ''
}
},
'user_key': {
'user_auth_key': {
tokenProvider: {
getToken: () => conf.userKey || ''
getToken: () => conf.userAuthKey || ''
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion models/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* OneSignal
* A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
*
* API Version: 1.2.2
* API Version: 5.0.0-alpha-01
* Contact: [email protected]
*/

Expand Down
95 changes: 49 additions & 46 deletions models/BasicNotification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* OneSignal
* A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
*
* API Version: 1.2.2
* API Version: 5.0.0-alpha-01
* Contact: [email protected]
*/

import { BasicNotificationAllOf } from './BasicNotificationAllOf';
import { BasicNotificationAllOfAndroidBackgroundLayout } from './BasicNotificationAllOfAndroidBackgroundLayout';
import { Button } from './Button';
import { Filter } from './Filter';
import { FilterExpression } from './FilterExpression';
import { LanguageStringMap } from './LanguageStringMap';
import { NotificationTarget } from './NotificationTarget';
import { PlayerNotificationTargetIncludeAliases } from './PlayerNotificationTargetIncludeAliases';
import { StringMap } from './StringMap';
import { WebButton } from './WebButton';
import { HttpFile } from '../http/http';

export class BasicNotification {
Expand All @@ -25,13 +25,9 @@ export class BasicNotification {
*/
'excluded_segments'?: Array<string>;
/**
* Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call
* 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
*/
'include_player_ids'?: Array<string>;
/**
* Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [\"custom-id-assigned-by-api\"] 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 channel_for_external_user_ids to indicate you are sending a push or email or sms.
*/
'include_external_user_ids'?: Array<string>;
'include_subscription_ids'?: Array<string>;
/**
* Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: [email protected] Limit of 2,000 entries per REST API call
*/
Expand All @@ -41,30 +37,33 @@ export class BasicNotification {
*/
'include_phone_numbers'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call
*/
'include_ios_tokens'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call
*/
'include_wp_wns_uris'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call
*/
'include_amazon_reg_ids'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
*/
'include_chrome_reg_ids'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
*/
'include_chrome_web_reg_ids'?: Array<string>;
/**
* Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
* Not Recommended: Please consider using include_subscription_ids or include_aliases instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call
*/
'include_android_reg_ids'?: Array<string>;
'include_aliases'?: PlayerNotificationTargetIncludeAliases;
/**
* 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\"] } 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.
*/
'include_aliases'?: { [key: string]: Array<string>; };
'target_channel'?: BasicNotificationTargetChannelEnum;
'id'?: string;
'value'?: number;
Expand Down Expand Up @@ -114,20 +113,16 @@ export class BasicNotification {
*/
'is_chrome'?: boolean;
/**
* Indicates if the message type when targeting with include_external_user_ids for cases where an email, sms, and/or push subscribers have the same external user id. Example: Use the string \"push\" to indicate you are sending a push notification or the string \"email\"for sending emails or \"sms\"for sending SMS.
*/
'channel_for_external_user_ids'?: string;
/**
* Required: Your OneSignal Application ID, which can be found in Keys & IDs. It is a UUID and looks similar to 8250eaf6-1a58-489e-b136-7c74a864b434.
*/
'app_id': string;
/**
* Correlation and idempotency key. A request received with this parameter will first look for another notification with the same external_id. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it\'s important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same external_id will be sent again. See Idempotent Notification Requests for more details writeOnly: true
*/
'external_id'?: string;
'contents'?: StringMap;
'headings'?: StringMap;
'subtitle'?: StringMap;
'contents'?: LanguageStringMap;
'headings'?: LanguageStringMap;
'subtitle'?: LanguageStringMap;
/**
* Channel: Push Notifications Platform: Huawei A custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data. Example: {\"abc\": 123, \"foo\": \"bar\", \"event_performed\": true, \"amount\": 12.1}
*/
Expand Down Expand Up @@ -195,7 +190,7 @@ export class BasicNotification {
/**
* Channel: Push Notifications Platform: Chrome 48+ Add action buttons to the notification. The id field is required. Example: [{\"id\": \"like-button\", \"text\": \"Like\", \"icon\": \"http://i.imgur.com/N8SN8ZS.png\", \"url\": \"https://yoursite.com\"}, {\"id\": \"read-more-button\", \"text\": \"Read more\", \"icon\": \"http://i.imgur.com/MIxJp1L.png\", \"url\": \"https://yoursite.com\"}]
*/
'web_buttons'?: Array<Button>;
'web_buttons'?: Array<WebButton>;
/**
* Channel: Push Notifications Platform: iOS Category APS payload, use with registerUserNotificationSettings:categories in your Objective-C / Swift code. Example: calendar category which contains actions like accept and decline iOS 10+ This will trigger your UNNotificationContentExtension whose ID matches this category.
*/
Expand Down Expand Up @@ -374,6 +369,14 @@ export class BasicNotification {
*/
'summary_arg_count'?: number;
/**
* Channel: Push Notifications Platform: iOS 15+ A score to be set per notification to indicate how it should be displayed when grouped. Use a float between 0-1.
*/
'ios_relevance_score'?: number;
/**
* Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: [\'active\', \'passive\', \'time_sensitive\', \'critical\']. Default is active.
*/
'ios_interruption_level'?: string;
/**
* Channel: Email Required. The subject of the email.
*/
'email_subject'?: string;
Expand Down Expand Up @@ -405,7 +408,7 @@ export class BasicNotification {
* Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs.
*/
'sms_media_urls'?: Array<string>;
'filters'?: Array<Filter>;
'filters'?: Array<FilterExpression>;
/**
* Channel: All JSON object that can be used as a source of message personalization data for fields that support tag variable substitution. Push, SMS: Can accept up to 2048 bytes of valid JSON. Email: Can accept up to 10000 bytes of valid JSON. Example: {\"order_id\": 123, \"currency\": \"USD\", \"amount\": 25}
*/
Expand All @@ -427,14 +430,8 @@ export class BasicNotification {
"format": ""
},
{
"name": "include_player_ids",
"baseName": "include_player_ids",
"type": "Array<string>",
"format": ""
},
{
"name": "include_external_user_ids",
"baseName": "include_external_user_ids",
"name": "include_subscription_ids",
"baseName": "include_subscription_ids",
"type": "Array<string>",
"format": ""
},
Expand Down Expand Up @@ -489,7 +486,7 @@ export class BasicNotification {
{
"name": "include_aliases",
"baseName": "include_aliases",
"type": "PlayerNotificationTargetIncludeAliases",
"type": "{ [key: string]: Array<string>; }",
"format": ""
},
{
Expand Down Expand Up @@ -582,12 +579,6 @@ export class BasicNotification {
"type": "boolean",
"format": ""
},
{
"name": "channel_for_external_user_ids",
"baseName": "channel_for_external_user_ids",
"type": "string",
"format": ""
},
{
"name": "app_id",
"baseName": "app_id",
Expand All @@ -603,19 +594,19 @@ export class BasicNotification {
{
"name": "contents",
"baseName": "contents",
"type": "StringMap",
"type": "LanguageStringMap",
"format": ""
},
{
"name": "headings",
"baseName": "headings",
"type": "StringMap",
"type": "LanguageStringMap",
"format": ""
},
{
"name": "subtitle",
"baseName": "subtitle",
"type": "StringMap",
"type": "LanguageStringMap",
"format": ""
},
{
Expand Down Expand Up @@ -717,7 +708,7 @@ export class BasicNotification {
{
"name": "web_buttons",
"baseName": "web_buttons",
"type": "Array<Button>",
"type": "Array<WebButton>",
"format": ""
},
{
Expand Down Expand Up @@ -990,6 +981,18 @@ export class BasicNotification {
"type": "number",
"format": ""
},
{
"name": "ios_relevance_score",
"baseName": "ios_relevance_score",
"type": "number",
"format": ""
},
{
"name": "ios_interruption_level",
"baseName": "ios_interruption_level",
"type": "string",
"format": ""
},
{
"name": "email_subject",
"baseName": "email_subject",
Expand Down Expand Up @@ -1041,7 +1044,7 @@ export class BasicNotification {
{
"name": "filters",
"baseName": "filters",
"type": "Array<Filter>",
"type": "Array<FilterExpression>",
"format": ""
},
{
Expand Down
Loading

0 comments on commit c5c1f5a

Please sign in to comment.