boldsign
Version:
NodeJS client for boldsign
716 lines • 135 kB
JavaScript
"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.DocumentApi = void 0;
const axios_1 = __importDefault(require("axios"));
const model_1 = require("../model");
const _1 = require("./");
let defaultBasePath = 'https://api.boldsign.com';
class DocumentApi {
constructor(basePath) {
this._basePath = defaultBasePath;
this._defaultHeaders = { 'User-Agent': _1.USER_AGENT };
this._useQuerystring = true;
this.authentications = {
'default': new model_1.VoidAuth(),
'Bearer': new model_1.ApiKeyAuth('header', 'Authorization'),
'X-API-KEY': new model_1.ApiKeyAuth('header', 'X-API-KEY'),
};
this.interceptors = [];
if (basePath) {
this.basePath = basePath;
}
}
set useQuerystring(value) {
this._useQuerystring = value;
}
set basePath(basePath) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders) {
this._defaultHeaders = Object.assign(Object.assign({}, defaultHeaders), { "User-Agent": _1.USER_AGENT });
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
setDefaultAuthentication(auth) {
this.authentications.default = auth;
}
setApiKey(apikey) {
this.authentications["X-API-KEY"].apiKey = apikey;
}
setAccessToken(accessToken) {
this.authentications["Bearer"].apiKey = 'bearer ' + accessToken;
}
addInterceptor(interceptor) {
this.interceptors.push(interceptor);
}
addAuthentication(documentId_1, accessCodeDetail_1) {
return __awaiter(this, arguments, void 0, function* (documentId, accessCodeDetail, options = { headers: {} }) {
accessCodeDetail = deserializeIfNeeded(accessCodeDetail, "AccessCodeDetail");
const localVarPath = this.basePath + '/v1/document/addAuthentication';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
if (documentId === null || documentId === undefined) {
throw new Error('Required parameter documentId was null or undefined when calling addAuthentication.');
}
if (documentId !== undefined) {
localVarQueryParameters['documentId'] = model_1.ObjectSerializer.serialize(documentId, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(accessCodeDetail, model_1.AccessCodeDetail);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(accessCodeDetail, "AccessCodeDetail");
}
let localVarRequestOptions = {
method: 'PATCH',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response);
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
addTag(documentTags_1) {
return __awaiter(this, arguments, void 0, function* (documentTags, options = { headers: {} }) {
documentTags = deserializeIfNeeded(documentTags, "DocumentTags");
const localVarPath = this.basePath + '/v1/document/addTags';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(documentTags, model_1.DocumentTags);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(documentTags, "DocumentTags");
}
let localVarRequestOptions = {
method: 'PATCH',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response);
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 400, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
behalfDocuments(page_1, pageType_1, emailAddress_1, signers_1, pageSize_1, startDate_1, status_1, endDate_1, searchKey_1, labels_1, nextCursor_1, brandIds_1) {
return __awaiter(this, arguments, void 0, function* (page, pageType, emailAddress, signers, pageSize, startDate, status, endDate, searchKey, labels, nextCursor, brandIds, options = { headers: {} }) {
const localVarPath = this.basePath + '/v1/document/behalfList';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
if (page === null || page === undefined) {
throw new Error('Required parameter page was null or undefined when calling behalfDocuments.');
}
if (pageType !== undefined) {
localVarQueryParameters['PageType'] = model_1.ObjectSerializer.serialize(pageType, "'BehalfOfOthers' | 'BehalfOfMe'");
}
if (emailAddress !== undefined) {
localVarQueryParameters['EmailAddress'] = model_1.ObjectSerializer.serialize(emailAddress, "Array<string>");
}
if (signers !== undefined) {
localVarQueryParameters['Signers'] = model_1.ObjectSerializer.serialize(signers, "Array<string>");
}
if (pageSize !== undefined) {
localVarQueryParameters['PageSize'] = model_1.ObjectSerializer.serialize(pageSize, "number");
}
if (page !== undefined) {
localVarQueryParameters['Page'] = model_1.ObjectSerializer.serialize(page, "number");
}
if (startDate !== undefined) {
localVarQueryParameters['StartDate'] = model_1.ObjectSerializer.serialize(startDate, "Date");
}
if (status !== undefined) {
localVarQueryParameters['Status'] = model_1.ObjectSerializer.serialize(status, "Array<'None' | 'WaitingForMe' | 'WaitingForOthers' | 'NeedAttention' | 'Completed' | 'Declined' | 'Revoked' | 'Expired' | 'Draft' | 'Scheduled'>");
}
if (endDate !== undefined) {
localVarQueryParameters['EndDate'] = model_1.ObjectSerializer.serialize(endDate, "Date");
}
if (searchKey !== undefined) {
localVarQueryParameters['SearchKey'] = model_1.ObjectSerializer.serialize(searchKey, "string");
}
if (labels !== undefined) {
localVarQueryParameters['Labels'] = model_1.ObjectSerializer.serialize(labels, "Array<string>");
}
if (nextCursor !== undefined) {
localVarQueryParameters['NextCursor'] = model_1.ObjectSerializer.serialize(nextCursor, "number");
}
if (brandIds !== undefined) {
localVarQueryParameters['BrandIds'] = model_1.ObjectSerializer.serialize(brandIds, "Array<string>");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(localVarFormParams);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
let localVarRequestOptions = {
method: 'GET',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response, "BehalfDocumentRecords");
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 200, "BehalfDocumentRecords")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
changeAccessCode(documentId_1, accessCodeDetails_1, emailId_1, zOrder_1) {
return __awaiter(this, arguments, void 0, function* (documentId, accessCodeDetails, emailId, zOrder, options = { headers: {} }) {
accessCodeDetails = deserializeIfNeeded(accessCodeDetails, "AccessCodeDetails");
const localVarPath = this.basePath + '/v1/document/changeAccessCode';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
if (documentId === null || documentId === undefined) {
throw new Error('Required parameter documentId was null or undefined when calling changeAccessCode.');
}
if (accessCodeDetails === null || accessCodeDetails === undefined) {
throw new Error('Required parameter accessCodeDetails was null or undefined when calling changeAccessCode.');
}
if (documentId !== undefined) {
localVarQueryParameters['DocumentId'] = model_1.ObjectSerializer.serialize(documentId, "string");
}
if (emailId !== undefined) {
localVarQueryParameters['EmailId'] = model_1.ObjectSerializer.serialize(emailId, "string");
}
if (zOrder !== undefined) {
localVarQueryParameters['ZOrder'] = model_1.ObjectSerializer.serialize(zOrder, "number");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(accessCodeDetails, model_1.AccessCodeDetails);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(accessCodeDetails, "AccessCodeDetails");
}
let localVarRequestOptions = {
method: 'PATCH',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response);
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
changeRecipient(documentId_1, changeRecipient_1) {
return __awaiter(this, arguments, void 0, function* (documentId, changeRecipient, options = { headers: {} }) {
changeRecipient = deserializeIfNeeded(changeRecipient, "ChangeRecipient");
const localVarPath = this.basePath + '/v1/document/changeRecipient';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
if (documentId === null || documentId === undefined) {
throw new Error('Required parameter documentId was null or undefined when calling changeRecipient.');
}
if (changeRecipient === null || changeRecipient === undefined) {
throw new Error('Required parameter changeRecipient was null or undefined when calling changeRecipient.');
}
if (documentId !== undefined) {
localVarQueryParameters['documentId'] = model_1.ObjectSerializer.serialize(documentId, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(changeRecipient, model_1.ChangeRecipient);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(changeRecipient, "ChangeRecipient");
}
let localVarRequestOptions = {
method: 'PATCH',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response);
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
createEmbeddedRequestUrlDocument(embeddedDocumentRequest_1) {
return __awaiter(this, arguments, void 0, function* (embeddedDocumentRequest, options = { headers: {} }) {
embeddedDocumentRequest = deserializeIfNeeded(embeddedDocumentRequest, "EmbeddedDocumentRequest");
const localVarPath = this.basePath + '/v1/document/createEmbeddedRequestUrl';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(embeddedDocumentRequest, model_1.EmbeddedDocumentRequest);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(embeddedDocumentRequest, "EmbeddedDocumentRequest");
}
let localVarRequestOptions = {
method: 'POST',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response, "EmbeddedSendCreated");
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 201, "EmbeddedSendCreated")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 400, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 422, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
deleteDocument(documentId_1, deletePermanently_1) {
return __awaiter(this, arguments, void 0, function* (documentId, deletePermanently, options = { headers: {} }) {
const localVarPath = this.basePath + '/v1/document/delete';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
if (documentId === null || documentId === undefined) {
throw new Error('Required parameter documentId was null or undefined when calling deleteDocument.');
}
if (documentId !== undefined) {
localVarQueryParameters['documentId'] = model_1.ObjectSerializer.serialize(documentId, "string");
}
if (deletePermanently !== undefined) {
localVarQueryParameters['deletePermanently'] = model_1.ObjectSerializer.serialize(deletePermanently, "boolean");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(localVarFormParams);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
let localVarRequestOptions = {
method: 'DELETE',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].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(() => {
return new Promise((resolve, reject) => {
axios_1.default.request(localVarRequestOptions)
.then((response) => {
handleSuccessfulResponse(resolve, reject, response);
}, (error) => {
if (error.response == null) {
reject(error);
return;
}
if (handleErrorCodeResponse(reject, error.response, 401, "ErrorResult")) {
return;
}
if (handleErrorCodeResponse(reject, error.response, 403, "ErrorResult")) {
return;
}
reject(error);
});
});
});
});
}
deleteTag(documentTags_1) {
return __awaiter(this, arguments, void 0, function* (documentTags, options = { headers: {} }) {
documentTags = deserializeIfNeeded(documentTags, "DocumentTags");
const localVarPath = this.basePath + '/v1/document/deleteTags';
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams['content-type'] = 'application/json';
}
else {
localVarHeaderParams['content-type'] = produces.join(',');
}
let localVarFormParams = {};
let localVarBodyParams = undefined;
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
const result = (0, _1.generateFormData)(documentTags, model_1.DocumentTags);
localVarUseFormData = result.localVarUseFormData;
let data = {};
if (localVarUseFormData) {
const formData = (0, _1.toFormData)(result.data);
data = formData;
localVarHeaderParams = Object.assign(Object.assign({}, localVarHeaderParams), formData.getHeaders());
}
else {
data = model_1.ObjectSerializer.serialize(documentTags, "DocumentTags");
}
let localVarRequestOptions = {
method: 'DELETE',
params: localVarQueryParameters,
headers: localVarHeaderParams,
url: localVarPath,
paramsSerializer: this._useQuerystring ? _1.queryParamsSerializer : undefined,
maxContentLength: Infinity,
maxBodyLength: Infinity,
responseType: "json",
};
if (localVarRequestOptions.method !== 'GET') {
localVarRequestOptions.data = data;
}
let authenticationPromise = Promise.resolve();
if (this.authentications["X-API-KEY"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
}
if (this.authentications["Bearer"].apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVar