masterAccountApi.js•88.3 kB
"use strict";
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 __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MasterAccountApi = exports.MasterAccountApiApiKeys = void 0;
const request_1 = __importDefault(require("request"));
const models_1 = require("../model/models");
const models_2 = require("../model/models");
const apis_1 = require("./apis");
let defaultBasePath = 'https://api.brevo.com/v3';
var MasterAccountApiApiKeys;
(function (MasterAccountApiApiKeys) {
MasterAccountApiApiKeys[MasterAccountApiApiKeys["apiKey"] = 0] = "apiKey";
MasterAccountApiApiKeys[MasterAccountApiApiKeys["partnerKey"] = 1] = "partnerKey";
})(MasterAccountApiApiKeys = exports.MasterAccountApiApiKeys || (exports.MasterAccountApiApiKeys = {}));
class MasterAccountApi {
constructor(basePathOrUsername, password, basePath) {
this._basePath = defaultBasePath;
this._defaultHeaders = {};
this._useQuerystring = false;
this.authentications = {
'default': new models_1.VoidAuth(),
'apiKey': new models_2.ApiKeyAuth('header', 'api-key'),
'partnerKey': new models_2.ApiKeyAuth('header', 'partner-key'),
};
this.interceptors = [];
if (password) {
if (basePath) {
this.basePath = basePath;
}
}
else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername;
}
}
}
set useQuerystring(value) {
this._useQuerystring = value;
}
set basePath(basePath) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
setDefaultAuthentication(auth) {
this.authentications.default = auth;
}
setApiKey(key, value) {
this.authentications[MasterAccountApiApiKeys[key]].apiKey = value;
}
addInterceptor(interceptor) {
this.interceptors.push(interceptor);
}
corporateGroupIdDelete(id, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/group/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateGroupIdDelete.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateGroupIdGet(id, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/group/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateGroupIdGet.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "CorporateGroupDetailsResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateGroupIdPut(id, body, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/group/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateGroupIdPut.');
}
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling corporateGroupIdPut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(body, "CorporateGroupPostRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateGroupPost(body, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/group';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling corporateGroupPost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(body, "CorporateGroupPostRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "CorporateGroupPost201Response");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateGroupUnlinkGroupIdSubAccountsPut(groupId, body, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/group/unlink/{groupId}/subAccounts'
.replace('{' + 'groupId' + '}', encodeURIComponent(String(groupId)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (groupId === null || groupId === undefined) {
throw new Error('Required parameter groupId was null or undefined when calling corporateGroupUnlinkGroupIdSubAccountsPut.');
}
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling corporateGroupUnlinkGroupIdSubAccountsPut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(body, "CorporateGroupUnlinkGroupIdSubAccountsPutRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateMasterAccountGet(options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/masterAccount';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "MasterDetailsResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSsoTokenPost(ssoTokenRequestCorporate, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/ssoToken';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (ssoTokenRequestCorporate === null || ssoTokenRequestCorporate === undefined) {
throw new Error('Required parameter ssoTokenRequestCorporate was null or undefined when calling corporateSsoTokenPost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(ssoTokenRequestCorporate, "SsoTokenRequestCorporate")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "GetSsoToken");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountGet(offset, limit, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (offset === null || offset === undefined) {
throw new Error('Required parameter offset was null or undefined when calling corporateSubAccountGet.');
}
if (limit === null || limit === undefined) {
throw new Error('Required parameter limit was null or undefined when calling corporateSubAccountGet.');
}
if (offset !== undefined) {
localVarQueryParameters['offset'] = models_1.ObjectSerializer.serialize(offset, "number");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = models_1.ObjectSerializer.serialize(limit, "number");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "SubAccountsResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIdApplicationsTogglePut(id, toggleApplications, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/{id}/applications/toggle'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateSubAccountIdApplicationsTogglePut.');
}
if (toggleApplications === null || toggleApplications === undefined) {
throw new Error('Required parameter toggleApplications was null or undefined when calling corporateSubAccountIdApplicationsTogglePut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(toggleApplications, "SubAccountAppsToggleRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIdDelete(id, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateSubAccountIdDelete.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIdGet(id, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/{id}'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateSubAccountIdGet.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "SubAccountDetailsResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIdPlanPut(id, updatePlanDetails, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/{id}/plan'
.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling corporateSubAccountIdPlanPut.');
}
if (updatePlanDetails === null || updatePlanDetails === undefined) {
throw new Error('Required parameter updatePlanDetails was null or undefined when calling corporateSubAccountIdPlanPut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(updatePlanDetails, "SubAccountUpdatePlanRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIpAssociatePost(body, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/ip/associate';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling corporateSubAccountIpAssociatePost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(body, "CorporateSubAccountIpAssociatePostRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "object");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountIpDissociatePut(body, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/ip/dissociate';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (body === null || body === undefined) {
throw new Error('Required parameter body was null or undefined when calling corporateSubAccountIpDissociatePut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(body, "CorporateSubAccountIpDissociatePutRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountKeyPost(createApiKeyRequest, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/key';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (createApiKeyRequest === null || createApiKeyRequest === undefined) {
throw new Error('Required parameter createApiKeyRequest was null or undefined when calling corporateSubAccountKeyPost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(createApiKeyRequest, "CreateApiKeyRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "CreateApiKeyResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountPost(subAccountCreate, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (subAccountCreate === null || subAccountCreate === undefined) {
throw new Error('Required parameter subAccountCreate was null or undefined when calling corporateSubAccountPost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(subAccountCreate, "CreateSubAccount")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "CreateSubAccountResponse");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateSubAccountSsoTokenPost(ssoTokenRequest, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/subAccount/ssoToken';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (ssoTokenRequest === null || ssoTokenRequest === undefined) {
throw new Error('Required parameter ssoTokenRequest was null or undefined when calling corporateSubAccountSsoTokenPost.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(ssoTokenRequest, "SsoTokenRequest")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "GetSsoToken");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateUserInvitationActionEmailPut(action, email, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/user/invitation/{action}/{email}'
.replace('{' + 'action' + '}', encodeURIComponent(String(action)))
.replace('{' + 'email' + '}', encodeURIComponent(String(email)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (action === null || action === undefined) {
throw new Error('Required parameter action was null or undefined when calling corporateUserInvitationActionEmailPut.');
}
if (email === null || email === undefined) {
throw new Error('Required parameter email was null or undefined when calling corporateUserInvitationActionEmailPut.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'PUT',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "CorporateUserInvitationActionEmailPut200Response");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
corporateUserRevokeEmailDelete(email, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/user/revoke/{email}'
.replace('{' + 'email' + '}', encodeURIComponent(String(email)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (email === null || email === undefined) {
throw new Error('Required parameter email was null or undefined when calling corporateUserRevokeEmailDelete.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
getAccountActivity(startDate, endDate, limit, offset, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/organization/activities';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (startDate !== undefined) {
localVarQueryParameters['startDate'] = models_1.ObjectSerializer.serialize(startDate, "string");
}
if (endDate !== undefined) {
localVarQueryParameters['endDate'] = models_1.ObjectSerializer.serialize(endDate, "string");
}
if (limit !== undefined) {
localVarQueryParameters['limit'] = models_1.ObjectSerializer.serialize(limit, "number");
}
if (offset !== undefined) {
localVarQueryParameters['offset'] = models_1.ObjectSerializer.serialize(offset, "number");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "GetAccountActivity");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
getCorporateInvitedUsersList(options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/invited/users';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "GetCorporateInvitedUsersList");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
getCorporateUserPermission(email, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/user/{email}/permissions'
.replace('{' + 'email' + '}', encodeURIComponent(String(email)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (email === null || email === undefined) {
throw new Error('Required parameter email was null or undefined when calling getCorporateUserPermission.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "GetCorporateUserPermission");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
getSubAccountGroups(options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/groups';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "Array<GetSubAccountGroups200ResponseInner>");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
inviteAdminUser(sendInvitation, options = { headers: {} }) {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.basePath + '/corporate/user/invitation/send';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
if (sendInvitation === null || sendInvitation === undefined) {
throw new Error('Required parameter sendInvitation was null or undefined when calling inviteAdminUser.');
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'POST',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(sendInvitation, "InviteAdminUser")
};
let authenticationPromise = Promise.resolve();
if (this.authentications.apiKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.apiKey.applyToRequest(localVarRequestOptions));
}
if (this.authentications.partnerKey.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.partnerKey.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "InviteAdminUser");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
});
}
}
exports.MasterAccountApi = MasterAccountApi;
//# sourceMappingURL=masterAccountApi.js.map