UNPKG

@onesignal/node-onesignal

Version:

OpenAPI client for @onesignal/node-onesignal

680 lines 216 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DefaultApiResponseProcessor = exports.DefaultApiRequestFactory = void 0; var baseapi_1 = require("./baseapi"); var http_1 = require("../http/http"); var ObjectSerializer_1 = require("../models/ObjectSerializer"); var exception_1 = require("./exception"); var util_1 = require("../util"); var DefaultApiRequestFactory = (function (_super) { __extends(DefaultApiRequestFactory, _super); function DefaultApiRequestFactory() { return _super !== null && _super.apply(this, arguments) || this; } DefaultApiRequestFactory.prototype.cancelNotification = function (appId, notificationId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "cancelNotification", "appId"); } if (notificationId === null || notificationId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "cancelNotification", "notificationId"); } localVarPath = '/notifications/{notification_id}' .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); if (appId !== undefined) { requestContext.setQueryParam("app_id", ObjectSerializer_1.ObjectSerializer.serialize(appId, "string", "")); } authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createAlias = function (appId, aliasLabel, aliasId, userIdentityBody, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAlias", "appId"); } if (aliasLabel === null || aliasLabel === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAlias", "aliasLabel"); } if (aliasId === null || aliasId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAlias", "aliasId"); } if (userIdentityBody === null || userIdentityBody === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAlias", "userIdentityBody"); } localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createAliasBySubscription = function (appId, subscriptionId, userIdentityBody, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAliasBySubscription", "appId"); } if (subscriptionId === null || subscriptionId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAliasBySubscription", "subscriptionId"); } if (userIdentityBody === null || userIdentityBody === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createAliasBySubscription", "userIdentityBody"); } localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(userIdentityBody, "UserIdentityBody", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createApp = function (app, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (app === null || app === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createApp", "app"); } localVarPath = '/apps'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(app, "App", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["organization_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createNotification = function (notification, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (notification === null || notification === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createNotification", "notification"); } localVarPath = '/notifications'; requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(notification, "Notification", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createSegment = function (appId, segment, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createSegment", "appId"); } localVarPath = '/apps/{app_id}/segments' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(segment, "Segment", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createSubscription = function (appId, aliasLabel, aliasId, subscriptionBody, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createSubscription", "appId"); } if (aliasLabel === null || aliasLabel === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createSubscription", "aliasLabel"); } if (aliasId === null || aliasId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createSubscription", "aliasId"); } if (subscriptionBody === null || subscriptionBody === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createSubscription", "subscriptionBody"); } localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(subscriptionBody, "SubscriptionBody", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.createUser = function (appId, user, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createUser", "appId"); } if (user === null || user === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "createUser", "user"); } localVarPath = '/apps/{app_id}/users' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(user, "User", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.deleteAlias = function (appId, aliasLabel, aliasId, aliasLabelToDelete, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteAlias", "appId"); } if (aliasLabel === null || aliasLabel === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteAlias", "aliasLabel"); } if (aliasId === null || aliasId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteAlias", "aliasId"); } if (aliasLabelToDelete === null || aliasLabelToDelete === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteAlias", "aliasLabelToDelete"); } localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))) .replace('{' + 'alias_label_to_delete' + '}', encodeURIComponent(String(aliasLabelToDelete))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.deleteSegment = function (appId, segmentId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteSegment", "appId"); } if (segmentId === null || segmentId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteSegment", "segmentId"); } localVarPath = '/apps/{app_id}/segments/{segment_id}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'segment_id' + '}', encodeURIComponent(String(segmentId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.deleteSubscription = function (appId, subscriptionId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteSubscription", "appId"); } if (subscriptionId === null || subscriptionId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteSubscription", "subscriptionId"); } localVarPath = '/apps/{app_id}/subscriptions/{subscription_id}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'subscription_id' + '}', encodeURIComponent(String(subscriptionId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.deleteUser = function (appId, aliasLabel, aliasId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteUser", "appId"); } if (aliasLabel === null || aliasLabel === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteUser", "aliasLabel"); } if (aliasId === null || aliasId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "deleteUser", "aliasId"); } localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.exportEvents = function (notificationId, appId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (notificationId === null || notificationId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "exportEvents", "notificationId"); } if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "exportEvents", "appId"); } localVarPath = '/notifications/{notification_id}/export_events?app_id={app_id}' .replace('{' + 'notification_id' + '}', encodeURIComponent(String(notificationId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); if (appId !== undefined) { requestContext.setQueryParam("app_id", ObjectSerializer_1.ObjectSerializer.serialize(appId, "string", "")); } authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.exportSubscriptions = function (appId, exportSubscriptionsRequestBody, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, contentType, serializedBody, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "exportSubscriptions", "appId"); } localVarPath = '/players/csv_export?app_id={app_id}' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))); requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8"); requestContext.setHeaderParam("OS-Usage-Data", "kind=sdk, sdk-name=onesignal-typescript, version=5.2.1-beta1"); contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(exportSubscriptionsRequestBody, "ExportSubscriptionsRequestBody", ""), contentType); requestContext.setBody(serializedBody); authMethod = _config.authMethods["rest_api_key"]; if (!(authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication)) return [3, 2]; return [4, (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext))]; case 1: _d.sent(); _d.label = 2; case 2: defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default); if (!(defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication)) return [3, 4]; return [4, (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext))]; case 3: _d.sent(); _d.label = 4; case 4: return [2, requestContext]; } }); }); }; DefaultApiRequestFactory.prototype.getAliases = function (appId, aliasLabel, aliasId, _options) { var _a, _b, _c; return __awaiter(this, void 0, void 0, function () { var _config, localVarPath, requestContext, authMethod, defaultAuth; return __generator(this, function (_d) { switch (_d.label) { case 0: _config = _options || this.configuration; if (appId === null || appId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "getAliases", "appId"); } if (aliasLabel === null || aliasLabel === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "getAliases", "aliasLabel"); } if (aliasId === null || aliasId === undefined) { throw new baseapi_1.RequiredError("DefaultApi", "getAliases", "aliasId"); } localVarPath = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity' .replace('{' + 'app_id' + '}', encodeURIComponent(String(appId))) .replace('{' + 'alias_label' + '}', encodeURIComponent(String(aliasLabel))) .replace('{' + 'alias_id' + '}', encodeURIComponent(String(aliasId))); reque