├── .npmignore ├── .gitignore ├── RELEASE_INSTRUCTIONS.md ├── .github ├── workflows │ ├── project.yml │ ├── npm_deploy.yml │ ├── asana-add-comment.yml │ ├── asana-create-task.yml │ └── asana-update-issue.yml ├── ISSUE_TEMPLATE │ ├── general-feedback.yml │ ├── ask-question.yml │ └── bug-report.yml └── pull_request_template.md ├── index.ts ├── apis ├── exception.ts └── baseapi.ts ├── rxjsStub.ts ├── models ├── GenericSuccessBoolResponse.ts ├── UpdateLiveActivitySuccessResponse.ts ├── UserIdentityBody.ts ├── ExportEventsSuccessResponse.ts ├── ExportSubscriptionsSuccessResponse.ts ├── OutcomesData.ts ├── StartLiveActivitySuccessResponse.ts ├── CustomEventsRequest.ts ├── SubscriptionBody.ts ├── PropertiesBody.ts ├── TransferSubscriptionRequestBody.ts ├── ApiKeyTokensListResponse.ts ├── CopyTemplateRequest.ts ├── CreateUserConflictResponseErrorsItemsMeta.ts ├── TemplatesListResponse.ts ├── RateLimitError.ts ├── CreateUserConflictResponse.ts ├── Operator.ts ├── CreateApiKeyResponse.ts ├── CreateSegmentConflictResponse.ts ├── CreateSegmentSuccessResponse.ts ├── NotificationHistorySuccessResponse.ts ├── Button.ts ├── GenericError.ts ├── NotificationAllOf.ts ├── OutcomeData.ts ├── PropertiesDeltas.ts ├── WebButton.ts ├── CreateNotificationSuccessResponse.ts ├── User.ts ├── CreateApiKeyRequest.ts ├── CreateUserConflictResponseErrorsInner.ts ├── UpdateApiKeyRequest.ts ├── UpdateUserRequest.ts ├── NotificationSlice.ts ├── Segment.ts ├── Purchase.ts ├── SegmentNotificationTarget.ts ├── PlatformDeliveryDataSmsAllOf.ts ├── ExportSubscriptionsRequestBody.ts ├── GetNotificationHistoryRequestBody.ts ├── GetSegmentsSuccessResponse.ts ├── BasicNotificationAllOfAndroidBackgroundLayout.ts ├── ApiKeyToken.ts ├── DeliveryData.ts ├── TemplateResource.ts ├── CustomEvent.ts ├── SegmentData.ts ├── UpdateTemplateRequest.ts ├── PlatformDeliveryData.ts ├── all.ts ├── PlatformDeliveryDataEmailAllOf.ts ├── CreateTemplateRequest.ts ├── PropertiesObject.ts ├── Filter.ts ├── FilterExpression.ts ├── UpdateLiveActivityRequest.ts ├── Subscription.ts ├── NotificationWithMetaAllOf.ts ├── SubscriptionNotificationTarget.ts ├── StartLiveActivityRequest.ts ├── NotificationTarget.ts ├── LanguageStringMap.ts └── App.ts ├── tsconfig.json ├── package.json ├── http ├── isomorphic-fetch.ts └── http.ts ├── LICENSE ├── util.ts ├── CHANGELOG.md ├── .releaserc.json ├── servers.ts ├── middleware.ts ├── configuration.ts ├── auth └── auth.ts └── yarn.lock /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist 2 | node_modules 3 | -------------------------------------------------------------------------------- /RELEASE_INSTRUCTIONS.md: -------------------------------------------------------------------------------- 1 | ## NodeJS 2 | `npm publish . --access public` -------------------------------------------------------------------------------- /.github/workflows/project.yml: -------------------------------------------------------------------------------- 1 | name: Add issues to project 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | add-to-project: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Add issue to project 13 | uses: actions/add-to-project@v1.0.2 14 | with: 15 | # SDK Server Project 16 | project-url: https://github.com/orgs/OneSignal/projects/11 17 | github-token: ${{ secrets.GH_PROJECTS_TOKEN }} 18 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | export * from "./http/http"; 2 | export * from "./auth/auth"; 3 | export * from "./models/all"; 4 | export { createConfiguration } from "./configuration" 5 | export { Configuration } from "./configuration" 6 | export * from "./apis/exception"; 7 | export * from "./servers"; 8 | export { RequiredError } from "./apis/baseapi"; 9 | 10 | export { PromiseMiddleware as Middleware } from './middleware'; 11 | export { PromiseDefaultApi as DefaultApi } from './types/PromiseAPI'; 12 | 13 | -------------------------------------------------------------------------------- /apis/exception.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Represents an error caused by an api call i.e. it has attributes for a HTTP status code 3 | * and the returned body object. 4 | * 5 | * Example 6 | * API returns a ErrorMessageObject whenever HTTP status code is not in [200, 299] 7 | * => ApiException(404, someErrorMessageObject) 8 | * 9 | */ 10 | export class ApiException extends Error { 11 | public constructor(public code: number, message: string, public body: T, public headers: { [key: string]: string; }) { 12 | super("HTTP-Code: " + code + "\nMessage: " + message + "\nBody: " + JSON.stringify(body) + "\nHeaders: " + 13 | JSON.stringify(headers)) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /rxjsStub.ts: -------------------------------------------------------------------------------- 1 | export class Observable { 2 | constructor(private promise: Promise) {} 3 | 4 | toPromise() { 5 | return this.promise; 6 | } 7 | 8 | pipe(callback: (value: T) => S | Promise): Observable { 9 | return new Observable(this.promise.then(callback)); 10 | } 11 | } 12 | 13 | export function from(promise: Promise) { 14 | return new Observable(promise); 15 | } 16 | 17 | export function of(value: T) { 18 | return new Observable(Promise.resolve(value)); 19 | } 20 | 21 | export function mergeMap(callback: (value: T) => Observable) { 22 | return (value: T) => callback(value).toPromise(); 23 | } 24 | 25 | export function map(callback: any) { 26 | return callback; 27 | } 28 | -------------------------------------------------------------------------------- /apis/baseapi.ts: -------------------------------------------------------------------------------- 1 | import { Configuration } from '../configuration' 2 | 3 | /** 4 | * 5 | * @export 6 | */ 7 | export const COLLECTION_FORMATS = { 8 | csv: ",", 9 | ssv: " ", 10 | tsv: "\t", 11 | pipes: "|", 12 | }; 13 | 14 | 15 | /** 16 | * 17 | * @export 18 | * @class BaseAPI 19 | */ 20 | export class BaseAPIRequestFactory { 21 | 22 | constructor(protected configuration: Configuration) { 23 | } 24 | }; 25 | 26 | /** 27 | * 28 | * @export 29 | * @class RequiredError 30 | * @extends {Error} 31 | */ 32 | export class RequiredError extends Error { 33 | name: "RequiredError" = "RequiredError"; 34 | constructor(public api: string, public method: string, public field: string) { 35 | super("Required parameter " + field + " was null or undefined when calling " + api + "." + method + "."); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general-feedback.yml: -------------------------------------------------------------------------------- 1 | name: 📣 General feedback 2 | description: Tell us what's on your mind 3 | title: "[Feedback]: " 4 | labels: ["Feedback"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for sharing your valuable feedback! 10 | - type: textarea 11 | id: feedback 12 | attributes: 13 | label: What's on your mind? 14 | description: Feedback regarding this API library. 15 | placeholder: Share your feedback... 16 | validations: 17 | required: true 18 | - type: checkboxes 19 | id: terms 20 | attributes: 21 | label: Code of Conduct 22 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 23 | options: 24 | - label: I agree to follow this project's Code of Conduct 25 | required: true 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/ask-question.yml: -------------------------------------------------------------------------------- 1 | name: 🙋‍♂️ Ask a question 2 | description: Tell us what's on your mind 3 | title: "[Question]: " 4 | labels: ["Question"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Having issues integrating this API library? 10 | - type: textarea 11 | id: question 12 | attributes: 13 | label: How can we help? 14 | description: Specific question regarding integrating this API library. 15 | placeholder: How do I...? 16 | validations: 17 | required: true 18 | - type: checkboxes 19 | id: terms 20 | attributes: 21 | label: Code of Conduct 22 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 23 | options: 24 | - label: I agree to follow this project's Code of Conduct 25 | required: true 26 | -------------------------------------------------------------------------------- /models/GenericSuccessBoolResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GenericSuccessBoolResponse { 12 | 'success'?: boolean; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "success", 19 | "baseName": "success", 20 | "type": "boolean", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return GenericSuccessBoolResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/UpdateLiveActivitySuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class UpdateLiveActivitySuccessResponse { 12 | 'id'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "id", 19 | "baseName": "id", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return UpdateLiveActivitySuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/UserIdentityBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class UserIdentityBody { 12 | 'identity'?: { [key: string]: string; }; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "identity", 19 | "baseName": "identity", 20 | "type": "{ [key: string]: string; }", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return UserIdentityBody.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/ExportEventsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportEventsSuccessResponse { 12 | 'csv_file_url'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "csv_file_url", 19 | "baseName": "csv_file_url", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return ExportEventsSuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | /* Basic Options */ 5 | "target": "es5", 6 | "moduleResolution": "node", 7 | "declaration": true, 8 | 9 | /* Additional Checks */ 10 | "noUnusedLocals": false, /* Report errors on unused locals. */ // TODO: reenable (unused imports!) 11 | "noUnusedParameters": false, /* Report errors on unused parameters. */ // TODO: set to true again 12 | "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 13 | "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 14 | 15 | "removeComments": true, 16 | "sourceMap": true, 17 | "outDir": "./dist", 18 | "noLib": false, 19 | "lib": [ "es6" ], 20 | }, 21 | "exclude": [ 22 | "dist", 23 | "node_modules" 24 | ], 25 | "filesGlob": [ 26 | "./**/*.ts", 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /models/ExportSubscriptionsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportSubscriptionsSuccessResponse { 12 | 'csv_file_url'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "csv_file_url", 19 | "baseName": "csv_file_url", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return ExportSubscriptionsSuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/OutcomesData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { OutcomeData } from './OutcomeData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class OutcomesData { 13 | 'outcomes'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "outcomes", 20 | "baseName": "outcomes", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return OutcomesData.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/StartLiveActivitySuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class StartLiveActivitySuccessResponse { 12 | 'notification_id'?: string; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "notification_id", 19 | "baseName": "notification_id", 20 | "type": "string", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return StartLiveActivitySuccessResponse.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/CustomEventsRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { CustomEvent } from './CustomEvent'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CustomEventsRequest { 13 | 'events': Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "events", 20 | "baseName": "events", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return CustomEventsRequest.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/SubscriptionBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Subscription } from './Subscription'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class SubscriptionBody { 13 | 'subscription'?: Subscription; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "subscription", 20 | "baseName": "subscription", 21 | "type": "Subscription", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return SubscriptionBody.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/PropertiesBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesObject } from './PropertiesObject'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesBody { 13 | 'properties'?: PropertiesObject; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "properties", 20 | "baseName": "properties", 21 | "type": "PropertiesObject", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return PropertiesBody.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/TransferSubscriptionRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class TransferSubscriptionRequestBody { 12 | 'identity'?: { [key: string]: string; }; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "identity", 19 | "baseName": "identity", 20 | "type": "{ [key: string]: string; }", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return TransferSubscriptionRequestBody.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/ApiKeyTokensListResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { ApiKeyToken } from './ApiKeyToken'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class ApiKeyTokensListResponse { 13 | 'tokens'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "tokens", 20 | "baseName": "tokens", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return ApiKeyTokensListResponse.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /models/CopyTemplateRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CopyTemplateRequest { 12 | /** 13 | * Destination OneSignal App ID in UUID v4 format. 14 | */ 15 | 'target_app_id': string; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "target_app_id", 22 | "baseName": "target_app_id", 23 | "type": "string", 24 | "format": "" 25 | } ]; 26 | 27 | static getAttributeTypeMap() { 28 | return CopyTemplateRequest.attributeTypeMap; 29 | } 30 | 31 | public constructor() { 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponseErrorsItemsMeta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateUserConflictResponseErrorsItemsMeta { 12 | 'conflicting_aliases'?: object; 13 | 14 | static readonly discriminator: string | undefined = undefined; 15 | 16 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 17 | { 18 | "name": "conflicting_aliases", 19 | "baseName": "conflicting_aliases", 20 | "type": "object", 21 | "format": "" 22 | } ]; 23 | 24 | static getAttributeTypeMap() { 25 | return CreateUserConflictResponseErrorsItemsMeta.attributeTypeMap; 26 | } 27 | 28 | public constructor() { 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /models/TemplatesListResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { TemplateResource } from './TemplateResource'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class TemplatesListResponse { 13 | 'templates'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "templates", 20 | "baseName": "templates", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return TemplatesListResponse.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@onesignal/node-onesignal", 3 | "version": "5.3.1-beta1", 4 | "description": "OpenAPI client for @onesignal/node-onesignal", 5 | "author": "OpenAPI-Generator Contributors", 6 | "keywords": [ 7 | "fetch", 8 | "typescript", 9 | "openapi-client", 10 | "openapi-generator" 11 | ], 12 | "license": "MIT", 13 | "homepage": "https://github.com/OneSignal/onesignal-node-api", 14 | "main": "./dist/index.js", 15 | "type": "commonjs", 16 | "exports": { 17 | ".": "./dist/index.js" 18 | }, 19 | "typings": "./dist/index.d.ts", 20 | "files": [ 21 | "dist/**/*.js", 22 | "dist/**/*.d.ts", 23 | "README.md", 24 | "LICENSE" 25 | ], 26 | "scripts": { 27 | "build": "tsc", 28 | "prepare": "npm run build" 29 | }, 30 | "dependencies": { 31 | "form-data": "^2.5.0", 32 | "btoa": "^1.2.1", 33 | "es6-promise": "^4.2.4", 34 | "url-parse": "^1.4.3" 35 | }, 36 | "devDependencies": { 37 | "typescript": "^4.0", 38 | "@types/url-parse": "1.4.4", 39 | "@types/node": "24.1.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /models/RateLimitError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class RateLimitError { 12 | 'errors'?: Array; 13 | 'limit'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "errors", 20 | "baseName": "errors", 21 | "type": "Array", 22 | "format": "" 23 | }, 24 | { 25 | "name": "limit", 26 | "baseName": "limit", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return RateLimitError.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { CreateUserConflictResponseErrorsInner } from './CreateUserConflictResponseErrorsInner'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CreateUserConflictResponse { 13 | 'errors'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "errors", 20 | "baseName": "errors", 21 | "type": "Array", 22 | "format": "" 23 | } ]; 24 | 25 | static getAttributeTypeMap() { 26 | return CreateUserConflictResponse.attributeTypeMap; 27 | } 28 | 29 | public constructor() { 30 | } 31 | } 32 | 33 | -------------------------------------------------------------------------------- /http/isomorphic-fetch.ts: -------------------------------------------------------------------------------- 1 | import {HttpLibrary, RequestContext, ResponseContext} from './http'; 2 | import { from, Observable } from '../rxjsStub'; 3 | 4 | export class IsomorphicFetchHttpLibrary implements HttpLibrary { 5 | 6 | public send(request: RequestContext): Observable { 7 | let method = request.getHttpMethod().toString(); 8 | let body = request.getBody(); 9 | 10 | const resultPromise = fetch(request.getUrl(), { 11 | method: method, 12 | body: body as any, 13 | headers: request.getHeaders(), 14 | }).then((resp: any) => { 15 | const headers: { [name: string]: string } = {}; 16 | resp.headers.forEach((value: string, name: string) => { 17 | headers[name] = value; 18 | }); 19 | 20 | const body = { 21 | text: () => resp.text(), 22 | binary: () => resp.buffer() 23 | }; 24 | return new ResponseContext(resp.status, headers, body); 25 | }); 26 | 27 | return from>(resultPromise); 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /models/Operator.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Operator { 12 | /** 13 | * Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. 14 | */ 15 | 'operator'?: OperatorOperatorEnum; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "operator", 22 | "baseName": "operator", 23 | "type": "OperatorOperatorEnum", 24 | "format": "" 25 | } ]; 26 | 27 | static getAttributeTypeMap() { 28 | return Operator.attributeTypeMap; 29 | } 30 | 31 | public constructor() { 32 | } 33 | } 34 | 35 | 36 | export type OperatorOperatorEnum = "OR" | "AND" ; 37 | 38 | -------------------------------------------------------------------------------- /models/CreateApiKeyResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateApiKeyResponse { 12 | 'token_id'?: string; 13 | 'formatted_token'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "token_id", 20 | "baseName": "token_id", 21 | "type": "string", 22 | "format": "" 23 | }, 24 | { 25 | "name": "formatted_token", 26 | "baseName": "formatted_token", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return CreateApiKeyResponse.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/CreateSegmentConflictResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateSegmentConflictResponse { 12 | 'success'?: boolean; 13 | 'errors'?: Array; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "success", 20 | "baseName": "success", 21 | "type": "boolean", 22 | "format": "" 23 | }, 24 | { 25 | "name": "errors", 26 | "baseName": "errors", 27 | "type": "Array", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return CreateSegmentConflictResponse.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/CreateSegmentSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateSegmentSuccessResponse { 12 | 'success'?: boolean; 13 | /** 14 | * UUID of created segment 15 | */ 16 | 'id'?: string; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "success", 23 | "baseName": "success", 24 | "type": "boolean", 25 | "format": "" 26 | }, 27 | { 28 | "name": "id", 29 | "baseName": "id", 30 | "type": "string", 31 | "format": "" 32 | } ]; 33 | 34 | static getAttributeTypeMap() { 35 | return CreateSegmentSuccessResponse.attributeTypeMap; 36 | } 37 | 38 | public constructor() { 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /models/NotificationHistorySuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class NotificationHistorySuccessResponse { 12 | 'success'?: boolean; 13 | 'destination_url'?: string; 14 | 15 | static readonly discriminator: string | undefined = undefined; 16 | 17 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 18 | { 19 | "name": "success", 20 | "baseName": "success", 21 | "type": "boolean", 22 | "format": "" 23 | }, 24 | { 25 | "name": "destination_url", 26 | "baseName": "destination_url", 27 | "type": "string", 28 | "format": "" 29 | } ]; 30 | 31 | static getAttributeTypeMap() { 32 | return NotificationHistorySuccessResponse.attributeTypeMap; 33 | } 34 | 35 | public constructor() { 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /models/Button.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Button { 12 | 'id': string; 13 | 'text'?: string; 14 | 'icon'?: string; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "id", 21 | "baseName": "id", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "text", 27 | "baseName": "text", 28 | "type": "string", 29 | "format": "" 30 | }, 31 | { 32 | "name": "icon", 33 | "baseName": "icon", 34 | "type": "string", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return Button.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /.github/workflows/npm_deploy.yml: -------------------------------------------------------------------------------- 1 | name: NPM Publish 2 | on: 3 | push: 4 | branches: 5 | - main 6 | 7 | jobs: 8 | publish: 9 | name: Publish 10 | runs-on: ubuntu-latest 11 | permissions: 12 | contents: write 13 | issues: write 14 | pull-requests: write 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v5 18 | with: 19 | fetch-depth: 0 20 | token: ${{ secrets.GITHUB_TOKEN }} 21 | - name: Setup Node.js 22 | uses: actions/setup-node@v5 23 | with: 24 | node-version: "lts/*" 25 | registry-url: "https://registry.npmjs.org" 26 | - name: Install dependencies 27 | run: yarn install --frozen-lockfile 28 | - name: Publish to NPM and Create GitHub Release 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 31 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 32 | run: | 33 | npx -p semantic-release \ 34 | -p @semantic-release/changelog \ 35 | -p @semantic-release/git \ 36 | -p @semantic-release/github \ 37 | -p @semantic-release/npm \ 38 | -p conventional-changelog-conventionalcommits \ 39 | semantic-release 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Modified MIT License 2 | 3 | Copyright 2022 OneSignal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | 1. The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | 2. All copies of substantial portions of the Software may only be used in connection 16 | with services provided by OneSignal. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | -------------------------------------------------------------------------------- /models/GenericError.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GenericError { 12 | 'errors'?: any; 13 | 'success'?: boolean; 14 | 'reference'?: any; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "errors", 21 | "baseName": "errors", 22 | "type": "any", 23 | "format": "" 24 | }, 25 | { 26 | "name": "success", 27 | "baseName": "success", 28 | "type": "boolean", 29 | "format": "" 30 | }, 31 | { 32 | "name": "reference", 33 | "baseName": "reference", 34 | "type": "any", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return GenericError.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /util.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Returns if a specific http code is in a given code range 3 | * where the code range is defined as a combination of digits 4 | * and "X" (the letter X) with a length of 3 5 | * 6 | * @param codeRange string with length 3 consisting of digits and "X" (the letter X) 7 | * @param code the http status code to be checked against the code range 8 | */ 9 | export function isCodeInRange(codeRange: string, code: number): boolean { 10 | // This is how the default value is encoded in OAG 11 | if (codeRange === "0") { 12 | return true; 13 | } 14 | if (codeRange == code.toString()) { 15 | return true; 16 | } else { 17 | const codeString = code.toString(); 18 | if (codeString.length != codeRange.length) { 19 | return false; 20 | } 21 | for (let i = 0; i < codeString.length; i++) { 22 | if (codeRange.charAt(i) != "X" && codeRange.charAt(i) != codeString.charAt(i)) { 23 | return false; 24 | } 25 | } 26 | return true; 27 | } 28 | } 29 | 30 | /** 31 | * Returns if it can consume form 32 | * 33 | * @param consumes array 34 | */ 35 | export function canConsumeForm(contentTypes: string[]): boolean { 36 | return contentTypes.indexOf('multipart/form-data') !== -1 37 | } 38 | -------------------------------------------------------------------------------- /models/NotificationAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class NotificationAllOf { 12 | /** 13 | * Channel: All Schedule notification for future delivery. API defaults to UTC -1100 Examples: All examples are the exact same date & time. \"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\" \"September 24th 2015, 2:00:00 pm UTC-07:00\" \"2015-09-24 14:00:00 GMT-0700\" \"Sept 24 2015 14:00:00 GMT-0700\" \"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\" Note: SMS currently only supports send_after parameter. 14 | */ 15 | 'send_after'?: string; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "send_after", 22 | "baseName": "send_after", 23 | "type": "string", 24 | "format": "date-time" 25 | } ]; 26 | 27 | static getAttributeTypeMap() { 28 | return NotificationAllOf.attributeTypeMap; 29 | } 30 | 31 | public constructor() { 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /models/OutcomeData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class OutcomeData { 12 | 'id': string; 13 | 'value': number; 14 | 'aggregation': OutcomeDataAggregationEnum; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "id", 21 | "baseName": "id", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "value", 27 | "baseName": "value", 28 | "type": "number", 29 | "format": "" 30 | }, 31 | { 32 | "name": "aggregation", 33 | "baseName": "aggregation", 34 | "type": "OutcomeDataAggregationEnum", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return OutcomeData.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | 47 | export type OutcomeDataAggregationEnum = "sum" | "count" ; 48 | 49 | -------------------------------------------------------------------------------- /models/PropertiesDeltas.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Purchase } from './Purchase'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesDeltas { 13 | 'session_time'?: number; 14 | 'session_count'?: number; 15 | 'purchases'?: Array; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "session_time", 22 | "baseName": "session_time", 23 | "type": "number", 24 | "format": "" 25 | }, 26 | { 27 | "name": "session_count", 28 | "baseName": "session_count", 29 | "type": "number", 30 | "format": "" 31 | }, 32 | { 33 | "name": "purchases", 34 | "baseName": "purchases", 35 | "type": "Array", 36 | "format": "" 37 | } ]; 38 | 39 | static getAttributeTypeMap() { 40 | return PropertiesDeltas.attributeTypeMap; 41 | } 42 | 43 | public constructor() { 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /models/WebButton.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class WebButton { 12 | 'id': string; 13 | 'text'?: string; 14 | 'icon'?: string; 15 | 'url'?: string; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "id", 22 | "baseName": "id", 23 | "type": "string", 24 | "format": "" 25 | }, 26 | { 27 | "name": "text", 28 | "baseName": "text", 29 | "type": "string", 30 | "format": "" 31 | }, 32 | { 33 | "name": "icon", 34 | "baseName": "icon", 35 | "type": "string", 36 | "format": "" 37 | }, 38 | { 39 | "name": "url", 40 | "baseName": "url", 41 | "type": "string", 42 | "format": "" 43 | } ]; 44 | 45 | static getAttributeTypeMap() { 46 | return WebButton.attributeTypeMap; 47 | } 48 | 49 | public constructor() { 50 | } 51 | } 52 | 53 | -------------------------------------------------------------------------------- /models/CreateNotificationSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateNotificationSuccessResponse { 12 | 'id'?: string; 13 | 'external_id'?: string; 14 | /** 15 | * Errors include the identifiers that are invalid, or that there are no subscribers. 16 | */ 17 | 'errors'?: any; 18 | 19 | static readonly discriminator: string | undefined = undefined; 20 | 21 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 22 | { 23 | "name": "id", 24 | "baseName": "id", 25 | "type": "string", 26 | "format": "" 27 | }, 28 | { 29 | "name": "external_id", 30 | "baseName": "external_id", 31 | "type": "string", 32 | "format": "" 33 | }, 34 | { 35 | "name": "errors", 36 | "baseName": "errors", 37 | "type": "any", 38 | "format": "" 39 | } ]; 40 | 41 | static getAttributeTypeMap() { 42 | return CreateNotificationSuccessResponse.attributeTypeMap; 43 | } 44 | 45 | public constructor() { 46 | } 47 | } 48 | 49 | -------------------------------------------------------------------------------- /models/User.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesObject } from './PropertiesObject'; 10 | import { Subscription } from './Subscription'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class User { 14 | 'properties'?: PropertiesObject; 15 | 'identity'?: { [key: string]: string; }; 16 | 'subscriptions'?: Array; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "properties", 23 | "baseName": "properties", 24 | "type": "PropertiesObject", 25 | "format": "" 26 | }, 27 | { 28 | "name": "identity", 29 | "baseName": "identity", 30 | "type": "{ [key: string]: string; }", 31 | "format": "" 32 | }, 33 | { 34 | "name": "subscriptions", 35 | "baseName": "subscriptions", 36 | "type": "Array", 37 | "format": "" 38 | } ]; 39 | 40 | static getAttributeTypeMap() { 41 | return User.attributeTypeMap; 42 | } 43 | 44 | public constructor() { 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /models/CreateApiKeyRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CreateApiKeyRequest { 12 | 'name'?: string; 13 | 'ip_allowlist_mode'?: CreateApiKeyRequestIpAllowlistModeEnum; 14 | 'ip_allowlist'?: Array; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "name", 21 | "baseName": "name", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "ip_allowlist_mode", 27 | "baseName": "ip_allowlist_mode", 28 | "type": "CreateApiKeyRequestIpAllowlistModeEnum", 29 | "format": "" 30 | }, 31 | { 32 | "name": "ip_allowlist", 33 | "baseName": "ip_allowlist", 34 | "type": "Array", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return CreateApiKeyRequest.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | 47 | export type CreateApiKeyRequestIpAllowlistModeEnum = "disabled" | "explicit" ; 48 | 49 | -------------------------------------------------------------------------------- /models/CreateUserConflictResponseErrorsInner.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { CreateUserConflictResponseErrorsItemsMeta } from './CreateUserConflictResponseErrorsItemsMeta'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CreateUserConflictResponseErrorsInner { 13 | 'code'?: string; 14 | 'title'?: string; 15 | 'meta'?: CreateUserConflictResponseErrorsItemsMeta; 16 | 17 | static readonly discriminator: string | undefined = undefined; 18 | 19 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 20 | { 21 | "name": "code", 22 | "baseName": "code", 23 | "type": "string", 24 | "format": "" 25 | }, 26 | { 27 | "name": "title", 28 | "baseName": "title", 29 | "type": "string", 30 | "format": "" 31 | }, 32 | { 33 | "name": "meta", 34 | "baseName": "meta", 35 | "type": "CreateUserConflictResponseErrorsItemsMeta", 36 | "format": "" 37 | } ]; 38 | 39 | static getAttributeTypeMap() { 40 | return CreateUserConflictResponseErrorsInner.attributeTypeMap; 41 | } 42 | 43 | public constructor() { 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /models/UpdateApiKeyRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class UpdateApiKeyRequest { 12 | 'name'?: string; 13 | 'ip_allowlist_mode'?: UpdateApiKeyRequestIpAllowlistModeEnum; 14 | 'ip_allowlist'?: Array; 15 | 16 | static readonly discriminator: string | undefined = undefined; 17 | 18 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 19 | { 20 | "name": "name", 21 | "baseName": "name", 22 | "type": "string", 23 | "format": "" 24 | }, 25 | { 26 | "name": "ip_allowlist_mode", 27 | "baseName": "ip_allowlist_mode", 28 | "type": "UpdateApiKeyRequestIpAllowlistModeEnum", 29 | "format": "" 30 | }, 31 | { 32 | "name": "ip_allowlist", 33 | "baseName": "ip_allowlist", 34 | "type": "Array", 35 | "format": "" 36 | } ]; 37 | 38 | static getAttributeTypeMap() { 39 | return UpdateApiKeyRequest.attributeTypeMap; 40 | } 41 | 42 | public constructor() { 43 | } 44 | } 45 | 46 | 47 | export type UpdateApiKeyRequestIpAllowlistModeEnum = "disabled" | "explicit" ; 48 | 49 | -------------------------------------------------------------------------------- /models/UpdateUserRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PropertiesDeltas } from './PropertiesDeltas'; 10 | import { PropertiesObject } from './PropertiesObject'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class UpdateUserRequest { 14 | 'properties'?: PropertiesObject; 15 | 'refresh_device_metadata'?: boolean; 16 | 'deltas'?: PropertiesDeltas; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "properties", 23 | "baseName": "properties", 24 | "type": "PropertiesObject", 25 | "format": "" 26 | }, 27 | { 28 | "name": "refresh_device_metadata", 29 | "baseName": "refresh_device_metadata", 30 | "type": "boolean", 31 | "format": "" 32 | }, 33 | { 34 | "name": "deltas", 35 | "baseName": "deltas", 36 | "type": "PropertiesDeltas", 37 | "format": "" 38 | } ]; 39 | 40 | static getAttributeTypeMap() { 41 | return UpdateUserRequest.attributeTypeMap; 42 | } 43 | 44 | public constructor() { 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /models/NotificationSlice.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { NotificationWithMeta } from './NotificationWithMeta'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class NotificationSlice { 13 | 'total_count'?: number; 14 | 'offset'?: number; 15 | 'limit'?: number; 16 | 'notifications'?: Array; 17 | 18 | static readonly discriminator: string | undefined = undefined; 19 | 20 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 21 | { 22 | "name": "total_count", 23 | "baseName": "total_count", 24 | "type": "number", 25 | "format": "" 26 | }, 27 | { 28 | "name": "offset", 29 | "baseName": "offset", 30 | "type": "number", 31 | "format": "" 32 | }, 33 | { 34 | "name": "limit", 35 | "baseName": "limit", 36 | "type": "number", 37 | "format": "" 38 | }, 39 | { 40 | "name": "notifications", 41 | "baseName": "notifications", 42 | "type": "Array", 43 | "format": "" 44 | } ]; 45 | 46 | static getAttributeTypeMap() { 47 | return NotificationSlice.attributeTypeMap; 48 | } 49 | 50 | public constructor() { 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## January 2023 5 | ### `1.0.0-beta9` - 09/06/2023 6 | - Added User model endpoints 7 | - Limitations 8 | - Recommend using only in development and staging environments for Alpha releases. 9 | - Aliases will be available in a future release 10 | - Outcomes will be available in a future release 11 | - Users are deleted when the last subscription is removed 12 | - Known issues 13 | - User properties may not update when Subscriptions are transferred 14 | - Identity Verification 15 | - We will be introducing JWT in follow up Alpha or Beta release 16 | - Extra disabled subscriptions are created when switching Users in the SDK. 17 | 18 | ## December 2022 19 | ### `1.0.0-beta8` - 11/14/2022 20 | - Added Live Activity endpoints 21 | - Fixed various bugs 22 | 23 | ## November 2022 24 | ### `1.0.0-beta5` - 11/14/2022 25 | #### Api Changes 26 | - Configuration setup has been simplified and streamlined. Now it looks like this: 27 | ```js 28 | const configuration = OneSignal.createConfiguration({ 29 | userKey: USER_KEY_TOKEN, 30 | appKey: APP_KEY_TOKEN, 31 | }); 32 | ``` 33 | - Player ID is no longer required when creating a player 34 | 35 | #### Fixed 36 | - Bug in the OpenAPI schema not allowing users to use filters when creating a notification. 37 | - Bug in the OpenAPI schema not allowing to set the notification name. 38 | 39 | 40 | ## February 2022 41 | 42 | ### `1.0.0-beta4` - 02/25/2022 43 | #### Added 44 | - .npmignore file 45 | 46 | #### Fixed 47 | - Missing `dist` directory since npm was ignoring it due to lack of .npmignore 48 | 49 | -------------------------------------------------------------------------------- /models/Segment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { FilterExpression } from './FilterExpression'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class Segment { 13 | /** 14 | * UUID of the segment. If left empty, it will be assigned automaticaly. 15 | */ 16 | 'id'?: string; 17 | /** 18 | * Name of the segment. You\'ll see this name on the Web UI. 19 | */ 20 | 'name': string; 21 | /** 22 | * Filter or operators the segment will have. For a list of available filters with details, please see Send to Users Based on Filters. 23 | */ 24 | 'filters': Array; 25 | 26 | static readonly discriminator: string | undefined = undefined; 27 | 28 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 29 | { 30 | "name": "id", 31 | "baseName": "id", 32 | "type": "string", 33 | "format": "" 34 | }, 35 | { 36 | "name": "name", 37 | "baseName": "name", 38 | "type": "string", 39 | "format": "" 40 | }, 41 | { 42 | "name": "filters", 43 | "baseName": "filters", 44 | "type": "Array", 45 | "format": "" 46 | } ]; 47 | 48 | static getAttributeTypeMap() { 49 | return Segment.attributeTypeMap; 50 | } 51 | 52 | public constructor() { 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /models/Purchase.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Purchase { 12 | /** 13 | * The unique identifier of the purchased item. 14 | */ 15 | 'sku': string; 16 | /** 17 | * The amount, in USD, spent purchasing the item. 18 | */ 19 | 'amount': string; 20 | /** 21 | * The 3-letter ISO 4217 currency code. Required for correct storage and conversion of amount. 22 | */ 23 | 'iso': string; 24 | 'count'?: number; 25 | 26 | static readonly discriminator: string | undefined = undefined; 27 | 28 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 29 | { 30 | "name": "sku", 31 | "baseName": "sku", 32 | "type": "string", 33 | "format": "" 34 | }, 35 | { 36 | "name": "amount", 37 | "baseName": "amount", 38 | "type": "string", 39 | "format": "" 40 | }, 41 | { 42 | "name": "iso", 43 | "baseName": "iso", 44 | "type": "string", 45 | "format": "" 46 | }, 47 | { 48 | "name": "count", 49 | "baseName": "count", 50 | "type": "number", 51 | "format": "" 52 | } ]; 53 | 54 | static getAttributeTypeMap() { 55 | return Purchase.attributeTypeMap; 56 | } 57 | 58 | public constructor() { 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /models/SegmentNotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SegmentNotificationTarget { 12 | /** 13 | * 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\"] 14 | */ 15 | 'included_segments'?: Array; 16 | /** 17 | * 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\"] 18 | */ 19 | 'excluded_segments'?: Array; 20 | 21 | static readonly discriminator: string | undefined = undefined; 22 | 23 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 24 | { 25 | "name": "included_segments", 26 | "baseName": "included_segments", 27 | "type": "Array", 28 | "format": "" 29 | }, 30 | { 31 | "name": "excluded_segments", 32 | "baseName": "excluded_segments", 33 | "type": "Array", 34 | "format": "" 35 | } ]; 36 | 37 | static getAttributeTypeMap() { 38 | return SegmentNotificationTarget.attributeTypeMap; 39 | } 40 | 41 | public constructor() { 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /models/PlatformDeliveryDataSmsAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class PlatformDeliveryDataSmsAllOf { 12 | /** 13 | * Number of messages reported as delivered successfully by the SMS service provider. 14 | */ 15 | 'provider_successful'?: number; 16 | /** 17 | * Number of recipients who didn\'t receive your message as reported by the SMS service provider. 18 | */ 19 | 'provider_failed'?: number; 20 | /** 21 | * Number of errors reported by the SMS service provider. 22 | */ 23 | 'provider_errored'?: number; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "provider_successful", 30 | "baseName": "provider_successful", 31 | "type": "number", 32 | "format": "" 33 | }, 34 | { 35 | "name": "provider_failed", 36 | "baseName": "provider_failed", 37 | "type": "number", 38 | "format": "" 39 | }, 40 | { 41 | "name": "provider_errored", 42 | "baseName": "provider_errored", 43 | "type": "number", 44 | "format": "" 45 | } ]; 46 | 47 | static getAttributeTypeMap() { 48 | return PlatformDeliveryDataSmsAllOf.attributeTypeMap; 49 | } 50 | 51 | public constructor() { 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /models/ExportSubscriptionsRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ExportSubscriptionsRequestBody { 12 | /** 13 | * Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256. 14 | */ 15 | 'extra_fields'?: Array; 16 | /** 17 | * Export all devices with a last_active timestamp greater than this time. Unixtime in seconds. 18 | */ 19 | 'last_active_since'?: string; 20 | /** 21 | * Export all devices belonging to the segment. 22 | */ 23 | 'segment_name'?: string; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "extra_fields", 30 | "baseName": "extra_fields", 31 | "type": "Array", 32 | "format": "" 33 | }, 34 | { 35 | "name": "last_active_since", 36 | "baseName": "last_active_since", 37 | "type": "string", 38 | "format": "" 39 | }, 40 | { 41 | "name": "segment_name", 42 | "baseName": "segment_name", 43 | "type": "string", 44 | "format": "" 45 | } ]; 46 | 47 | static getAttributeTypeMap() { 48 | return ExportSubscriptionsRequestBody.attributeTypeMap; 49 | } 50 | 51 | public constructor() { 52 | } 53 | } 54 | 55 | -------------------------------------------------------------------------------- /models/GetNotificationHistoryRequestBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class GetNotificationHistoryRequestBody { 12 | /** 13 | * -> \"sent\" - All the devices by player_id that were sent the specified notification_id. Notifications targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. \"clicked\" - All the devices by `player_id` that clicked the specified notification_id. 14 | */ 15 | 'events'?: GetNotificationHistoryRequestBodyEventsEnum; 16 | /** 17 | * The email address you would like the report sent. 18 | */ 19 | 'email'?: string; 20 | 'app_id'?: string; 21 | 22 | static readonly discriminator: string | undefined = undefined; 23 | 24 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 25 | { 26 | "name": "events", 27 | "baseName": "events", 28 | "type": "GetNotificationHistoryRequestBodyEventsEnum", 29 | "format": "" 30 | }, 31 | { 32 | "name": "email", 33 | "baseName": "email", 34 | "type": "string", 35 | "format": "" 36 | }, 37 | { 38 | "name": "app_id", 39 | "baseName": "app_id", 40 | "type": "string", 41 | "format": "" 42 | } ]; 43 | 44 | static getAttributeTypeMap() { 45 | return GetNotificationHistoryRequestBody.attributeTypeMap; 46 | } 47 | 48 | public constructor() { 49 | } 50 | } 51 | 52 | 53 | export type GetNotificationHistoryRequestBodyEventsEnum = "sent" | "clicked" ; 54 | 55 | -------------------------------------------------------------------------------- /models/GetSegmentsSuccessResponse.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { SegmentData } from './SegmentData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class GetSegmentsSuccessResponse { 13 | /** 14 | * The number of Segments in the response. 15 | */ 16 | 'total_count'?: number; 17 | /** 18 | * Set with the offset query parameter. Default 0. 19 | */ 20 | 'offset'?: number; 21 | /** 22 | * Maximum number of Segments returned. Default 300. 23 | */ 24 | 'limit'?: number; 25 | /** 26 | * An array containing the Segment information. 27 | */ 28 | 'segments'?: Array; 29 | 30 | static readonly discriminator: string | undefined = undefined; 31 | 32 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 33 | { 34 | "name": "total_count", 35 | "baseName": "total_count", 36 | "type": "number", 37 | "format": "" 38 | }, 39 | { 40 | "name": "offset", 41 | "baseName": "offset", 42 | "type": "number", 43 | "format": "" 44 | }, 45 | { 46 | "name": "limit", 47 | "baseName": "limit", 48 | "type": "number", 49 | "format": "" 50 | }, 51 | { 52 | "name": "segments", 53 | "baseName": "segments", 54 | "type": "Array", 55 | "format": "" 56 | } ]; 57 | 58 | static getAttributeTypeMap() { 59 | return GetSegmentsSuccessResponse.attributeTypeMap; 60 | } 61 | 62 | public constructor() { 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /models/BasicNotificationAllOfAndroidBackgroundLayout.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | /** 12 | * Channel: Push Notifications Platform: Android Allowing setting a background image for the notification. This is a JSON object containing the following keys. See our Background Image documentation for image sizes. 13 | */ 14 | export class BasicNotificationAllOfAndroidBackgroundLayout { 15 | /** 16 | * Asset file, android resource name, or URL to remote image. 17 | */ 18 | 'image'?: string; 19 | /** 20 | * Title text color ARGB Hex format. Example(Blue) \"FF0000FF\". 21 | */ 22 | 'headings_color'?: string; 23 | /** 24 | * Body text color ARGB Hex format. Example(Red) \"FFFF0000\". 25 | */ 26 | 'contents_color'?: string; 27 | 28 | static readonly discriminator: string | undefined = undefined; 29 | 30 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 31 | { 32 | "name": "image", 33 | "baseName": "image", 34 | "type": "string", 35 | "format": "" 36 | }, 37 | { 38 | "name": "headings_color", 39 | "baseName": "headings_color", 40 | "type": "string", 41 | "format": "" 42 | }, 43 | { 44 | "name": "contents_color", 45 | "baseName": "contents_color", 46 | "type": "string", 47 | "format": "" 48 | } ]; 49 | 50 | static getAttributeTypeMap() { 51 | return BasicNotificationAllOfAndroidBackgroundLayout.attributeTypeMap; 52 | } 53 | 54 | public constructor() { 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "branches": ["main"], 3 | "tagFormat": "${version}", 4 | "plugins": [ 5 | [ 6 | "@semantic-release/release-notes-generator", 7 | { 8 | "preset": "conventionalcommits", 9 | "writerOpts": { 10 | "types": [ 11 | { 12 | "type": "feat", 13 | "section": "Features" 14 | }, 15 | { 16 | "type": "fix", 17 | "section": "Bug Fixes" 18 | }, 19 | { 20 | "type": "docs", 21 | "section": "Documentation", 22 | "hidden": false 23 | }, 24 | { 25 | "type": "deps", 26 | "section": "Dependency Updates", 27 | "hidden": false 28 | }, 29 | { 30 | "type": "chore", 31 | "hidden": true 32 | }, 33 | { 34 | "type": "style", 35 | "hidden": true 36 | }, 37 | { 38 | "type": "refactor", 39 | "hidden": true 40 | }, 41 | { 42 | "type": "perf", 43 | "hidden": true 44 | }, 45 | { 46 | "type": "test", 47 | "hidden": true 48 | } 49 | ] 50 | } 51 | } 52 | ], 53 | [ 54 | "@semantic-release/changelog", 55 | { 56 | "changelogFile": "CHANGELOG.md", 57 | "changelogTitle": "# Changelog" 58 | } 59 | ], 60 | [ 61 | "@semantic-release/npm", 62 | { 63 | "pkgRoot": "." 64 | } 65 | ], 66 | [ 67 | "@semantic-release/git", 68 | { 69 | "assets": ["dist/**", "package.json", "CHANGELOG.md"], 70 | "message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes} [skip ci]" 71 | } 72 | ], 73 | "@semantic-release/github" 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.yml: -------------------------------------------------------------------------------- 1 | name: 🪳 Bug report 2 | description: File a bug report 3 | title: "[Bug]: " 4 | labels: ["Bug"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this bug report! 10 | - type: textarea 11 | id: what-happened 12 | attributes: 13 | label: What happened? 14 | description: Provide a thorough description of whats going on. 15 | placeholder: The latest version of the API library throws an exception when creating a notification targetting all Active Users. 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: reproduction-steps 20 | attributes: 21 | label: Steps to reproduce? 22 | description: Provide as much detail as posible to reproduce the issue. 23 | placeholder: | 24 | 1. Install vX.Y.Z of dependency 25 | 2. Run provided code snippet 26 | 3. Note that the app crashes 27 | render: Markdown 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: what-are-expectations 32 | attributes: 33 | label: What did you expect to happen? 34 | description: Also tell us, what did you expect to happen? 35 | placeholder: I expected the API library to properly deserialize any response returned by OneSignal. 36 | validations: 37 | required: true 38 | - type: textarea 39 | id: logs 40 | attributes: 41 | label: Relevant log output 42 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 43 | render: Shell 44 | - type: checkboxes 45 | id: terms 46 | attributes: 47 | label: Code of Conduct 48 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/OneSignal/api/blob/main/CONTRIBUTING.md) 49 | options: 50 | - label: I agree to follow this project's Code of Conduct 51 | required: true 52 | -------------------------------------------------------------------------------- /.github/workflows/asana-add-comment.yml: -------------------------------------------------------------------------------- 1 | name: Github --> Asana Add Comment Workflow 2 | 3 | on: 4 | issue_comment: 5 | types: [created] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: read 13 | steps: 14 | - name: Get Asana Task Corresponding to Issue 15 | env: 16 | ISSUE_ID: ${{ github.event.issue.id }} 17 | REPO_FULL_NAME: ${{ github.event.repository.full_name }} 18 | WORKSPACE_ID: "780103692902078" 19 | run: | 20 | REPO_SCOPED_ISSUE_ID="$REPO_FULL_NAME#$ISSUE_ID" 21 | 22 | curl --request GET \ 23 | --url "https://app.asana.com/api/1.0/workspaces/$WORKSPACE_ID/tasks/search?opt_fields=notes&text=$REPO_SCOPED_ISSUE_ID&sort_by=modified_at&sort_ascending=false" \ 24 | --header 'accept: application/json' \ 25 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 26 | --output response.json 27 | TASK_GID=$(jq -r '.data[0].gid' response.json) 28 | echo "TASK_GID=$TASK_GID" >> $GITHUB_ENV 29 | - name: Comment on Asana Task 30 | env: 31 | ISSUE_COMMENT: ${{ github.event.comment.body }} 32 | COMMENTER_NAME: ${{ github.event.comment.user.login }} 33 | run: | 34 | BODY_DATA=$(jq -n \ 35 | --arg text "$ISSUE_COMMENT" \ 36 | --arg commenter_name "$COMMENTER_NAME" \ 37 | '{ 38 | "data": { 39 | "text": "\($commenter_name) left a comment:\n\n\($text)", 40 | } 41 | }') 42 | curl --request POST \ 43 | --url https://app.asana.com/api/1.0/tasks/$TASK_GID/stories \ 44 | --header 'accept: application/json' \ 45 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 46 | --header 'content-type: application/json' \ 47 | --data "$BODY_DATA" -------------------------------------------------------------------------------- /servers.ts: -------------------------------------------------------------------------------- 1 | import { RequestContext, HttpMethod } from "./http/http"; 2 | 3 | export interface BaseServerConfiguration { 4 | makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext; 5 | } 6 | 7 | /** 8 | * 9 | * Represents the configuration of a server including its 10 | * url template and variable configuration based on the url. 11 | * 12 | */ 13 | export class ServerConfiguration implements BaseServerConfiguration { 14 | public constructor(private url: string, private variableConfiguration: T) {} 15 | 16 | /** 17 | * Sets the value of the variables of this server. 18 | * 19 | * @param variableConfiguration a partial variable configuration for the variables contained in the url 20 | */ 21 | public setVariables(variableConfiguration: Partial) { 22 | Object.assign(this.variableConfiguration, variableConfiguration); 23 | } 24 | 25 | public getConfiguration(): T { 26 | return this.variableConfiguration 27 | } 28 | 29 | private getUrl() { 30 | let replacedUrl = this.url; 31 | for (const key in this.variableConfiguration) { 32 | var re = new RegExp("{" + key + "}","g"); 33 | replacedUrl = replacedUrl.replace(re, this.variableConfiguration[key]); 34 | } 35 | return replacedUrl 36 | } 37 | 38 | /** 39 | * Creates a new request context for this server using the url with variables 40 | * replaced with their respective values and the endpoint of the request appended. 41 | * 42 | * @param endpoint the endpoint to be queried on the server 43 | * @param httpMethod httpMethod to be used 44 | * 45 | */ 46 | public makeRequestContext(endpoint: string, httpMethod: HttpMethod): RequestContext { 47 | return new RequestContext(this.getUrl() + endpoint, httpMethod); 48 | } 49 | } 50 | 51 | export const server1 = new ServerConfiguration<{ }>("https://api.onesignal.com", { }) 52 | 53 | export const servers = [server1]; 54 | -------------------------------------------------------------------------------- /models/ApiKeyToken.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class ApiKeyToken { 12 | 'token_id'?: string; 13 | 'updated_at'?: string; 14 | 'created_at'?: string; 15 | 'name'?: string; 16 | 'ip_allowlist_mode'?: ApiKeyTokenIpAllowlistModeEnum; 17 | 'ip_allowlist'?: Array; 18 | 19 | static readonly discriminator: string | undefined = undefined; 20 | 21 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 22 | { 23 | "name": "token_id", 24 | "baseName": "token_id", 25 | "type": "string", 26 | "format": "" 27 | }, 28 | { 29 | "name": "updated_at", 30 | "baseName": "updated_at", 31 | "type": "string", 32 | "format": "" 33 | }, 34 | { 35 | "name": "created_at", 36 | "baseName": "created_at", 37 | "type": "string", 38 | "format": "" 39 | }, 40 | { 41 | "name": "name", 42 | "baseName": "name", 43 | "type": "string", 44 | "format": "" 45 | }, 46 | { 47 | "name": "ip_allowlist_mode", 48 | "baseName": "ip_allowlist_mode", 49 | "type": "ApiKeyTokenIpAllowlistModeEnum", 50 | "format": "" 51 | }, 52 | { 53 | "name": "ip_allowlist", 54 | "baseName": "ip_allowlist", 55 | "type": "Array", 56 | "format": "" 57 | } ]; 58 | 59 | static getAttributeTypeMap() { 60 | return ApiKeyToken.attributeTypeMap; 61 | } 62 | 63 | public constructor() { 64 | } 65 | } 66 | 67 | 68 | export type ApiKeyTokenIpAllowlistModeEnum = "disabled" | "explicit" ; 69 | 70 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 2 | # READ AND DELETE THIS SECTION BEFORE SUBMITTING PR 3 | * **Fill out each _REQUIRED_ section** 4 | * **Fill out _OPTIONAL_ sections, remove section if it doesn't apply to your PR** 5 | * **Read and fill out each of the checklists below** 6 | * **Remove this section after reading** 7 | 8 | 9 | # Description 10 | ## One Line Summary 11 | **REQUIRED** - Very short description that summaries the changes in this PR. 12 | 13 | ## Details 14 | 15 | ### Motivation 16 | **REQUIRED -** Why is this code change being made? Or what is the goal of this PR? Examples: Fixes a specific bug, provides additional logging to debug future issues, feature to allow X. 17 | 18 | ### Scope 19 | **RECOMMEND - OPTIONAL -** What is intended to be effected. What is known not to change. Example: Notifications are grouped when parameter X is set, not enabled by default. 20 | 21 | ### OPTIONAL - Other 22 | **OPTIONAL -** Feel free to add any other sections or sub-sections that can explain your PR better. 23 | 24 | # Testing 25 | 26 | ## Manual testing 27 | **REQUIRED -** Explain what scenarios were tested and the environment. 28 | 29 | 30 | # Checklist 31 | ## Overview 32 | - [ ] I have filled out all **REQUIRED** sections above 33 | - [ ] PR does one thing 34 | - If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR 35 | - [ ] Any Public API changes are explained in the PR details and conform to existing APIs 36 | 37 | ## Testing 38 | - [ ] I have personally tested this on my device, or explained why that is not possible 39 | 40 | ## Final pass 41 | - [ ] Code is as readable as possible. 42 | - Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code. 43 | - [ ] I have reviewed this PR myself, ensuring it meets each checklist item 44 | - WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this. -------------------------------------------------------------------------------- /models/DeliveryData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class DeliveryData { 12 | /** 13 | * Number of messages delivered to push servers, mobile carriers, or email service providers. 14 | */ 15 | 'successful'?: number; 16 | /** 17 | * Number of messages sent to unsubscribed devices. 18 | */ 19 | 'failed'?: number; 20 | /** 21 | * Number of errors reported. 22 | */ 23 | 'errored'?: number; 24 | /** 25 | * Number of messages that were clicked. 26 | */ 27 | 'converted'?: number; 28 | /** 29 | * Number of devices that received the message. 30 | */ 31 | 'received'?: number; 32 | 33 | static readonly discriminator: string | undefined = undefined; 34 | 35 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 36 | { 37 | "name": "successful", 38 | "baseName": "successful", 39 | "type": "number", 40 | "format": "" 41 | }, 42 | { 43 | "name": "failed", 44 | "baseName": "failed", 45 | "type": "number", 46 | "format": "" 47 | }, 48 | { 49 | "name": "errored", 50 | "baseName": "errored", 51 | "type": "number", 52 | "format": "" 53 | }, 54 | { 55 | "name": "converted", 56 | "baseName": "converted", 57 | "type": "number", 58 | "format": "" 59 | }, 60 | { 61 | "name": "received", 62 | "baseName": "received", 63 | "type": "number", 64 | "format": "" 65 | } ]; 66 | 67 | static getAttributeTypeMap() { 68 | return DeliveryData.attributeTypeMap; 69 | } 70 | 71 | public constructor() { 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /models/TemplateResource.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class TemplateResource { 12 | 'id'?: string; 13 | 'name'?: string; 14 | 'created_at'?: string; 15 | 'updated_at'?: string; 16 | 'channel'?: TemplateResourceChannelEnum; 17 | /** 18 | * Rendered content and channel/platform flags for the template. 19 | */ 20 | 'content'?: { [key: string]: any; }; 21 | 22 | static readonly discriminator: string | undefined = undefined; 23 | 24 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 25 | { 26 | "name": "id", 27 | "baseName": "id", 28 | "type": "string", 29 | "format": "" 30 | }, 31 | { 32 | "name": "name", 33 | "baseName": "name", 34 | "type": "string", 35 | "format": "" 36 | }, 37 | { 38 | "name": "created_at", 39 | "baseName": "created_at", 40 | "type": "string", 41 | "format": "date-time" 42 | }, 43 | { 44 | "name": "updated_at", 45 | "baseName": "updated_at", 46 | "type": "string", 47 | "format": "date-time" 48 | }, 49 | { 50 | "name": "channel", 51 | "baseName": "channel", 52 | "type": "TemplateResourceChannelEnum", 53 | "format": "" 54 | }, 55 | { 56 | "name": "content", 57 | "baseName": "content", 58 | "type": "{ [key: string]: any; }", 59 | "format": "" 60 | } ]; 61 | 62 | static getAttributeTypeMap() { 63 | return TemplateResource.attributeTypeMap; 64 | } 65 | 66 | public constructor() { 67 | } 68 | } 69 | 70 | 71 | export type TemplateResourceChannelEnum = "push" | "email" | "sms" ; 72 | 73 | -------------------------------------------------------------------------------- /middleware.ts: -------------------------------------------------------------------------------- 1 | import {RequestContext, ResponseContext} from './http/http'; 2 | import { Observable, from } from './rxjsStub'; 3 | 4 | /** 5 | * Defines the contract for a middleware intercepting requests before 6 | * they are sent (but after the RequestContext was created) 7 | * and before the ResponseContext is unwrapped. 8 | * 9 | */ 10 | export interface Middleware { 11 | /** 12 | * Modifies the request before the request is sent. 13 | * 14 | * @param context RequestContext of a request which is about to be sent to the server 15 | * @returns an observable of the updated request context 16 | * 17 | */ 18 | pre(context: RequestContext): Observable; 19 | /** 20 | * Modifies the returned response before it is deserialized. 21 | * 22 | * @param context ResponseContext of a sent request 23 | * @returns an observable of the modified response context 24 | */ 25 | post(context: ResponseContext): Observable; 26 | } 27 | 28 | export class PromiseMiddlewareWrapper implements Middleware { 29 | 30 | public constructor(private middleware: PromiseMiddleware) { 31 | 32 | } 33 | 34 | pre(context: RequestContext): Observable { 35 | return from(this.middleware.pre(context)); 36 | } 37 | 38 | post(context: ResponseContext): Observable { 39 | return from(this.middleware.post(context)); 40 | } 41 | 42 | } 43 | 44 | /** 45 | * Defines the contract for a middleware intercepting requests before 46 | * they are sent (but after the RequestContext was created) 47 | * and before the ResponseContext is unwrapped. 48 | * 49 | */ 50 | export interface PromiseMiddleware { 51 | /** 52 | * Modifies the request before the request is sent. 53 | * 54 | * @param context RequestContext of a request which is about to be sent to the server 55 | * @returns an observable of the updated request context 56 | * 57 | */ 58 | pre(context: RequestContext): Promise; 59 | /** 60 | * Modifies the returned response before it is deserialized. 61 | * 62 | * @param context ResponseContext of a sent request 63 | * @returns an observable of the modified response context 64 | */ 65 | post(context: ResponseContext): Promise; 66 | } 67 | -------------------------------------------------------------------------------- /models/CustomEvent.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class CustomEvent { 12 | /** 13 | * The identifier or name of the event. Maximum 128 characters. 14 | */ 15 | 'name': string; 16 | /** 17 | * The external ID of the user targeted for the event. Either the user\'s External ID or OneSignal ID is required. 18 | */ 19 | 'external_id'?: string; 20 | /** 21 | * The OneSignal ID of the user targeted for the event. Either the user\'s External ID or OneSignal ID is required. 22 | */ 23 | 'onesignal_id'?: string; 24 | /** 25 | * Time the event occurred as an ISO8601 formatted string. Defaults to now if not included or past date provided. 26 | */ 27 | 'timestamp'?: string; 28 | /** 29 | * Properties or data related to the event, like {\"geography\": \"USA\"} 30 | */ 31 | 'payload'?: { [key: string]: any; }; 32 | 33 | static readonly discriminator: string | undefined = undefined; 34 | 35 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 36 | { 37 | "name": "name", 38 | "baseName": "name", 39 | "type": "string", 40 | "format": "" 41 | }, 42 | { 43 | "name": "external_id", 44 | "baseName": "external_id", 45 | "type": "string", 46 | "format": "" 47 | }, 48 | { 49 | "name": "onesignal_id", 50 | "baseName": "onesignal_id", 51 | "type": "string", 52 | "format": "" 53 | }, 54 | { 55 | "name": "timestamp", 56 | "baseName": "timestamp", 57 | "type": "string", 58 | "format": "date-time" 59 | }, 60 | { 61 | "name": "payload", 62 | "baseName": "payload", 63 | "type": "{ [key: string]: any; }", 64 | "format": "" 65 | } ]; 66 | 67 | static getAttributeTypeMap() { 68 | return CustomEvent.attributeTypeMap; 69 | } 70 | 71 | public constructor() { 72 | } 73 | } 74 | 75 | -------------------------------------------------------------------------------- /models/SegmentData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SegmentData { 12 | /** 13 | * The segment ID 14 | */ 15 | 'id'?: string; 16 | /** 17 | * The segment name 18 | */ 19 | 'name'?: string; 20 | /** 21 | * Date segment created 22 | */ 23 | 'created_at'?: string; 24 | /** 25 | * Date segment last updated 26 | */ 27 | 'updated_at'?: string; 28 | /** 29 | * The app id 30 | */ 31 | 'app_id'?: string; 32 | /** 33 | * Is the segment read only? 34 | */ 35 | 'read_only'?: boolean; 36 | /** 37 | * Is the segment active? 38 | */ 39 | 'is_active'?: boolean; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "id", 46 | "baseName": "id", 47 | "type": "string", 48 | "format": "" 49 | }, 50 | { 51 | "name": "name", 52 | "baseName": "name", 53 | "type": "string", 54 | "format": "" 55 | }, 56 | { 57 | "name": "created_at", 58 | "baseName": "created_at", 59 | "type": "string", 60 | "format": "" 61 | }, 62 | { 63 | "name": "updated_at", 64 | "baseName": "updated_at", 65 | "type": "string", 66 | "format": "" 67 | }, 68 | { 69 | "name": "app_id", 70 | "baseName": "app_id", 71 | "type": "string", 72 | "format": "" 73 | }, 74 | { 75 | "name": "read_only", 76 | "baseName": "read_only", 77 | "type": "boolean", 78 | "format": "" 79 | }, 80 | { 81 | "name": "is_active", 82 | "baseName": "is_active", 83 | "type": "boolean", 84 | "format": "" 85 | } ]; 86 | 87 | static getAttributeTypeMap() { 88 | return SegmentData.attributeTypeMap; 89 | } 90 | 91 | public constructor() { 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /models/UpdateTemplateRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { LanguageStringMap } from './LanguageStringMap'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class UpdateTemplateRequest { 13 | /** 14 | * Updated name of the template. 15 | */ 16 | 'name'?: string; 17 | 'contents'?: LanguageStringMap; 18 | /** 19 | * Set true for an Email template. 20 | */ 21 | 'is_email'?: boolean; 22 | /** 23 | * Subject of the email. 24 | */ 25 | 'email_subject'?: string; 26 | /** 27 | * Body of the email (HTML supported). 28 | */ 29 | 'email_body'?: string; 30 | /** 31 | * Set true for an SMS template. 32 | */ 33 | 'is_sms'?: boolean; 34 | /** 35 | * JSON string for dynamic content personalization. 36 | */ 37 | 'dynamic_content'?: string; 38 | 39 | static readonly discriminator: string | undefined = undefined; 40 | 41 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 42 | { 43 | "name": "name", 44 | "baseName": "name", 45 | "type": "string", 46 | "format": "" 47 | }, 48 | { 49 | "name": "contents", 50 | "baseName": "contents", 51 | "type": "LanguageStringMap", 52 | "format": "" 53 | }, 54 | { 55 | "name": "is_email", 56 | "baseName": "isEmail", 57 | "type": "boolean", 58 | "format": "" 59 | }, 60 | { 61 | "name": "email_subject", 62 | "baseName": "email_subject", 63 | "type": "string", 64 | "format": "" 65 | }, 66 | { 67 | "name": "email_body", 68 | "baseName": "email_body", 69 | "type": "string", 70 | "format": "" 71 | }, 72 | { 73 | "name": "is_sms", 74 | "baseName": "isSMS", 75 | "type": "boolean", 76 | "format": "" 77 | }, 78 | { 79 | "name": "dynamic_content", 80 | "baseName": "dynamic_content", 81 | "type": "string", 82 | "format": "" 83 | } ]; 84 | 85 | static getAttributeTypeMap() { 86 | return UpdateTemplateRequest.attributeTypeMap; 87 | } 88 | 89 | public constructor() { 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /models/PlatformDeliveryData.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { DeliveryData } from './DeliveryData'; 10 | import { PlatformDeliveryDataEmailAllOf } from './PlatformDeliveryDataEmailAllOf'; 11 | import { PlatformDeliveryDataSmsAllOf } from './PlatformDeliveryDataSmsAllOf'; 12 | import { HttpFile } from '../http/http'; 13 | 14 | /** 15 | * Hash of delivery statistics broken out by target device platform. 16 | */ 17 | export class PlatformDeliveryData { 18 | 'edge_web_push'?: DeliveryData; 19 | 'chrome_web_push'?: DeliveryData; 20 | 'firefox_web_push'?: DeliveryData; 21 | 'safari_web_push'?: DeliveryData; 22 | 'android'?: DeliveryData; 23 | 'ios'?: DeliveryData; 24 | 'sms'?: DeliveryData & PlatformDeliveryDataSmsAllOf; 25 | 'email'?: DeliveryData & PlatformDeliveryDataEmailAllOf; 26 | 27 | static readonly discriminator: string | undefined = undefined; 28 | 29 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 30 | { 31 | "name": "edge_web_push", 32 | "baseName": "edge_web_push", 33 | "type": "DeliveryData", 34 | "format": "" 35 | }, 36 | { 37 | "name": "chrome_web_push", 38 | "baseName": "chrome_web_push", 39 | "type": "DeliveryData", 40 | "format": "" 41 | }, 42 | { 43 | "name": "firefox_web_push", 44 | "baseName": "firefox_web_push", 45 | "type": "DeliveryData", 46 | "format": "" 47 | }, 48 | { 49 | "name": "safari_web_push", 50 | "baseName": "safari_web_push", 51 | "type": "DeliveryData", 52 | "format": "" 53 | }, 54 | { 55 | "name": "android", 56 | "baseName": "android", 57 | "type": "DeliveryData", 58 | "format": "" 59 | }, 60 | { 61 | "name": "ios", 62 | "baseName": "ios", 63 | "type": "DeliveryData", 64 | "format": "" 65 | }, 66 | { 67 | "name": "sms", 68 | "baseName": "sms", 69 | "type": "DeliveryData & PlatformDeliveryDataSmsAllOf", 70 | "format": "" 71 | }, 72 | { 73 | "name": "email", 74 | "baseName": "email", 75 | "type": "DeliveryData & PlatformDeliveryDataEmailAllOf", 76 | "format": "" 77 | } ]; 78 | 79 | static getAttributeTypeMap() { 80 | return PlatformDeliveryData.attributeTypeMap; 81 | } 82 | 83 | public constructor() { 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /models/all.ts: -------------------------------------------------------------------------------- 1 | export * from './ApiKeyToken' 2 | export * from './ApiKeyTokensListResponse' 3 | export * from './App' 4 | export * from './BasicNotification' 5 | export * from './BasicNotificationAllOf' 6 | export * from './BasicNotificationAllOfAndroidBackgroundLayout' 7 | export * from './Button' 8 | export * from './CopyTemplateRequest' 9 | export * from './CreateApiKeyRequest' 10 | export * from './CreateApiKeyResponse' 11 | export * from './CreateNotificationSuccessResponse' 12 | export * from './CreateSegmentConflictResponse' 13 | export * from './CreateSegmentSuccessResponse' 14 | export * from './CreateTemplateRequest' 15 | export * from './CreateUserConflictResponse' 16 | export * from './CreateUserConflictResponseErrorsInner' 17 | export * from './CreateUserConflictResponseErrorsItemsMeta' 18 | export * from './CustomEvent' 19 | export * from './CustomEventsRequest' 20 | export * from './DeliveryData' 21 | export * from './ExportEventsSuccessResponse' 22 | export * from './ExportSubscriptionsRequestBody' 23 | export * from './ExportSubscriptionsSuccessResponse' 24 | export * from './Filter' 25 | export * from './FilterExpression' 26 | export * from './GenericError' 27 | export * from './GenericSuccessBoolResponse' 28 | export * from './GetNotificationHistoryRequestBody' 29 | export * from './GetSegmentsSuccessResponse' 30 | export * from './LanguageStringMap' 31 | export * from './Notification' 32 | export * from './NotificationAllOf' 33 | export * from './NotificationHistorySuccessResponse' 34 | export * from './NotificationSlice' 35 | export * from './NotificationTarget' 36 | export * from './NotificationWithMeta' 37 | export * from './NotificationWithMetaAllOf' 38 | export * from './Operator' 39 | export * from './OutcomeData' 40 | export * from './OutcomesData' 41 | export * from './PlatformDeliveryData' 42 | export * from './PlatformDeliveryDataEmailAllOf' 43 | export * from './PlatformDeliveryDataSmsAllOf' 44 | export * from './PropertiesBody' 45 | export * from './PropertiesDeltas' 46 | export * from './PropertiesObject' 47 | export * from './Purchase' 48 | export * from './RateLimitError' 49 | export * from './Segment' 50 | export * from './SegmentData' 51 | export * from './SegmentNotificationTarget' 52 | export * from './StartLiveActivityRequest' 53 | export * from './StartLiveActivitySuccessResponse' 54 | export * from './Subscription' 55 | export * from './SubscriptionBody' 56 | export * from './SubscriptionNotificationTarget' 57 | export * from './TemplateResource' 58 | export * from './TemplatesListResponse' 59 | export * from './TransferSubscriptionRequestBody' 60 | export * from './UpdateApiKeyRequest' 61 | export * from './UpdateLiveActivityRequest' 62 | export * from './UpdateLiveActivitySuccessResponse' 63 | export * from './UpdateTemplateRequest' 64 | export * from './UpdateUserRequest' 65 | export * from './User' 66 | export * from './UserIdentityBody' 67 | export * from './WebButton' 68 | -------------------------------------------------------------------------------- /models/PlatformDeliveryDataEmailAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class PlatformDeliveryDataEmailAllOf { 12 | /** 13 | * Number of times an email has been opened. 14 | */ 15 | 'opened'?: number; 16 | /** 17 | * Number of unique recipients who have opened your email. 18 | */ 19 | 'unique_opens'?: number; 20 | /** 21 | * Number of clicked links from your email. This can include the recipient clicking email links multiple times. 22 | */ 23 | 'clicks'?: number; 24 | /** 25 | * Number of unique clicks that your recipients have made on links from your email. 26 | */ 27 | 'unique_clicks'?: number; 28 | /** 29 | * Number of recipients who registered as a hard or soft bounce and didn\'t receive your email. 30 | */ 31 | 'bounced'?: number; 32 | /** 33 | * Number of recipients who reported this email as spam. 34 | */ 35 | 'reported_spam'?: number; 36 | /** 37 | * Number of recipients who opted out of your emails using the unsubscribe link in this email. 38 | */ 39 | 'unsubscribed'?: number; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "opened", 46 | "baseName": "opened", 47 | "type": "number", 48 | "format": "" 49 | }, 50 | { 51 | "name": "unique_opens", 52 | "baseName": "unique_opens", 53 | "type": "number", 54 | "format": "" 55 | }, 56 | { 57 | "name": "clicks", 58 | "baseName": "clicks", 59 | "type": "number", 60 | "format": "" 61 | }, 62 | { 63 | "name": "unique_clicks", 64 | "baseName": "unique_clicks", 65 | "type": "number", 66 | "format": "" 67 | }, 68 | { 69 | "name": "bounced", 70 | "baseName": "bounced", 71 | "type": "number", 72 | "format": "" 73 | }, 74 | { 75 | "name": "reported_spam", 76 | "baseName": "reported_spam", 77 | "type": "number", 78 | "format": "" 79 | }, 80 | { 81 | "name": "unsubscribed", 82 | "baseName": "unsubscribed", 83 | "type": "number", 84 | "format": "" 85 | } ]; 86 | 87 | static getAttributeTypeMap() { 88 | return PlatformDeliveryDataEmailAllOf.attributeTypeMap; 89 | } 90 | 91 | public constructor() { 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /models/CreateTemplateRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { LanguageStringMap } from './LanguageStringMap'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class CreateTemplateRequest { 13 | /** 14 | * Your OneSignal App ID in UUID v4 format. 15 | */ 16 | 'app_id': string; 17 | /** 18 | * Name of the template. 19 | */ 20 | 'name': string; 21 | 'contents': LanguageStringMap; 22 | /** 23 | * Set true for an Email template. 24 | */ 25 | 'is_email'?: boolean; 26 | /** 27 | * Subject of the email. 28 | */ 29 | 'email_subject'?: string; 30 | /** 31 | * Body of the email (HTML supported). 32 | */ 33 | 'email_body'?: string; 34 | /** 35 | * Set true for an SMS template. 36 | */ 37 | 'is_sms'?: boolean; 38 | /** 39 | * JSON string for dynamic content personalization. 40 | */ 41 | 'dynamic_content'?: string; 42 | 43 | static readonly discriminator: string | undefined = undefined; 44 | 45 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 46 | { 47 | "name": "app_id", 48 | "baseName": "app_id", 49 | "type": "string", 50 | "format": "" 51 | }, 52 | { 53 | "name": "name", 54 | "baseName": "name", 55 | "type": "string", 56 | "format": "" 57 | }, 58 | { 59 | "name": "contents", 60 | "baseName": "contents", 61 | "type": "LanguageStringMap", 62 | "format": "" 63 | }, 64 | { 65 | "name": "is_email", 66 | "baseName": "isEmail", 67 | "type": "boolean", 68 | "format": "" 69 | }, 70 | { 71 | "name": "email_subject", 72 | "baseName": "email_subject", 73 | "type": "string", 74 | "format": "" 75 | }, 76 | { 77 | "name": "email_body", 78 | "baseName": "email_body", 79 | "type": "string", 80 | "format": "" 81 | }, 82 | { 83 | "name": "is_sms", 84 | "baseName": "isSMS", 85 | "type": "boolean", 86 | "format": "" 87 | }, 88 | { 89 | "name": "dynamic_content", 90 | "baseName": "dynamic_content", 91 | "type": "string", 92 | "format": "" 93 | } ]; 94 | 95 | static getAttributeTypeMap() { 96 | return CreateTemplateRequest.attributeTypeMap; 97 | } 98 | 99 | public constructor() { 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /configuration.ts: -------------------------------------------------------------------------------- 1 | import { HttpLibrary } from "./http/http"; 2 | import { Middleware, PromiseMiddleware, PromiseMiddlewareWrapper } from "./middleware"; 3 | import { IsomorphicFetchHttpLibrary as DefaultHttpLibrary } from "./http/isomorphic-fetch"; 4 | import { BaseServerConfiguration, server1 } from "./servers"; 5 | import { configureAuthMethods, AuthMethods, AuthMethodsConfiguration } from "./auth/auth"; 6 | 7 | export interface Configuration { 8 | readonly baseServer: BaseServerConfiguration; 9 | readonly httpApi: HttpLibrary; 10 | readonly middleware: Middleware[]; 11 | readonly authMethods: AuthMethods; 12 | } 13 | 14 | 15 | /** 16 | * Interface with which a configuration object can be configured. 17 | */ 18 | export interface ConfigurationParameters { 19 | /** 20 | * Default server to use 21 | */ 22 | baseServer?: BaseServerConfiguration; 23 | /** 24 | * HTTP library to use e.g. IsomorphicFetch 25 | */ 26 | httpApi?: HttpLibrary; 27 | /** 28 | * The middlewares which will be applied to requests and responses 29 | */ 30 | middleware?: Middleware[]; 31 | /** 32 | * Configures all middlewares using the promise api instead of observables (which Middleware uses) 33 | */ 34 | promiseMiddleware?: PromiseMiddleware[]; 35 | /** 36 | * Configuration for the available authentication methods 37 | */ 38 | authMethods?: AuthMethodsConfiguration; 39 | /** 40 | * Faster way to configure authentication methods 41 | */ 42 | organizationApiKey?: string; 43 | restApiKey?: string; 44 | } 45 | 46 | /** 47 | * Configuration factory function 48 | * 49 | * If a property is not included in conf, a default is used: 50 | * - baseServer: server1 51 | * - httpApi: IsomorphicFetchHttpLibrary 52 | * - middleware: [] 53 | * - promiseMiddleware: [] 54 | * - authMethods: {} 55 | * 56 | * @param conf partial configuration 57 | */ 58 | export function createConfiguration(conf: ConfigurationParameters): Configuration { 59 | 60 | const authMethods: AuthMethodsConfiguration = { 61 | 'organization_api_key': { 62 | tokenProvider: { 63 | getToken: () => conf.organizationApiKey || '' 64 | } 65 | }, 66 | 'rest_api_key': { 67 | tokenProvider: { 68 | getToken: () => conf.restApiKey || '' 69 | } 70 | }, 71 | } 72 | 73 | const configuration: Configuration = { 74 | baseServer: conf.baseServer !== undefined ? conf.baseServer : server1, 75 | httpApi: conf.httpApi || new DefaultHttpLibrary(), 76 | middleware: conf.middleware || [], 77 | authMethods: configureAuthMethods(Object.assign(authMethods, conf.authMethods || {})) 78 | }; 79 | if (conf.promiseMiddleware) { 80 | conf.promiseMiddleware.forEach( 81 | m => configuration.middleware.push(new PromiseMiddlewareWrapper(m)) 82 | ); 83 | } 84 | return configuration; 85 | } -------------------------------------------------------------------------------- /models/PropertiesObject.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Purchase } from './Purchase'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class PropertiesObject { 13 | 'tags'?: { [key: string]: any; }; 14 | 'language'?: string; 15 | 'timezone_id'?: string; 16 | 'lat'?: number; 17 | 'long'?: number; 18 | 'country'?: string; 19 | 'first_active'?: number; 20 | 'last_active'?: number; 21 | 'amount_spent'?: number; 22 | 'purchases'?: Array; 23 | 'ip'?: string; 24 | 25 | static readonly discriminator: string | undefined = undefined; 26 | 27 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 28 | { 29 | "name": "tags", 30 | "baseName": "tags", 31 | "type": "{ [key: string]: any; }", 32 | "format": "" 33 | }, 34 | { 35 | "name": "language", 36 | "baseName": "language", 37 | "type": "string", 38 | "format": "" 39 | }, 40 | { 41 | "name": "timezone_id", 42 | "baseName": "timezone_id", 43 | "type": "string", 44 | "format": "" 45 | }, 46 | { 47 | "name": "lat", 48 | "baseName": "lat", 49 | "type": "number", 50 | "format": "" 51 | }, 52 | { 53 | "name": "long", 54 | "baseName": "long", 55 | "type": "number", 56 | "format": "" 57 | }, 58 | { 59 | "name": "country", 60 | "baseName": "country", 61 | "type": "string", 62 | "format": "" 63 | }, 64 | { 65 | "name": "first_active", 66 | "baseName": "first_active", 67 | "type": "number", 68 | "format": "" 69 | }, 70 | { 71 | "name": "last_active", 72 | "baseName": "last_active", 73 | "type": "number", 74 | "format": "" 75 | }, 76 | { 77 | "name": "amount_spent", 78 | "baseName": "amount_spent", 79 | "type": "number", 80 | "format": "" 81 | }, 82 | { 83 | "name": "purchases", 84 | "baseName": "purchases", 85 | "type": "Array", 86 | "format": "" 87 | }, 88 | { 89 | "name": "ip", 90 | "baseName": "ip", 91 | "type": "string", 92 | "format": "" 93 | } ]; 94 | 95 | static getAttributeTypeMap() { 96 | return PropertiesObject.attributeTypeMap; 97 | } 98 | 99 | public constructor() { 100 | } 101 | } 102 | 103 | -------------------------------------------------------------------------------- /models/Filter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Filter { 12 | /** 13 | * Required. Name of the field to use as the first operand in the filter expression. 14 | */ 15 | 'field'?: string; 16 | /** 17 | * If `field` is `tag`, this field is *required* to specify `key` inside the tags. 18 | */ 19 | 'key'?: string; 20 | /** 21 | * Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. 22 | */ 23 | 'value'?: string; 24 | /** 25 | * If `field` is session-related, this is *required* to specify the number of hours before or after the user\'s session. 26 | */ 27 | 'hours_ago'?: string; 28 | /** 29 | * If `field` is `location`, this will specify the radius in meters from a provided location point. Use with `lat` and `long`. 30 | */ 31 | 'radius'?: number; 32 | /** 33 | * If `field` is `location`, this is *required* to specify the user\'s latitude. 34 | */ 35 | 'lat'?: number; 36 | /** 37 | * If `field` is `location`, this is *required* to specify the user\'s longitude. 38 | */ 39 | 'long'?: number; 40 | /** 41 | * Required. Operator of a filter expression. 42 | */ 43 | 'relation'?: FilterRelationEnum; 44 | 45 | static readonly discriminator: string | undefined = undefined; 46 | 47 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 48 | { 49 | "name": "field", 50 | "baseName": "field", 51 | "type": "string", 52 | "format": "" 53 | }, 54 | { 55 | "name": "key", 56 | "baseName": "key", 57 | "type": "string", 58 | "format": "" 59 | }, 60 | { 61 | "name": "value", 62 | "baseName": "value", 63 | "type": "string", 64 | "format": "" 65 | }, 66 | { 67 | "name": "hours_ago", 68 | "baseName": "hours_ago", 69 | "type": "string", 70 | "format": "" 71 | }, 72 | { 73 | "name": "radius", 74 | "baseName": "radius", 75 | "type": "number", 76 | "format": "" 77 | }, 78 | { 79 | "name": "lat", 80 | "baseName": "lat", 81 | "type": "number", 82 | "format": "" 83 | }, 84 | { 85 | "name": "long", 86 | "baseName": "long", 87 | "type": "number", 88 | "format": "" 89 | }, 90 | { 91 | "name": "relation", 92 | "baseName": "relation", 93 | "type": "FilterRelationEnum", 94 | "format": "" 95 | } ]; 96 | 97 | static getAttributeTypeMap() { 98 | return Filter.attributeTypeMap; 99 | } 100 | 101 | public constructor() { 102 | } 103 | } 104 | 105 | 106 | export type FilterRelationEnum = ">" | "<" | "=" | "!=" | "exists" | "not_exists" | "time_elapsed_gt" | "time_elapsed_lt" ; 107 | 108 | -------------------------------------------------------------------------------- /auth/auth.ts: -------------------------------------------------------------------------------- 1 | // typings for btoa are incorrect 2 | //@ts-ignore 3 | import * as btoa from "btoa"; 4 | import { RequestContext } from "../http/http"; 5 | 6 | /** 7 | * Interface authentication schemes. 8 | */ 9 | export interface SecurityAuthentication { 10 | /* 11 | * @return returns the name of the security authentication as specified in OAI 12 | */ 13 | getName(): string; 14 | 15 | /** 16 | * Applies the authentication scheme to the request context 17 | * 18 | * @params context the request context which should use this authentication scheme 19 | */ 20 | applySecurityAuthentication(context: RequestContext): void | Promise; 21 | } 22 | 23 | export interface TokenProvider { 24 | getToken(): Promise | string; 25 | } 26 | 27 | /** 28 | * Applies http authentication to the request context. 29 | */ 30 | export class OrganizationApiKeyAuthentication implements SecurityAuthentication { 31 | /** 32 | * Configures the http authentication with the required details. 33 | * 34 | * @param tokenProvider service that can provide the up-to-date token when needed 35 | */ 36 | public constructor(private tokenProvider: TokenProvider) {} 37 | 38 | public getName(): string { 39 | return "organization_api_key"; 40 | } 41 | 42 | public async applySecurityAuthentication(context: RequestContext) { 43 | context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken()); 44 | } 45 | } 46 | 47 | /** 48 | * Applies http authentication to the request context. 49 | */ 50 | export class RestApiKeyAuthentication implements SecurityAuthentication { 51 | /** 52 | * Configures the http authentication with the required details. 53 | * 54 | * @param tokenProvider service that can provide the up-to-date token when needed 55 | */ 56 | public constructor(private tokenProvider: TokenProvider) {} 57 | 58 | public getName(): string { 59 | return "rest_api_key"; 60 | } 61 | 62 | public async applySecurityAuthentication(context: RequestContext) { 63 | context.setHeaderParam("Authorization", "Key " + await this.tokenProvider.getToken()); 64 | } 65 | } 66 | 67 | 68 | export type AuthMethods = { 69 | "default"?: SecurityAuthentication, 70 | "organization_api_key"?: SecurityAuthentication, 71 | "rest_api_key"?: SecurityAuthentication 72 | } 73 | 74 | export type ApiKeyConfiguration = string; 75 | export type HttpBasicConfiguration = { "username": string, "password": string }; 76 | export type HttpBearerConfiguration = { tokenProvider: TokenProvider }; 77 | export type OAuth2Configuration = { accessToken: string }; 78 | 79 | export type AuthMethodsConfiguration = { 80 | "default"?: SecurityAuthentication, 81 | "organization_api_key"?: HttpBearerConfiguration, 82 | "rest_api_key"?: HttpBearerConfiguration 83 | } 84 | 85 | /** 86 | * Creates the authentication methods from a swagger description. 87 | * 88 | */ 89 | export function configureAuthMethods(config: AuthMethodsConfiguration | undefined): AuthMethods { 90 | let authMethods: AuthMethods = {} 91 | 92 | if (!config) { 93 | return authMethods; 94 | } 95 | authMethods["default"] = config["default"] 96 | 97 | if (config["organization_api_key"]) { 98 | authMethods["organization_api_key"] = new OrganizationApiKeyAuthentication( 99 | config["organization_api_key"]["tokenProvider"] 100 | ); 101 | } 102 | 103 | if (config["rest_api_key"]) { 104 | authMethods["rest_api_key"] = new RestApiKeyAuthentication( 105 | config["rest_api_key"]["tokenProvider"] 106 | ); 107 | } 108 | 109 | return authMethods; 110 | } 111 | -------------------------------------------------------------------------------- /models/FilterExpression.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { Filter } from './Filter'; 10 | import { Operator } from './Operator'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class FilterExpression { 14 | /** 15 | * Required. Name of the field to use as the first operand in the filter expression. 16 | */ 17 | 'field'?: string; 18 | /** 19 | * If `field` is `tag`, this field is *required* to specify `key` inside the tags. 20 | */ 21 | 'key'?: string; 22 | /** 23 | * Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. 24 | */ 25 | 'value'?: string; 26 | /** 27 | * If `field` is session-related, this is *required* to specify the number of hours before or after the user\'s session. 28 | */ 29 | 'hours_ago'?: string; 30 | /** 31 | * If `field` is `location`, this will specify the radius in meters from a provided location point. Use with `lat` and `long`. 32 | */ 33 | 'radius'?: number; 34 | /** 35 | * If `field` is `location`, this is *required* to specify the user\'s latitude. 36 | */ 37 | 'lat'?: number; 38 | /** 39 | * If `field` is `location`, this is *required* to specify the user\'s longitude. 40 | */ 41 | 'long'?: number; 42 | /** 43 | * Required. Operator of a filter expression. 44 | */ 45 | 'relation'?: FilterExpressionRelationEnum; 46 | /** 47 | * Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. 48 | */ 49 | 'operator'?: FilterExpressionOperatorEnum; 50 | 51 | static readonly discriminator: string | undefined = undefined; 52 | 53 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 54 | { 55 | "name": "field", 56 | "baseName": "field", 57 | "type": "string", 58 | "format": "" 59 | }, 60 | { 61 | "name": "key", 62 | "baseName": "key", 63 | "type": "string", 64 | "format": "" 65 | }, 66 | { 67 | "name": "value", 68 | "baseName": "value", 69 | "type": "string", 70 | "format": "" 71 | }, 72 | { 73 | "name": "hours_ago", 74 | "baseName": "hours_ago", 75 | "type": "string", 76 | "format": "" 77 | }, 78 | { 79 | "name": "radius", 80 | "baseName": "radius", 81 | "type": "number", 82 | "format": "" 83 | }, 84 | { 85 | "name": "lat", 86 | "baseName": "lat", 87 | "type": "number", 88 | "format": "" 89 | }, 90 | { 91 | "name": "long", 92 | "baseName": "long", 93 | "type": "number", 94 | "format": "" 95 | }, 96 | { 97 | "name": "relation", 98 | "baseName": "relation", 99 | "type": "FilterExpressionRelationEnum", 100 | "format": "" 101 | }, 102 | { 103 | "name": "operator", 104 | "baseName": "operator", 105 | "type": "FilterExpressionOperatorEnum", 106 | "format": "" 107 | } ]; 108 | 109 | static getAttributeTypeMap() { 110 | return FilterExpression.attributeTypeMap; 111 | } 112 | 113 | public constructor() { 114 | } 115 | } 116 | 117 | 118 | export type FilterExpressionRelationEnum = ">" | "<" | "=" | "!=" | "exists" | "not_exists" | "time_elapsed_gt" | "time_elapsed_lt" ; 119 | export type FilterExpressionOperatorEnum = "OR" | "AND" ; 120 | 121 | -------------------------------------------------------------------------------- /models/UpdateLiveActivityRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { LanguageStringMap } from './LanguageStringMap'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class UpdateLiveActivityRequest { 13 | /** 14 | * An internal name to assist with your campaign organization. This does not get displayed in the message itself. 15 | */ 16 | 'name': string; 17 | 'event': UpdateLiveActivityRequestEventEnum; 18 | /** 19 | * This must match the ContentState interface you have defined within your Live Activity in your app. 20 | */ 21 | 'event_updates': object; 22 | 'contents'?: LanguageStringMap; 23 | 'headings'?: LanguageStringMap; 24 | /** 25 | * Sound file that is included in your app to play instead of the default device notification sound. Omit to disable vibration and sound for the notification. 26 | */ 27 | 'sound'?: string; 28 | /** 29 | * Accepts Unix timestamp in seconds. When time reaches the configured stale date, the system considers the Live Activity out of date, and the ActivityState of the Live Activity changes to ActivityState.stale. 30 | */ 31 | 'stale_date'?: number; 32 | /** 33 | * Accepts Unix timestamp in seconds; only allowed if event is \"end\" 34 | */ 35 | 'dismissal_date'?: number; 36 | /** 37 | * Delivery priority through the the push provider (APNs). Pass 10 for higher priority notifications, or 5 for lower priority notifications. Lower priority notifications are sent based on the power considerations of the end user\'s device. If not set, defaults to 10. Some providers (APNs) allow for a limited budget of high priority notifications per hour, and if that budget is exceeded, the provider may throttle notification delivery. 38 | */ 39 | 'priority'?: number; 40 | 41 | static readonly discriminator: string | undefined = undefined; 42 | 43 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 44 | { 45 | "name": "name", 46 | "baseName": "name", 47 | "type": "string", 48 | "format": "" 49 | }, 50 | { 51 | "name": "event", 52 | "baseName": "event", 53 | "type": "UpdateLiveActivityRequestEventEnum", 54 | "format": "" 55 | }, 56 | { 57 | "name": "event_updates", 58 | "baseName": "event_updates", 59 | "type": "object", 60 | "format": "" 61 | }, 62 | { 63 | "name": "contents", 64 | "baseName": "contents", 65 | "type": "LanguageStringMap", 66 | "format": "" 67 | }, 68 | { 69 | "name": "headings", 70 | "baseName": "headings", 71 | "type": "LanguageStringMap", 72 | "format": "" 73 | }, 74 | { 75 | "name": "sound", 76 | "baseName": "sound", 77 | "type": "string", 78 | "format": "" 79 | }, 80 | { 81 | "name": "stale_date", 82 | "baseName": "stale_date", 83 | "type": "number", 84 | "format": "" 85 | }, 86 | { 87 | "name": "dismissal_date", 88 | "baseName": "dismissal_date", 89 | "type": "number", 90 | "format": "" 91 | }, 92 | { 93 | "name": "priority", 94 | "baseName": "priority", 95 | "type": "number", 96 | "format": "" 97 | } ]; 98 | 99 | static getAttributeTypeMap() { 100 | return UpdateLiveActivityRequest.attributeTypeMap; 101 | } 102 | 103 | public constructor() { 104 | } 105 | } 106 | 107 | 108 | export type UpdateLiveActivityRequestEventEnum = "update" | "end" ; 109 | 110 | -------------------------------------------------------------------------------- /models/Subscription.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class Subscription { 12 | 'id'?: string; 13 | 'type'?: SubscriptionTypeEnum; 14 | 'token'?: string; 15 | 'enabled'?: boolean; 16 | 'notification_types'?: number; 17 | 'session_time'?: number; 18 | 'session_count'?: number; 19 | 'sdk'?: string; 20 | 'device_model'?: string; 21 | 'device_os'?: string; 22 | 'rooted'?: boolean; 23 | 'test_type'?: number; 24 | 'app_version'?: string; 25 | 'net_type'?: number; 26 | 'carrier'?: string; 27 | 'web_auth'?: string; 28 | 'web_p256'?: string; 29 | 30 | static readonly discriminator: string | undefined = undefined; 31 | 32 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 33 | { 34 | "name": "id", 35 | "baseName": "id", 36 | "type": "string", 37 | "format": "" 38 | }, 39 | { 40 | "name": "type", 41 | "baseName": "type", 42 | "type": "SubscriptionTypeEnum", 43 | "format": "" 44 | }, 45 | { 46 | "name": "token", 47 | "baseName": "token", 48 | "type": "string", 49 | "format": "" 50 | }, 51 | { 52 | "name": "enabled", 53 | "baseName": "enabled", 54 | "type": "boolean", 55 | "format": "" 56 | }, 57 | { 58 | "name": "notification_types", 59 | "baseName": "notification_types", 60 | "type": "number", 61 | "format": "" 62 | }, 63 | { 64 | "name": "session_time", 65 | "baseName": "session_time", 66 | "type": "number", 67 | "format": "" 68 | }, 69 | { 70 | "name": "session_count", 71 | "baseName": "session_count", 72 | "type": "number", 73 | "format": "" 74 | }, 75 | { 76 | "name": "sdk", 77 | "baseName": "sdk", 78 | "type": "string", 79 | "format": "" 80 | }, 81 | { 82 | "name": "device_model", 83 | "baseName": "device_model", 84 | "type": "string", 85 | "format": "" 86 | }, 87 | { 88 | "name": "device_os", 89 | "baseName": "device_os", 90 | "type": "string", 91 | "format": "" 92 | }, 93 | { 94 | "name": "rooted", 95 | "baseName": "rooted", 96 | "type": "boolean", 97 | "format": "" 98 | }, 99 | { 100 | "name": "test_type", 101 | "baseName": "test_type", 102 | "type": "number", 103 | "format": "" 104 | }, 105 | { 106 | "name": "app_version", 107 | "baseName": "app_version", 108 | "type": "string", 109 | "format": "" 110 | }, 111 | { 112 | "name": "net_type", 113 | "baseName": "net_type", 114 | "type": "number", 115 | "format": "" 116 | }, 117 | { 118 | "name": "carrier", 119 | "baseName": "carrier", 120 | "type": "string", 121 | "format": "" 122 | }, 123 | { 124 | "name": "web_auth", 125 | "baseName": "web_auth", 126 | "type": "string", 127 | "format": "" 128 | }, 129 | { 130 | "name": "web_p256", 131 | "baseName": "web_p256", 132 | "type": "string", 133 | "format": "" 134 | } ]; 135 | 136 | static getAttributeTypeMap() { 137 | return Subscription.attributeTypeMap; 138 | } 139 | 140 | public constructor() { 141 | } 142 | } 143 | 144 | 145 | export type SubscriptionTypeEnum = "iOSPush" | "AndroidPush" | "FireOSPush" | "ChromeExtensionPush" | "ChromePush" | "WindowsPush" | "SafariLegacyPush" | "FirefoxPush" | "macOSPush" | "HuaweiPush" | "SafariPush" | "Email" | "SMS" ; 146 | 147 | -------------------------------------------------------------------------------- /models/NotificationWithMetaAllOf.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { PlatformDeliveryData } from './PlatformDeliveryData'; 10 | import { HttpFile } from '../http/http'; 11 | 12 | export class NotificationWithMetaAllOf { 13 | /** 14 | * Number of notifications that have not been sent out yet. This can mean either our system is still processing the notification or you have delayed options set. 15 | */ 16 | 'remaining'?: number; 17 | /** 18 | * Number of notifications that were successfully delivered. 19 | */ 20 | 'successful'?: number; 21 | /** 22 | * Number of notifications that could not be delivered due to those devices being unsubscribed. 23 | */ 24 | 'failed'?: number; 25 | /** 26 | * Number of notifications that could not be delivered due to an error. You can find more information by viewing the notification in the dashboard. 27 | */ 28 | 'errored'?: number; 29 | /** 30 | * Number of users who have clicked / tapped on your notification. 31 | */ 32 | 'converted'?: number; 33 | /** 34 | * Unix timestamp indicating when the notification was created. 35 | */ 36 | 'queued_at'?: number; 37 | /** 38 | * Unix timestamp indicating when notification delivery should begin. 39 | */ 40 | 'send_after'?: number; 41 | /** 42 | * Unix timestamp indicating when notification delivery completed. The delivery duration from start to finish can be calculated with completed_at - send_after. 43 | */ 44 | 'completed_at'?: number; 45 | 'platform_delivery_stats'?: PlatformDeliveryData; 46 | /** 47 | * Confirmed Deliveries number of devices that received the push notification. Paid Feature Only. Free accounts will see 0. 48 | */ 49 | 'received'?: number; 50 | /** 51 | * number of push notifications sent per minute. Paid Feature Only. If throttling is not enabled for the app or the notification, and for free accounts, null is returned. Refer to Throttling for more details. 52 | */ 53 | 'throttle_rate_per_minute'?: number; 54 | /** 55 | * Indicates whether the notification was canceled before it could be sent. 56 | */ 57 | 'canceled'?: boolean; 58 | 59 | static readonly discriminator: string | undefined = undefined; 60 | 61 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 62 | { 63 | "name": "remaining", 64 | "baseName": "remaining", 65 | "type": "number", 66 | "format": "" 67 | }, 68 | { 69 | "name": "successful", 70 | "baseName": "successful", 71 | "type": "number", 72 | "format": "" 73 | }, 74 | { 75 | "name": "failed", 76 | "baseName": "failed", 77 | "type": "number", 78 | "format": "" 79 | }, 80 | { 81 | "name": "errored", 82 | "baseName": "errored", 83 | "type": "number", 84 | "format": "" 85 | }, 86 | { 87 | "name": "converted", 88 | "baseName": "converted", 89 | "type": "number", 90 | "format": "" 91 | }, 92 | { 93 | "name": "queued_at", 94 | "baseName": "queued_at", 95 | "type": "number", 96 | "format": "int64" 97 | }, 98 | { 99 | "name": "send_after", 100 | "baseName": "send_after", 101 | "type": "number", 102 | "format": "int64" 103 | }, 104 | { 105 | "name": "completed_at", 106 | "baseName": "completed_at", 107 | "type": "number", 108 | "format": "int64" 109 | }, 110 | { 111 | "name": "platform_delivery_stats", 112 | "baseName": "platform_delivery_stats", 113 | "type": "PlatformDeliveryData", 114 | "format": "" 115 | }, 116 | { 117 | "name": "received", 118 | "baseName": "received", 119 | "type": "number", 120 | "format": "" 121 | }, 122 | { 123 | "name": "throttle_rate_per_minute", 124 | "baseName": "throttle_rate_per_minute", 125 | "type": "number", 126 | "format": "" 127 | }, 128 | { 129 | "name": "canceled", 130 | "baseName": "canceled", 131 | "type": "boolean", 132 | "format": "" 133 | } ]; 134 | 135 | static getAttributeTypeMap() { 136 | return NotificationWithMetaAllOf.attributeTypeMap; 137 | } 138 | 139 | public constructor() { 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /.github/workflows/asana-create-task.yml: -------------------------------------------------------------------------------- 1 | name: Github --> Asana Create Task Workflow 2 | 3 | on: 4 | issues: 5 | types: [opened] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: read 13 | steps: 14 | - name: Create Asana task 15 | env: 16 | ISSUE_TITLE: ${{ github.event.issue.title }} 17 | ISSUE_BODY: ${{ github.event.issue.body }} 18 | ISSUE_HTML_URL: ${{ github.event.issue.html_url }} 19 | ISSUE_ID: ${{ github.event.issue.id }} 20 | ISSUE_NUMBER: ${{ github.event.issue.number }} 21 | REPO_FULL_NAME: ${{ github.event.repository.full_name }} 22 | SDK_PLATFORM_GROUP: "1208961704779581" 23 | SDK_PLATFORM_GROUP_SERVER: "1208961704779585" 24 | SDK_PLATFORM: "1208961704779592" 25 | SDK_PLATFORM_TYPESCRIPT: "1208961704779609" 26 | DSA_PRIORITY: "1208779519954980" 27 | DSA_PRIORITY_NO_PRIORITY: "1208779521616959" 28 | DSA_STATUS: "1210103546117753" 29 | DSA_STATUS_TRIAGE: "1210103546117756" 30 | DSA_REPO_TICKET_URL: "1210347857768758" 31 | WORKSPACE_ID: "780103692902078" 32 | PROJECT_ID_GITHUB_AND_IMPORTANT_SDK_ISSUES: "1208970714650308" 33 | PROJECT_ID_SDK_BACKLOG: "1208777198342772" 34 | run: | 35 | DATA_BODY=$(jq -n \ 36 | --arg title "$ISSUE_TITLE" \ 37 | --arg body "$ISSUE_BODY" \ 38 | --arg url "$ISSUE_HTML_URL" \ 39 | --arg id "$ISSUE_ID" \ 40 | --arg number "$ISSUE_NUMBER" \ 41 | --arg repo_full_name "$REPO_FULL_NAME" \ 42 | --arg sdk_platform_group "$SDK_PLATFORM_GROUP" \ 43 | --arg sdk_platform_group_server "$SDK_PLATFORM_GROUP_SERVER" \ 44 | --arg sdk_platform "$SDK_PLATFORM" \ 45 | --arg sdk_platform_typescript "$SDK_PLATFORM_TYPESCRIPT" \ 46 | --arg dsa_priority "$DSA_PRIORITY" \ 47 | --arg dsa_priority_no_priority "$DSA_PRIORITY_NO_PRIORITY" \ 48 | --arg dsa_status "$DSA_STATUS" \ 49 | --arg dsa_status_triage "$DSA_STATUS_TRIAGE" \ 50 | --arg dsa_repo_ticket_url "$DSA_REPO_TICKET_URL" \ 51 | --arg workspace_id "$WORKSPACE_ID" \ 52 | --arg project_id_github_and_important_sdk_issues "$PROJECT_ID_GITHUB_AND_IMPORTANT_SDK_ISSUES" \ 53 | --arg project_id_sdk_backlog "$PROJECT_ID_SDK_BACKLOG" \ 54 | '{ 55 | "data": { 56 | "custom_fields": { 57 | $sdk_platform_group: $sdk_platform_group_server, 58 | $sdk_platform: $sdk_platform_typescript, 59 | $dsa_priority: $dsa_priority_no_priority, 60 | $dsa_status: $dsa_status_triage, 61 | $dsa_repo_ticket_url: $url 62 | }, 63 | "name": $title, 64 | "workspace": $workspace_id, 65 | "projects": [$project_id_github_and_important_sdk_issues, $project_id_sdk_backlog], 66 | "notes": "Issue ID: \($repo_full_name)#\($id)\nIssue number: \($number)\nCreated via GitHub Actions\n----\n\n\($body)" 67 | } 68 | }') 69 | 70 | curl --request POST \ 71 | --url https://app.asana.com/api/1.0/tasks?opt_pretty=true \ 72 | --header 'accept: application/json' \ 73 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 74 | --header 'content-type: application/json' \ 75 | --data "$DATA_BODY" \ 76 | --output response.json 77 | 78 | TASK_GID=$(jq -r '.data.gid' response.json) 79 | echo "TASK_GID=$TASK_GID" >> $GITHUB_ENV 80 | - name: Move to "0 Unclassified" section in "Github & Important SDK Issues" project 81 | env: 82 | SECTION_ID_GITHUB_AND_IMPORTANT_SDK_ISSUES: "1208970755434051" 83 | run: | 84 | DATA_BODY=$(jq -n \ 85 | --arg task_gid "$TASK_GID" \ 86 | --arg section_id "$SECTION_ID_GITHUB_AND_IMPORTANT_SDK_ISSUES" \ 87 | '{ 88 | "data": { 89 | "task": $task_gid, 90 | "insert_after": "null" 91 | } 92 | }') 93 | 94 | curl --request POST \ 95 | --url https://app.asana.com/api/1.0/sections/$section_id/addTask \ 96 | --header 'accept: application/json' \ 97 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 98 | --header 'content-type: application/json' \ 99 | --data "$DATA_BODY" 100 | - name: Move to "Untriaged" section in "SDK / Backlog" project 101 | env: 102 | SECTION_ID_SDK_BACKLOG: "1208899729378982" 103 | run: | 104 | DATA_BODY=$(jq -n \ 105 | --arg task_gid "$TASK_GID" \ 106 | --arg section_id "$SECTION_ID_SDK_BACKLOG" \ 107 | '{ 108 | "data": { 109 | "task": $task_gid, 110 | "insert_after": "null" 111 | } 112 | }') 113 | 114 | curl --request POST \ 115 | --url https://app.asana.com/api/1.0/sections/$section_id/addTask \ 116 | --header 'accept: application/json' \ 117 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 118 | --header 'content-type: application/json' \ 119 | --data "$DATA_BODY" -------------------------------------------------------------------------------- /http/http.ts: -------------------------------------------------------------------------------- 1 | // TODO: evaluate if we can easily get rid of this library 2 | import * as FormData from "form-data"; 3 | import { Observable, from } from '../rxjsStub'; 4 | 5 | export * from './isomorphic-fetch'; 6 | 7 | /** 8 | * Represents an HTTP method. 9 | */ 10 | export enum HttpMethod { 11 | GET = "GET", 12 | HEAD = "HEAD", 13 | POST = "POST", 14 | PUT = "PUT", 15 | DELETE = "DELETE", 16 | CONNECT = "CONNECT", 17 | OPTIONS = "OPTIONS", 18 | TRACE = "TRACE", 19 | PATCH = "PATCH" 20 | } 21 | 22 | /** 23 | * Represents an HTTP file which will be transferred from or to a server. 24 | */ 25 | export type HttpFile = { 26 | data: Buffer, 27 | name: string 28 | }; 29 | 30 | 31 | export class HttpException extends Error { 32 | public constructor(msg: string) { 33 | super(msg); 34 | } 35 | } 36 | 37 | /** 38 | * Represents the body of an outgoing HTTP request. 39 | */ 40 | export type RequestBody = undefined | string | FormData; 41 | 42 | /** 43 | * Represents an HTTP request context 44 | */ 45 | export class RequestContext { 46 | private headers: { [key: string]: string } = {}; 47 | private body: RequestBody = undefined; 48 | private url: URL; 49 | 50 | /** 51 | * Creates the request context using a http method and request resource url 52 | * 53 | * @param url url of the requested resource 54 | * @param httpMethod http method 55 | */ 56 | public constructor(url: string, private httpMethod: HttpMethod) { 57 | this.url = new URL(url); 58 | } 59 | 60 | /* 61 | * Returns the url set in the constructor including the query string 62 | * 63 | */ 64 | public getUrl(): string { 65 | return this.url.toString(); 66 | } 67 | 68 | /** 69 | * Replaces the url set in the constructor with this url. 70 | * 71 | */ 72 | public setUrl(url: string) { 73 | this.url = new URL(url); 74 | } 75 | 76 | /** 77 | * Sets the body of the http request either as a string or FormData 78 | * 79 | * Note that setting a body on a HTTP GET, HEAD, DELETE, CONNECT or TRACE 80 | * request is discouraged. 81 | * https://httpwg.org/http-core/draft-ietf-httpbis-semantics-latest.html#rfc.section.7.3.1 82 | * 83 | * @param body the body of the request 84 | */ 85 | public setBody(body: RequestBody) { 86 | this.body = body; 87 | } 88 | 89 | public getHttpMethod(): HttpMethod { 90 | return this.httpMethod; 91 | } 92 | 93 | public getHeaders(): { [key: string]: string } { 94 | return this.headers; 95 | } 96 | 97 | public getBody(): RequestBody { 98 | return this.body; 99 | } 100 | 101 | public setQueryParam(name: string, value: string) { 102 | this.url.searchParams.set(name, value); 103 | } 104 | 105 | /** 106 | * Sets a cookie with the name and value. NO check for duplicate cookies is performed 107 | * 108 | */ 109 | public addCookie(name: string, value: string): void { 110 | if (!this.headers["Cookie"]) { 111 | this.headers["Cookie"] = ""; 112 | } 113 | this.headers["Cookie"] += name + "=" + value + "; "; 114 | } 115 | 116 | public setHeaderParam(key: string, value: string): void { 117 | this.headers[key] = value; 118 | } 119 | } 120 | 121 | export interface ResponseBody { 122 | text(): Promise; 123 | binary(): Promise; 124 | } 125 | 126 | 127 | /** 128 | * Helper class to generate a `ResponseBody` from binary data 129 | */ 130 | export class SelfDecodingBody implements ResponseBody { 131 | constructor(private dataSource: Promise) {} 132 | 133 | binary(): Promise { 134 | return this.dataSource; 135 | } 136 | 137 | async text(): Promise { 138 | const data: Buffer = await this.dataSource; 139 | return data.toString(); 140 | } 141 | } 142 | 143 | export class ResponseContext { 144 | public constructor( 145 | public httpStatusCode: number, 146 | public headers: { [key: string]: string }, 147 | public body: ResponseBody 148 | ) {} 149 | 150 | /** 151 | * Parse header value in the form `value; param1="value1"` 152 | * 153 | * E.g. for Content-Type or Content-Disposition 154 | * Parameter names are converted to lower case 155 | * The first parameter is returned with the key `""` 156 | */ 157 | public getParsedHeader(headerName: string): { [parameter: string]: string } { 158 | const result: { [parameter: string]: string } = {}; 159 | if (!this.headers[headerName]) { 160 | return result; 161 | } 162 | 163 | const parameters = this.headers[headerName].split(";"); 164 | for (const parameter of parameters) { 165 | let [key, value] = parameter.split("=", 2); 166 | key = key.toLowerCase().trim(); 167 | if (value === undefined) { 168 | result[""] = key; 169 | } else { 170 | value = value.trim(); 171 | if (value.startsWith('"') && value.endsWith('"')) { 172 | value = value.substring(1, value.length - 1); 173 | } 174 | result[key] = value; 175 | } 176 | } 177 | return result; 178 | } 179 | 180 | public async getBodyAsFile(): Promise { 181 | const data = await this.body.binary(); 182 | const fileName = this.getParsedHeader("content-disposition")["filename"] || ""; 183 | return { data, name: fileName }; 184 | } 185 | 186 | public async getBodyAsAny(): Promise { 187 | return this.body as any; 188 | } 189 | } 190 | 191 | export interface HttpLibrary { 192 | send(request: RequestContext): Observable; 193 | } 194 | 195 | export interface PromiseHttpLibrary { 196 | send(request: RequestContext): Promise; 197 | } 198 | 199 | export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { 200 | return { 201 | send(request: RequestContext): Observable { 202 | return from(promiseHttpLibrary.send(request)); 203 | } 204 | } 205 | } -------------------------------------------------------------------------------- /models/SubscriptionNotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class SubscriptionNotificationTarget { 12 | /** 13 | * 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 14 | */ 15 | 'include_subscription_ids'?: Array; 16 | /** 17 | * 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: nick@catfac.ts Limit of 2,000 entries per REST API call 18 | */ 19 | 'include_email_tokens'?: Array; 20 | /** 21 | * Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call 22 | */ 23 | 'include_phone_numbers'?: Array; 24 | /** 25 | * 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 26 | */ 27 | 'include_ios_tokens'?: Array; 28 | /** 29 | * 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 30 | */ 31 | 'include_wp_wns_uris'?: Array; 32 | /** 33 | * 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 34 | */ 35 | 'include_amazon_reg_ids'?: Array; 36 | /** 37 | * 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 38 | */ 39 | 'include_chrome_reg_ids'?: Array; 40 | /** 41 | * 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 42 | */ 43 | 'include_chrome_web_reg_ids'?: Array; 44 | /** 45 | * 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 46 | */ 47 | 'include_android_reg_ids'?: Array; 48 | /** 49 | * 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. 50 | */ 51 | 'include_aliases'?: { [key: string]: Array; }; 52 | 'target_channel'?: SubscriptionNotificationTargetTargetChannelEnum; 53 | 54 | static readonly discriminator: string | undefined = undefined; 55 | 56 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 57 | { 58 | "name": "include_subscription_ids", 59 | "baseName": "include_subscription_ids", 60 | "type": "Array", 61 | "format": "" 62 | }, 63 | { 64 | "name": "include_email_tokens", 65 | "baseName": "include_email_tokens", 66 | "type": "Array", 67 | "format": "" 68 | }, 69 | { 70 | "name": "include_phone_numbers", 71 | "baseName": "include_phone_numbers", 72 | "type": "Array", 73 | "format": "" 74 | }, 75 | { 76 | "name": "include_ios_tokens", 77 | "baseName": "include_ios_tokens", 78 | "type": "Array", 79 | "format": "" 80 | }, 81 | { 82 | "name": "include_wp_wns_uris", 83 | "baseName": "include_wp_wns_uris", 84 | "type": "Array", 85 | "format": "" 86 | }, 87 | { 88 | "name": "include_amazon_reg_ids", 89 | "baseName": "include_amazon_reg_ids", 90 | "type": "Array", 91 | "format": "" 92 | }, 93 | { 94 | "name": "include_chrome_reg_ids", 95 | "baseName": "include_chrome_reg_ids", 96 | "type": "Array", 97 | "format": "" 98 | }, 99 | { 100 | "name": "include_chrome_web_reg_ids", 101 | "baseName": "include_chrome_web_reg_ids", 102 | "type": "Array", 103 | "format": "" 104 | }, 105 | { 106 | "name": "include_android_reg_ids", 107 | "baseName": "include_android_reg_ids", 108 | "type": "Array", 109 | "format": "" 110 | }, 111 | { 112 | "name": "include_aliases", 113 | "baseName": "include_aliases", 114 | "type": "{ [key: string]: Array; }", 115 | "format": "" 116 | }, 117 | { 118 | "name": "target_channel", 119 | "baseName": "target_channel", 120 | "type": "SubscriptionNotificationTargetTargetChannelEnum", 121 | "format": "" 122 | } ]; 123 | 124 | static getAttributeTypeMap() { 125 | return SubscriptionNotificationTarget.attributeTypeMap; 126 | } 127 | 128 | public constructor() { 129 | } 130 | } 131 | 132 | 133 | export type SubscriptionNotificationTargetTargetChannelEnum = "push" | "email" | "sms" ; 134 | 135 | -------------------------------------------------------------------------------- /models/StartLiveActivityRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { FilterExpression } from './FilterExpression'; 10 | import { LanguageStringMap } from './LanguageStringMap'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class StartLiveActivityRequest { 14 | /** 15 | * An internal name to assist with your campaign organization. This does not get displayed in the message itself. 16 | */ 17 | 'name': string; 18 | 'event': StartLiveActivityRequestEventEnum; 19 | /** 20 | * Set a unique activity_id to track and manage the Live Activity. 21 | */ 22 | 'activity_id': string; 23 | /** 24 | * Default/static data to initialize the Live Activity upon start. 25 | */ 26 | 'event_attributes': object; 27 | /** 28 | * Dynamic content used to update the running Live Activity at start. Must match the ContentState interface defined in your app. 29 | */ 30 | 'event_updates': object; 31 | 'contents': LanguageStringMap; 32 | 'headings': LanguageStringMap; 33 | /** 34 | * Accepts Unix timestamp in seconds. When time reaches the configured stale date, the system considers the Live Activity out of date, and the ActivityState of the Live Activity changes to ActivityState.stale. 35 | */ 36 | 'stale_date'?: number; 37 | /** 38 | * Delivery priority through the push provider (APNs). Pass 10 for higher priority notifications, or 5 for lower priority notifications. Lower priority notifications are sent based on the power considerations of the end user\'s device. If not set, defaults to 10. 39 | */ 40 | 'priority'?: number; 41 | /** 42 | * iOS 15+. A score to indicate how a notification should be displayed when grouped. Use a float between 0-1. 43 | */ 44 | 'ios_relevance_score'?: number; 45 | /** 46 | * Correlation and idempotency key. A request received with this parameter will first look for another notification with the same idempotency key. 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 idempotency key will be sent again. See Idempotent Notification Requests for more details writeOnly: true 47 | */ 48 | 'idempotency_key'?: string; 49 | /** 50 | * 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. 51 | */ 52 | 'include_aliases'?: { [key: string]: Array; }; 53 | /** 54 | * Specific subscription ids to target. Not compatible with other targeting parameters. 55 | */ 56 | 'include_subscription_ids'?: Array; 57 | /** 58 | * Segment names to include. Only compatible with excluded_segments. 59 | */ 60 | 'included_segments'?: Array; 61 | /** 62 | * Segment names to exclude. Only compatible with included_segments. 63 | */ 64 | 'excluded_segments'?: Array; 65 | 'filters'?: Array; 66 | 67 | static readonly discriminator: string | undefined = undefined; 68 | 69 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 70 | { 71 | "name": "name", 72 | "baseName": "name", 73 | "type": "string", 74 | "format": "" 75 | }, 76 | { 77 | "name": "event", 78 | "baseName": "event", 79 | "type": "StartLiveActivityRequestEventEnum", 80 | "format": "" 81 | }, 82 | { 83 | "name": "activity_id", 84 | "baseName": "activity_id", 85 | "type": "string", 86 | "format": "" 87 | }, 88 | { 89 | "name": "event_attributes", 90 | "baseName": "event_attributes", 91 | "type": "object", 92 | "format": "" 93 | }, 94 | { 95 | "name": "event_updates", 96 | "baseName": "event_updates", 97 | "type": "object", 98 | "format": "" 99 | }, 100 | { 101 | "name": "contents", 102 | "baseName": "contents", 103 | "type": "LanguageStringMap", 104 | "format": "" 105 | }, 106 | { 107 | "name": "headings", 108 | "baseName": "headings", 109 | "type": "LanguageStringMap", 110 | "format": "" 111 | }, 112 | { 113 | "name": "stale_date", 114 | "baseName": "stale_date", 115 | "type": "number", 116 | "format": "" 117 | }, 118 | { 119 | "name": "priority", 120 | "baseName": "priority", 121 | "type": "number", 122 | "format": "" 123 | }, 124 | { 125 | "name": "ios_relevance_score", 126 | "baseName": "ios_relevance_score", 127 | "type": "number", 128 | "format": "" 129 | }, 130 | { 131 | "name": "idempotency_key", 132 | "baseName": "idempotency_key", 133 | "type": "string", 134 | "format": "" 135 | }, 136 | { 137 | "name": "include_aliases", 138 | "baseName": "include_aliases", 139 | "type": "{ [key: string]: Array; }", 140 | "format": "" 141 | }, 142 | { 143 | "name": "include_subscription_ids", 144 | "baseName": "include_subscription_ids", 145 | "type": "Array", 146 | "format": "" 147 | }, 148 | { 149 | "name": "included_segments", 150 | "baseName": "included_segments", 151 | "type": "Array", 152 | "format": "" 153 | }, 154 | { 155 | "name": "excluded_segments", 156 | "baseName": "excluded_segments", 157 | "type": "Array", 158 | "format": "" 159 | }, 160 | { 161 | "name": "filters", 162 | "baseName": "filters", 163 | "type": "Array", 164 | "format": "" 165 | } ]; 166 | 167 | static getAttributeTypeMap() { 168 | return StartLiveActivityRequest.attributeTypeMap; 169 | } 170 | 171 | public constructor() { 172 | } 173 | } 174 | 175 | 176 | export type StartLiveActivityRequestEventEnum = "start" ; 177 | 178 | -------------------------------------------------------------------------------- /.github/workflows/asana-update-issue.yml: -------------------------------------------------------------------------------- 1 | name: Github --> Asana Issue Updates Workflow 2 | 3 | on: 4 | issues: 5 | types: [edited, deleted, closed, reopened, assigned, unassigned, labeled, unlabeled, milestoned, demilestoned, pinned, unpinned, locked, unlocked, transferred] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: read 13 | steps: 14 | - name: Get Asana Task Corresponding to Issue 15 | env: 16 | ISSUE_ID: ${{ github.event.issue.id }} 17 | REPO_FULL_NAME: ${{ github.event.repository.full_name }} 18 | WORKSPACE_ID: "780103692902078" 19 | run: | 20 | REPO_SCOPED_ISSUE_ID="$REPO_FULL_NAME#$ISSUE_ID" 21 | 22 | curl --request GET \ 23 | --url "https://app.asana.com/api/1.0/workspaces/$WORKSPACE_ID/tasks/search?opt_fields=notes&text=$REPO_SCOPED_ISSUE_ID&sort_by=modified_at&sort_ascending=false" \ 24 | --header 'accept: application/json' \ 25 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 26 | --output response.json 27 | TASK_GID=$(jq -r '.data[0].gid' response.json) 28 | echo "TASK_GID=$TASK_GID" >> $GITHUB_ENV 29 | - name: Determine Action and Post to Asana 30 | env: 31 | ACTION_TYPE: ${{ github.event.action }} 32 | ACTOR_NAME: ${{ github.event.sender.login }} 33 | ISSUE_TITLE: ${{ github.event.issue.title }} 34 | ISSUE_NUMBER: ${{ github.event.issue.number }} 35 | ISSUE_STATE: ${{ github.event.issue.state }} 36 | run: | 37 | # Map GitHub action types to human-readable descriptions 38 | case "$ACTION_TYPE" in 39 | "edited") 40 | ACTION_DESC="edited the issue" 41 | ;; 42 | "deleted") 43 | ACTION_DESC="deleted the issue" 44 | ;; 45 | "closed") 46 | ACTION_DESC="closed the issue" 47 | ;; 48 | "reopened") 49 | ACTION_DESC="reopened the issue" 50 | ;; 51 | "assigned") 52 | ACTION_DESC="assigned the issue" 53 | ;; 54 | "unassigned") 55 | ACTION_DESC="unassigned the issue" 56 | ;; 57 | "labeled") 58 | ACTION_DESC="added labels to the issue" 59 | ;; 60 | "unlabeled") 61 | ACTION_DESC="removed labels from the issue" 62 | ;; 63 | "milestoned") 64 | ACTION_DESC="added the issue to a milestone" 65 | ;; 66 | "demilestoned") 67 | ACTION_DESC="removed the issue from a milestone" 68 | ;; 69 | "pinned") 70 | ACTION_DESC="pinned the issue" 71 | ;; 72 | "unpinned") 73 | ACTION_DESC="unpinned the issue" 74 | ;; 75 | "locked") 76 | ACTION_DESC="locked the issue" 77 | ;; 78 | "unlocked") 79 | ACTION_DESC="unlocked the issue" 80 | ;; 81 | "transferred") 82 | ACTION_DESC="transferred the issue" 83 | ;; 84 | *) 85 | ACTION_DESC="performed an action on the issue" 86 | ;; 87 | esac 88 | 89 | # Add additional context for specific actions based on webhook payload 90 | if [ "$ACTION_TYPE" = "assigned" ] && [ -n "${{ github.event.assignee.login }}" ]; then 91 | ACTION_DESC="assigned the issue to ${{ github.event.assignee.login }}" 92 | fi 93 | 94 | if [ "$ACTION_TYPE" = "unassigned" ] && [ -n "${{ github.event.assignee.login }}" ]; then 95 | ACTION_DESC="unassigned the issue from ${{ github.event.assignee.login }}" 96 | fi 97 | 98 | if [ "$ACTION_TYPE" = "labeled" ] && [ -n "${{ github.event.label.name }}" ]; then 99 | LABEL_COLOR="${{ github.event.label.color }}" 100 | ACTION_DESC="added label '${{ github.event.label.name }}' to the issue" 101 | if [ -n "$LABEL_COLOR" ]; then 102 | ACTION_DESC="$ACTION_DESC (color: #$LABEL_COLOR)" 103 | fi 104 | fi 105 | 106 | if [ "$ACTION_TYPE" = "unlabeled" ] && [ -n "${{ github.event.label.name }}" ]; then 107 | LABEL_COLOR="${{ github.event.label.color }}" 108 | ACTION_DESC="removed label '${{ github.event.label.name }}' from the issue" 109 | if [ -n "$LABEL_COLOR" ]; then 110 | ACTION_DESC="$ACTION_DESC (color: #$LABEL_COLOR)" 111 | fi 112 | fi 113 | 114 | if [ "$ACTION_TYPE" = "milestoned" ] && [ -n "${{ github.event.milestone.title }}" ]; then 115 | MILESTONE_DUE_DATE="${{ github.event.milestone.due_on }}" 116 | ACTION_DESC="added the issue to milestone '${{ github.event.milestone.title }}'" 117 | if [ -n "$MILESTONE_DUE_DATE" ] && [ "$MILESTONE_DUE_DATE" != "null" ]; then 118 | ACTION_DESC="$ACTION_DESC (due: $MILESTONE_DUE_DATE)" 119 | fi 120 | fi 121 | 122 | if [ "$ACTION_TYPE" = "demilestoned" ] && [ -n "${{ github.event.milestone.title }}" ]; then 123 | ACTION_DESC="removed the issue from milestone '${{ github.event.milestone.title }}'" 124 | fi 125 | 126 | if [ "$ACTION_TYPE" = "transferred" ] && [ -n "${{ github.event.changes.new_repository.full_name }}" ]; then 127 | ACTION_DESC="transferred the issue to repository ${{ github.event.changes.new_repository.full_name }}" 128 | fi 129 | 130 | if [ "$ACTION_TYPE" = "edited" ] && [ -n "${{ github.event.changes.title.from }}" ]; then 131 | OLD_TITLE="${{ github.event.changes.title.from }}" 132 | NEW_TITLE="${{ github.event.issue.title }}" 133 | ACTION_DESC="edited the issue title from '$OLD_TITLE' to '$NEW_TITLE'" 134 | fi 135 | 136 | echo "ACTION_DESC=$ACTION_DESC" >> $GITHUB_ENV 137 | 138 | # Only proceed if we found a task 139 | if [ "$TASK_GID" != "null" ] && [ -n "$TASK_GID" ]; then 140 | # Create a more detailed message with additional context 141 | MESSAGE_TEXT="$ACTOR_NAME performed an action: $ACTION_DESC" 142 | 143 | # Add issue state information for state changes 144 | if [ "$ACTION_TYPE" = "closed" ] || [ "$ACTION_TYPE" = "reopened" ]; then 145 | MESSAGE_TEXT=$(printf "%s\nIssue state: %s" "$MESSAGE_TEXT" "$ISSUE_STATE") 146 | fi 147 | 148 | # Add repository information for transferred issues 149 | if [ "$ACTION_TYPE" = "transferred" ]; then 150 | REPO_NAME="${{ github.event.repository.full_name }}" 151 | MESSAGE_TEXT=$(printf "%s\nFrom repository: %s" "$MESSAGE_TEXT" "$REPO_NAME") 152 | fi 153 | 154 | MESSAGE_TEXT=$(printf "%s\n\nIssue: #%s - %s" "$MESSAGE_TEXT" "$ISSUE_NUMBER" "$ISSUE_TITLE") 155 | 156 | BODY_DATA=$(jq -n \ 157 | --arg text "$MESSAGE_TEXT" \ 158 | '{ 159 | "data": { 160 | "text": $text 161 | } 162 | }') 163 | 164 | curl --request POST \ 165 | --url https://app.asana.com/api/1.0/tasks/$TASK_GID/stories \ 166 | --header 'accept: application/json' \ 167 | --header 'authorization: Bearer ${{ secrets.ASANA_PAT }}' \ 168 | --header 'content-type: application/json' \ 169 | --data "$BODY_DATA" 170 | else 171 | echo "No corresponding Asana task found for issue ID: $ISSUE_ID" 172 | fi -------------------------------------------------------------------------------- /models/NotificationTarget.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { SegmentNotificationTarget } from './SegmentNotificationTarget'; 10 | import { SubscriptionNotificationTarget } from './SubscriptionNotificationTarget'; 11 | import { HttpFile } from '../http/http'; 12 | 13 | export class NotificationTarget { 14 | /** 15 | * 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\"] 16 | */ 17 | 'included_segments'?: Array; 18 | /** 19 | * 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\"] 20 | */ 21 | 'excluded_segments'?: Array; 22 | /** 23 | * 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 24 | */ 25 | 'include_subscription_ids'?: Array; 26 | /** 27 | * 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: nick@catfac.ts Limit of 2,000 entries per REST API call 28 | */ 29 | 'include_email_tokens'?: Array; 30 | /** 31 | * Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call 32 | */ 33 | 'include_phone_numbers'?: Array; 34 | /** 35 | * 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 36 | */ 37 | 'include_ios_tokens'?: Array; 38 | /** 39 | * 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 40 | */ 41 | 'include_wp_wns_uris'?: Array; 42 | /** 43 | * 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 44 | */ 45 | 'include_amazon_reg_ids'?: Array; 46 | /** 47 | * 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 48 | */ 49 | 'include_chrome_reg_ids'?: Array; 50 | /** 51 | * 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 52 | */ 53 | 'include_chrome_web_reg_ids'?: Array; 54 | /** 55 | * 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 56 | */ 57 | 'include_android_reg_ids'?: Array; 58 | /** 59 | * 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. 60 | */ 61 | 'include_aliases'?: { [key: string]: Array; }; 62 | 'target_channel'?: NotificationTargetTargetChannelEnum; 63 | 64 | static readonly discriminator: string | undefined = undefined; 65 | 66 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 67 | { 68 | "name": "included_segments", 69 | "baseName": "included_segments", 70 | "type": "Array", 71 | "format": "" 72 | }, 73 | { 74 | "name": "excluded_segments", 75 | "baseName": "excluded_segments", 76 | "type": "Array", 77 | "format": "" 78 | }, 79 | { 80 | "name": "include_subscription_ids", 81 | "baseName": "include_subscription_ids", 82 | "type": "Array", 83 | "format": "" 84 | }, 85 | { 86 | "name": "include_email_tokens", 87 | "baseName": "include_email_tokens", 88 | "type": "Array", 89 | "format": "" 90 | }, 91 | { 92 | "name": "include_phone_numbers", 93 | "baseName": "include_phone_numbers", 94 | "type": "Array", 95 | "format": "" 96 | }, 97 | { 98 | "name": "include_ios_tokens", 99 | "baseName": "include_ios_tokens", 100 | "type": "Array", 101 | "format": "" 102 | }, 103 | { 104 | "name": "include_wp_wns_uris", 105 | "baseName": "include_wp_wns_uris", 106 | "type": "Array", 107 | "format": "" 108 | }, 109 | { 110 | "name": "include_amazon_reg_ids", 111 | "baseName": "include_amazon_reg_ids", 112 | "type": "Array", 113 | "format": "" 114 | }, 115 | { 116 | "name": "include_chrome_reg_ids", 117 | "baseName": "include_chrome_reg_ids", 118 | "type": "Array", 119 | "format": "" 120 | }, 121 | { 122 | "name": "include_chrome_web_reg_ids", 123 | "baseName": "include_chrome_web_reg_ids", 124 | "type": "Array", 125 | "format": "" 126 | }, 127 | { 128 | "name": "include_android_reg_ids", 129 | "baseName": "include_android_reg_ids", 130 | "type": "Array", 131 | "format": "" 132 | }, 133 | { 134 | "name": "include_aliases", 135 | "baseName": "include_aliases", 136 | "type": "{ [key: string]: Array; }", 137 | "format": "" 138 | }, 139 | { 140 | "name": "target_channel", 141 | "baseName": "target_channel", 142 | "type": "NotificationTargetTargetChannelEnum", 143 | "format": "" 144 | } ]; 145 | 146 | static getAttributeTypeMap() { 147 | return NotificationTarget.attributeTypeMap; 148 | } 149 | 150 | public constructor() { 151 | } 152 | } 153 | 154 | 155 | export type NotificationTargetTargetChannelEnum = "push" | "email" | "sms" ; 156 | 157 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@types/node@24.1.0": 6 | version "24.1.0" 7 | resolved "https://registry.yarnpkg.com/@types/node/-/node-24.1.0.tgz#0993f7dc31ab5cc402d112315b463e383d68a49c" 8 | integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== 9 | dependencies: 10 | undici-types "~7.8.0" 11 | 12 | "@types/url-parse@1.4.4": 13 | version "1.4.4" 14 | resolved "https://registry.yarnpkg.com/@types/url-parse/-/url-parse-1.4.4.tgz#ebeb0ec8b581318739cf73e9f9b186f610764255" 15 | integrity sha512-KtQLad12+4T/NfSxpoDhmr22+fig3T7/08QCgmutYA6QSznSRmEtuL95GrhVV40/0otTEdFc+etRcCTqhh1q5Q== 16 | 17 | asynckit@^0.4.0: 18 | version "0.4.0" 19 | resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" 20 | integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== 21 | 22 | btoa@^1.2.1: 23 | version "1.2.1" 24 | resolved "https://registry.yarnpkg.com/btoa/-/btoa-1.2.1.tgz#01a9909f8b2c93f6bf680ba26131eb30f7fa3d73" 25 | integrity sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g== 26 | 27 | call-bind-apply-helpers@^1.0.1, call-bind-apply-helpers@^1.0.2: 28 | version "1.0.2" 29 | resolved "https://registry.yarnpkg.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz#4b5428c222be985d79c3d82657479dbe0b59b2d6" 30 | integrity sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ== 31 | dependencies: 32 | es-errors "^1.3.0" 33 | function-bind "^1.1.2" 34 | 35 | combined-stream@^1.0.8: 36 | version "1.0.8" 37 | resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" 38 | integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== 39 | dependencies: 40 | delayed-stream "~1.0.0" 41 | 42 | delayed-stream@~1.0.0: 43 | version "1.0.0" 44 | resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" 45 | integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== 46 | 47 | dunder-proto@^1.0.1: 48 | version "1.0.1" 49 | resolved "https://registry.yarnpkg.com/dunder-proto/-/dunder-proto-1.0.1.tgz#d7ae667e1dc83482f8b70fd0f6eefc50da30f58a" 50 | integrity sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A== 51 | dependencies: 52 | call-bind-apply-helpers "^1.0.1" 53 | es-errors "^1.3.0" 54 | gopd "^1.2.0" 55 | 56 | es-define-property@^1.0.1: 57 | version "1.0.1" 58 | resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.1.tgz#983eb2f9a6724e9303f61addf011c72e09e0b0fa" 59 | integrity sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g== 60 | 61 | es-errors@^1.3.0: 62 | version "1.3.0" 63 | resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" 64 | integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== 65 | 66 | es-object-atoms@^1.0.0, es-object-atoms@^1.1.1: 67 | version "1.1.1" 68 | resolved "https://registry.yarnpkg.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz#1c4f2c4837327597ce69d2ca190a7fdd172338c1" 69 | integrity sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA== 70 | dependencies: 71 | es-errors "^1.3.0" 72 | 73 | es-set-tostringtag@^2.1.0: 74 | version "2.1.0" 75 | resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz#f31dbbe0c183b00a6d26eb6325c810c0fd18bd4d" 76 | integrity sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA== 77 | dependencies: 78 | es-errors "^1.3.0" 79 | get-intrinsic "^1.2.6" 80 | has-tostringtag "^1.0.2" 81 | hasown "^2.0.2" 82 | 83 | es6-promise@^4.2.4: 84 | version "4.2.8" 85 | resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" 86 | integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== 87 | 88 | form-data@^2.5.0: 89 | version "2.5.5" 90 | resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.5.tgz#a5f6364ad7e4e67e95b4a07e2d8c6f711c74f624" 91 | integrity sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A== 92 | dependencies: 93 | asynckit "^0.4.0" 94 | combined-stream "^1.0.8" 95 | es-set-tostringtag "^2.1.0" 96 | hasown "^2.0.2" 97 | mime-types "^2.1.35" 98 | safe-buffer "^5.2.1" 99 | 100 | function-bind@^1.1.2: 101 | version "1.1.2" 102 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" 103 | integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== 104 | 105 | get-intrinsic@^1.2.6: 106 | version "1.3.0" 107 | resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz#743f0e3b6964a93a5491ed1bffaae054d7f98d01" 108 | integrity sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ== 109 | dependencies: 110 | call-bind-apply-helpers "^1.0.2" 111 | es-define-property "^1.0.1" 112 | es-errors "^1.3.0" 113 | es-object-atoms "^1.1.1" 114 | function-bind "^1.1.2" 115 | get-proto "^1.0.1" 116 | gopd "^1.2.0" 117 | has-symbols "^1.1.0" 118 | hasown "^2.0.2" 119 | math-intrinsics "^1.1.0" 120 | 121 | get-proto@^1.0.1: 122 | version "1.0.1" 123 | resolved "https://registry.yarnpkg.com/get-proto/-/get-proto-1.0.1.tgz#150b3f2743869ef3e851ec0c49d15b1d14d00ee1" 124 | integrity sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g== 125 | dependencies: 126 | dunder-proto "^1.0.1" 127 | es-object-atoms "^1.0.0" 128 | 129 | gopd@^1.2.0: 130 | version "1.2.0" 131 | resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" 132 | integrity sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg== 133 | 134 | has-symbols@^1.0.3, has-symbols@^1.1.0: 135 | version "1.1.0" 136 | resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.1.0.tgz#fc9c6a783a084951d0b971fe1018de813707a338" 137 | integrity sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ== 138 | 139 | has-tostringtag@^1.0.2: 140 | version "1.0.2" 141 | resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" 142 | integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== 143 | dependencies: 144 | has-symbols "^1.0.3" 145 | 146 | hasown@^2.0.2: 147 | version "2.0.2" 148 | resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" 149 | integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== 150 | dependencies: 151 | function-bind "^1.1.2" 152 | 153 | math-intrinsics@^1.1.0: 154 | version "1.1.0" 155 | resolved "https://registry.yarnpkg.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz#a0dd74be81e2aa5c2f27e65ce283605ee4e2b7f9" 156 | integrity sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g== 157 | 158 | mime-db@1.52.0: 159 | version "1.52.0" 160 | resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" 161 | integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== 162 | 163 | mime-types@^2.1.35: 164 | version "2.1.35" 165 | resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" 166 | integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== 167 | dependencies: 168 | mime-db "1.52.0" 169 | 170 | querystringify@^2.1.1: 171 | version "2.2.0" 172 | resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" 173 | integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== 174 | 175 | requires-port@^1.0.0: 176 | version "1.0.0" 177 | resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" 178 | integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== 179 | 180 | safe-buffer@^5.2.1: 181 | version "5.2.1" 182 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" 183 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 184 | 185 | typescript@^4.0: 186 | version "4.9.5" 187 | resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" 188 | integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== 189 | 190 | undici-types@~7.8.0: 191 | version "7.8.0" 192 | resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" 193 | integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== 194 | 195 | url-parse@^1.4.3: 196 | version "1.5.10" 197 | resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" 198 | integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ== 199 | dependencies: 200 | querystringify "^2.1.1" 201 | requires-port "^1.0.0" 202 | -------------------------------------------------------------------------------- /models/LanguageStringMap.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class LanguageStringMap { 12 | /** 13 | * Text in English. Will be used as a fallback 14 | */ 15 | 'en'?: string; 16 | /** 17 | * Text in Arabic. 18 | */ 19 | 'ar'?: string; 20 | /** 21 | * Text in Bosnian. 22 | */ 23 | 'bs'?: string; 24 | /** 25 | * Text in Bulgarian. 26 | */ 27 | 'bg'?: string; 28 | /** 29 | * Text in Catalan. 30 | */ 31 | 'ca'?: string; 32 | /** 33 | * Text in Chinese (Simplified). 34 | */ 35 | 'zh_hans'?: string; 36 | /** 37 | * Text in Chinese (Traditional). 38 | */ 39 | 'zh_hant'?: string; 40 | /** 41 | * Alias for zh-Hans. 42 | */ 43 | 'zh'?: string; 44 | /** 45 | * Text in Croatian. 46 | */ 47 | 'hr'?: string; 48 | /** 49 | * Text in Czech. 50 | */ 51 | 'cs'?: string; 52 | /** 53 | * Text in Danish. 54 | */ 55 | 'da'?: string; 56 | /** 57 | * Text in Dutch. 58 | */ 59 | 'nl'?: string; 60 | /** 61 | * Text in Estonian. 62 | */ 63 | 'et'?: string; 64 | /** 65 | * Text in Finnish. 66 | */ 67 | 'fi'?: string; 68 | /** 69 | * Text in French. 70 | */ 71 | 'fr'?: string; 72 | /** 73 | * Text in Georgian. 74 | */ 75 | 'ka'?: string; 76 | /** 77 | * Text in German. 78 | */ 79 | 'de'?: string; 80 | /** 81 | * Text in Greek. 82 | */ 83 | 'el'?: string; 84 | /** 85 | * Text in Hindi. 86 | */ 87 | 'hi'?: string; 88 | /** 89 | * Text in Hebrew. 90 | */ 91 | 'he'?: string; 92 | /** 93 | * Text in Hungarian. 94 | */ 95 | 'hu'?: string; 96 | /** 97 | * Text in Indonesian. 98 | */ 99 | 'id'?: string; 100 | /** 101 | * Text in Italian. 102 | */ 103 | 'it'?: string; 104 | /** 105 | * Text in Japanese. 106 | */ 107 | 'ja'?: string; 108 | /** 109 | * Text in Korean. 110 | */ 111 | 'ko'?: string; 112 | /** 113 | * Text in Latvian. 114 | */ 115 | 'lv'?: string; 116 | /** 117 | * Text in Lithuanian. 118 | */ 119 | 'lt'?: string; 120 | /** 121 | * Text in Malay. 122 | */ 123 | 'ms'?: string; 124 | /** 125 | * Text in Norwegian. 126 | */ 127 | 'nb'?: string; 128 | /** 129 | * Text in Polish. 130 | */ 131 | 'pl'?: string; 132 | /** 133 | * Text in Persian. 134 | */ 135 | 'fa'?: string; 136 | /** 137 | * Text in Portugese. 138 | */ 139 | 'pt'?: string; 140 | /** 141 | * Text in Punjabi. 142 | */ 143 | 'pa'?: string; 144 | /** 145 | * Text in Romanian. 146 | */ 147 | 'ro'?: string; 148 | /** 149 | * Text in Russian. 150 | */ 151 | 'ru'?: string; 152 | /** 153 | * Text in Serbian. 154 | */ 155 | 'sr'?: string; 156 | /** 157 | * Text in Slovak. 158 | */ 159 | 'sk'?: string; 160 | /** 161 | * Text in Spanish. 162 | */ 163 | 'es'?: string; 164 | /** 165 | * Text in Swedish. 166 | */ 167 | 'sv'?: string; 168 | /** 169 | * Text in Thai. 170 | */ 171 | 'th'?: string; 172 | /** 173 | * Text in Turkish. 174 | */ 175 | 'tr'?: string; 176 | /** 177 | * Text in Ukrainian. 178 | */ 179 | 'uk'?: string; 180 | /** 181 | * Text in Vietnamese. 182 | */ 183 | 'vi'?: string; 184 | 185 | static readonly discriminator: string | undefined = undefined; 186 | 187 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 188 | { 189 | "name": "en", 190 | "baseName": "en", 191 | "type": "string", 192 | "format": "" 193 | }, 194 | { 195 | "name": "ar", 196 | "baseName": "ar", 197 | "type": "string", 198 | "format": "" 199 | }, 200 | { 201 | "name": "bs", 202 | "baseName": "bs", 203 | "type": "string", 204 | "format": "" 205 | }, 206 | { 207 | "name": "bg", 208 | "baseName": "bg", 209 | "type": "string", 210 | "format": "" 211 | }, 212 | { 213 | "name": "ca", 214 | "baseName": "ca", 215 | "type": "string", 216 | "format": "" 217 | }, 218 | { 219 | "name": "zh_hans", 220 | "baseName": "zh-Hans", 221 | "type": "string", 222 | "format": "" 223 | }, 224 | { 225 | "name": "zh_hant", 226 | "baseName": "zh-Hant", 227 | "type": "string", 228 | "format": "" 229 | }, 230 | { 231 | "name": "zh", 232 | "baseName": "zh", 233 | "type": "string", 234 | "format": "" 235 | }, 236 | { 237 | "name": "hr", 238 | "baseName": "hr", 239 | "type": "string", 240 | "format": "" 241 | }, 242 | { 243 | "name": "cs", 244 | "baseName": "cs", 245 | "type": "string", 246 | "format": "" 247 | }, 248 | { 249 | "name": "da", 250 | "baseName": "da", 251 | "type": "string", 252 | "format": "" 253 | }, 254 | { 255 | "name": "nl", 256 | "baseName": "nl", 257 | "type": "string", 258 | "format": "" 259 | }, 260 | { 261 | "name": "et", 262 | "baseName": "et", 263 | "type": "string", 264 | "format": "" 265 | }, 266 | { 267 | "name": "fi", 268 | "baseName": "fi", 269 | "type": "string", 270 | "format": "" 271 | }, 272 | { 273 | "name": "fr", 274 | "baseName": "fr", 275 | "type": "string", 276 | "format": "" 277 | }, 278 | { 279 | "name": "ka", 280 | "baseName": "ka", 281 | "type": "string", 282 | "format": "" 283 | }, 284 | { 285 | "name": "de", 286 | "baseName": "de", 287 | "type": "string", 288 | "format": "" 289 | }, 290 | { 291 | "name": "el", 292 | "baseName": "el", 293 | "type": "string", 294 | "format": "" 295 | }, 296 | { 297 | "name": "hi", 298 | "baseName": "hi", 299 | "type": "string", 300 | "format": "" 301 | }, 302 | { 303 | "name": "he", 304 | "baseName": "he", 305 | "type": "string", 306 | "format": "" 307 | }, 308 | { 309 | "name": "hu", 310 | "baseName": "hu", 311 | "type": "string", 312 | "format": "" 313 | }, 314 | { 315 | "name": "id", 316 | "baseName": "id", 317 | "type": "string", 318 | "format": "" 319 | }, 320 | { 321 | "name": "it", 322 | "baseName": "it", 323 | "type": "string", 324 | "format": "" 325 | }, 326 | { 327 | "name": "ja", 328 | "baseName": "ja", 329 | "type": "string", 330 | "format": "" 331 | }, 332 | { 333 | "name": "ko", 334 | "baseName": "ko", 335 | "type": "string", 336 | "format": "" 337 | }, 338 | { 339 | "name": "lv", 340 | "baseName": "lv", 341 | "type": "string", 342 | "format": "" 343 | }, 344 | { 345 | "name": "lt", 346 | "baseName": "lt", 347 | "type": "string", 348 | "format": "" 349 | }, 350 | { 351 | "name": "ms", 352 | "baseName": "ms", 353 | "type": "string", 354 | "format": "" 355 | }, 356 | { 357 | "name": "nb", 358 | "baseName": "nb", 359 | "type": "string", 360 | "format": "" 361 | }, 362 | { 363 | "name": "pl", 364 | "baseName": "pl", 365 | "type": "string", 366 | "format": "" 367 | }, 368 | { 369 | "name": "fa", 370 | "baseName": "fa", 371 | "type": "string", 372 | "format": "" 373 | }, 374 | { 375 | "name": "pt", 376 | "baseName": "pt", 377 | "type": "string", 378 | "format": "" 379 | }, 380 | { 381 | "name": "pa", 382 | "baseName": "pa", 383 | "type": "string", 384 | "format": "" 385 | }, 386 | { 387 | "name": "ro", 388 | "baseName": "ro", 389 | "type": "string", 390 | "format": "" 391 | }, 392 | { 393 | "name": "ru", 394 | "baseName": "ru", 395 | "type": "string", 396 | "format": "" 397 | }, 398 | { 399 | "name": "sr", 400 | "baseName": "sr", 401 | "type": "string", 402 | "format": "" 403 | }, 404 | { 405 | "name": "sk", 406 | "baseName": "sk", 407 | "type": "string", 408 | "format": "" 409 | }, 410 | { 411 | "name": "es", 412 | "baseName": "es", 413 | "type": "string", 414 | "format": "" 415 | }, 416 | { 417 | "name": "sv", 418 | "baseName": "sv", 419 | "type": "string", 420 | "format": "" 421 | }, 422 | { 423 | "name": "th", 424 | "baseName": "th", 425 | "type": "string", 426 | "format": "" 427 | }, 428 | { 429 | "name": "tr", 430 | "baseName": "tr", 431 | "type": "string", 432 | "format": "" 433 | }, 434 | { 435 | "name": "uk", 436 | "baseName": "uk", 437 | "type": "string", 438 | "format": "" 439 | }, 440 | { 441 | "name": "vi", 442 | "baseName": "vi", 443 | "type": "string", 444 | "format": "" 445 | } ]; 446 | 447 | static getAttributeTypeMap() { 448 | return LanguageStringMap.attributeTypeMap; 449 | } 450 | 451 | public constructor() { 452 | } 453 | } 454 | 455 | -------------------------------------------------------------------------------- /models/App.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * OneSignal 3 | * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com 4 | * 5 | * API Version: 5.3.0 6 | * Contact: devrel@onesignal.com 7 | */ 8 | 9 | import { HttpFile } from '../http/http'; 10 | 11 | export class App { 12 | 'id'?: string; 13 | /** 14 | * The name of your app, as displayed on your apps list on the dashboard. This can be renamed. 15 | */ 16 | 'name'?: string; 17 | 'players'?: number; 18 | 'messageable_players'?: number; 19 | 'updated_at'?: string; 20 | 'created_at'?: string; 21 | /** 22 | * Android: Your Google Project number. Also known as Sender ID. 23 | */ 24 | 'android_gcm_sender_id'?: string; 25 | /** 26 | * Android: Your Google Push Messaging Auth Key 27 | */ 28 | 'gcm_key'?: string; 29 | /** 30 | * Chrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters. 31 | */ 32 | 'chrome_web_origin'?: string; 33 | /** 34 | * Not for web push. Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions. 35 | */ 36 | 'chrome_key'?: string; 37 | /** 38 | * Chrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80. 39 | */ 40 | 'chrome_web_default_notification_icon'?: string; 41 | /** 42 | * Chrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed. 43 | */ 44 | 'chrome_web_sub_domain'?: string; 45 | /** 46 | * iOS: Either sandbox or production 47 | */ 48 | 'apns_env'?: AppApnsEnvEnum; 49 | /** 50 | * iOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded. 51 | */ 52 | 'apns_p12'?: string; 53 | /** 54 | * iOS: Required if using p12 certificate. Password for the apns_p12 file. 55 | */ 56 | 'apns_p12_password'?: string; 57 | 'apns_certificates'?: string; 58 | 'safari_apns_certificates'?: string; 59 | /** 60 | * Safari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded. 61 | */ 62 | 'safari_apns_p12'?: string; 63 | /** 64 | * Safari: Password for safari_apns_p12 file 65 | */ 66 | 'safari_apns_p12_password'?: string; 67 | /** 68 | * iOS: Required if using p8. Unique identifier for the p8 authentication key. 69 | */ 70 | 'apns_key_id'?: string; 71 | /** 72 | * iOS: Required if using p8. Team ID generated by Apple for your developer account. 73 | */ 74 | 'apns_team_id'?: string; 75 | /** 76 | * iOS: Required if using p8. Bundle ID for your app in the Apple ecosystem. 77 | */ 78 | 'apns_bundle_id'?: string; 79 | /** 80 | * iOS: Required if using p8. Base64 encoded p8 key 81 | */ 82 | 'apns_p8'?: string; 83 | /** 84 | * Safari (Recommended): The hostname to your website including http(s):// 85 | */ 86 | 'safari_site_origin'?: string; 87 | 'safari_push_id'?: string; 88 | 'safari_icon_16_16'?: string; 89 | 'safari_icon_32_32'?: string; 90 | 'safari_icon_64_64'?: string; 91 | 'safari_icon_128_128'?: string; 92 | /** 93 | * Safari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide. 94 | */ 95 | 'safari_icon_256_256'?: string; 96 | /** 97 | * All Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it. 98 | */ 99 | 'site_name'?: string; 100 | 'basic_auth_key'?: string; 101 | /** 102 | * The Id of the Organization you would like to add this app to. 103 | */ 104 | 'organization_id'?: string; 105 | /** 106 | * iOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device. Ignore if you\'re not using any other plugins, or not using OneSignal SDK methods to read the payload. 107 | */ 108 | 'additional_data_is_root_payload'?: boolean; 109 | 110 | static readonly discriminator: string | undefined = undefined; 111 | 112 | static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [ 113 | { 114 | "name": "id", 115 | "baseName": "id", 116 | "type": "string", 117 | "format": "" 118 | }, 119 | { 120 | "name": "name", 121 | "baseName": "name", 122 | "type": "string", 123 | "format": "" 124 | }, 125 | { 126 | "name": "players", 127 | "baseName": "players", 128 | "type": "number", 129 | "format": "" 130 | }, 131 | { 132 | "name": "messageable_players", 133 | "baseName": "messageable_players", 134 | "type": "number", 135 | "format": "" 136 | }, 137 | { 138 | "name": "updated_at", 139 | "baseName": "updated_at", 140 | "type": "string", 141 | "format": "date-time" 142 | }, 143 | { 144 | "name": "created_at", 145 | "baseName": "created_at", 146 | "type": "string", 147 | "format": "date-time" 148 | }, 149 | { 150 | "name": "android_gcm_sender_id", 151 | "baseName": "android_gcm_sender_id", 152 | "type": "string", 153 | "format": "" 154 | }, 155 | { 156 | "name": "gcm_key", 157 | "baseName": "gcm_key", 158 | "type": "string", 159 | "format": "" 160 | }, 161 | { 162 | "name": "chrome_web_origin", 163 | "baseName": "chrome_web_origin", 164 | "type": "string", 165 | "format": "" 166 | }, 167 | { 168 | "name": "chrome_key", 169 | "baseName": "chrome_key", 170 | "type": "string", 171 | "format": "" 172 | }, 173 | { 174 | "name": "chrome_web_default_notification_icon", 175 | "baseName": "chrome_web_default_notification_icon", 176 | "type": "string", 177 | "format": "" 178 | }, 179 | { 180 | "name": "chrome_web_sub_domain", 181 | "baseName": "chrome_web_sub_domain", 182 | "type": "string", 183 | "format": "" 184 | }, 185 | { 186 | "name": "apns_env", 187 | "baseName": "apns_env", 188 | "type": "AppApnsEnvEnum", 189 | "format": "" 190 | }, 191 | { 192 | "name": "apns_p12", 193 | "baseName": "apns_p12", 194 | "type": "string", 195 | "format": "" 196 | }, 197 | { 198 | "name": "apns_p12_password", 199 | "baseName": "apns_p12_password", 200 | "type": "string", 201 | "format": "" 202 | }, 203 | { 204 | "name": "apns_certificates", 205 | "baseName": "apns_certificates", 206 | "type": "string", 207 | "format": "" 208 | }, 209 | { 210 | "name": "safari_apns_certificates", 211 | "baseName": "safari_apns_certificates", 212 | "type": "string", 213 | "format": "" 214 | }, 215 | { 216 | "name": "safari_apns_p12", 217 | "baseName": "safari_apns_p12", 218 | "type": "string", 219 | "format": "" 220 | }, 221 | { 222 | "name": "safari_apns_p12_password", 223 | "baseName": "safari_apns_p12_password", 224 | "type": "string", 225 | "format": "" 226 | }, 227 | { 228 | "name": "apns_key_id", 229 | "baseName": "apns_key_id", 230 | "type": "string", 231 | "format": "" 232 | }, 233 | { 234 | "name": "apns_team_id", 235 | "baseName": "apns_team_id", 236 | "type": "string", 237 | "format": "" 238 | }, 239 | { 240 | "name": "apns_bundle_id", 241 | "baseName": "apns_bundle_id", 242 | "type": "string", 243 | "format": "" 244 | }, 245 | { 246 | "name": "apns_p8", 247 | "baseName": "apns_p8", 248 | "type": "string", 249 | "format": "" 250 | }, 251 | { 252 | "name": "safari_site_origin", 253 | "baseName": "safari_site_origin", 254 | "type": "string", 255 | "format": "" 256 | }, 257 | { 258 | "name": "safari_push_id", 259 | "baseName": "safari_push_id", 260 | "type": "string", 261 | "format": "" 262 | }, 263 | { 264 | "name": "safari_icon_16_16", 265 | "baseName": "safari_icon_16_16", 266 | "type": "string", 267 | "format": "" 268 | }, 269 | { 270 | "name": "safari_icon_32_32", 271 | "baseName": "safari_icon_32_32", 272 | "type": "string", 273 | "format": "" 274 | }, 275 | { 276 | "name": "safari_icon_64_64", 277 | "baseName": "safari_icon_64_64", 278 | "type": "string", 279 | "format": "" 280 | }, 281 | { 282 | "name": "safari_icon_128_128", 283 | "baseName": "safari_icon_128_128", 284 | "type": "string", 285 | "format": "" 286 | }, 287 | { 288 | "name": "safari_icon_256_256", 289 | "baseName": "safari_icon_256_256", 290 | "type": "string", 291 | "format": "" 292 | }, 293 | { 294 | "name": "site_name", 295 | "baseName": "site_name", 296 | "type": "string", 297 | "format": "" 298 | }, 299 | { 300 | "name": "basic_auth_key", 301 | "baseName": "basic_auth_key", 302 | "type": "string", 303 | "format": "" 304 | }, 305 | { 306 | "name": "organization_id", 307 | "baseName": "organization_id", 308 | "type": "string", 309 | "format": "" 310 | }, 311 | { 312 | "name": "additional_data_is_root_payload", 313 | "baseName": "additional_data_is_root_payload", 314 | "type": "boolean", 315 | "format": "" 316 | } ]; 317 | 318 | static getAttributeTypeMap() { 319 | return App.attributeTypeMap; 320 | } 321 | 322 | public constructor() { 323 | } 324 | } 325 | 326 | 327 | export type AppApnsEnvEnum = "sandbox" | "production" ; 328 | 329 | --------------------------------------------------------------------------------