@hubspot/api-client
Version:
NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files
701 lines • 58.8 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.TablesApiResponseProcessor = exports.TablesApiRequestFactory = void 0;
const baseapi_1 = require("./baseapi");
const http_1 = require("../http/http");
const form_data_1 = __importDefault(require("form-data"));
const url_1 = require("url");
const ObjectSerializer_1 = require("../models/ObjectSerializer");
const exception_1 = require("./exception");
const util_1 = require("../util");
class TablesApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
archiveTable(tableIdOrName, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "archiveTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
cloneDraftTable(tableIdOrName, hubDbTableCloneRequest, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "cloneDraftTable", "tableIdOrName");
}
if (hubDbTableCloneRequest === null || hubDbTableCloneRequest === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "cloneDraftTable", "hubDbTableCloneRequest");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/clone'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(hubDbTableCloneRequest, "HubDbTableCloneRequest", ""), contentType);
requestContext.setBody(serializedBody);
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
createTable(hubDbTableV3Request, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (hubDbTableV3Request === null || hubDbTableV3Request === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "createTable", "hubDbTableV3Request");
}
const localVarPath = '/cms/v3/hubdb/tables';
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(hubDbTableV3Request, "HubDbTableV3Request", ""), contentType);
requestContext.setBody(serializedBody);
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
exportDraftTable(tableIdOrName, format, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "exportDraftTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/export'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (format !== undefined) {
requestContext.setQueryParam("format", ObjectSerializer_1.ObjectSerializer.serialize(format, "string", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
exportTable(tableIdOrName, format, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "exportTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/export'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (format !== undefined) {
requestContext.setQueryParam("format", ObjectSerializer_1.ObjectSerializer.serialize(format, "string", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
getAllDraftTables(sort, after, limit, createdAt, createdAfter, createdBefore, updatedAt, updatedAfter, updatedBefore, contentType, archived, isGetLocalizedSchema, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
const localVarPath = '/cms/v3/hubdb/tables/draft';
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (sort !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(sort, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("sort", serializedParam);
}
}
if (after !== undefined) {
requestContext.setQueryParam("after", ObjectSerializer_1.ObjectSerializer.serialize(after, "string", ""));
}
if (limit !== undefined) {
requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", "int32"));
}
if (createdAt !== undefined) {
requestContext.setQueryParam("createdAt", ObjectSerializer_1.ObjectSerializer.serialize(createdAt, "Date", "date-time"));
}
if (createdAfter !== undefined) {
requestContext.setQueryParam("createdAfter", ObjectSerializer_1.ObjectSerializer.serialize(createdAfter, "Date", "date-time"));
}
if (createdBefore !== undefined) {
requestContext.setQueryParam("createdBefore", ObjectSerializer_1.ObjectSerializer.serialize(createdBefore, "Date", "date-time"));
}
if (updatedAt !== undefined) {
requestContext.setQueryParam("updatedAt", ObjectSerializer_1.ObjectSerializer.serialize(updatedAt, "Date", "date-time"));
}
if (updatedAfter !== undefined) {
requestContext.setQueryParam("updatedAfter", ObjectSerializer_1.ObjectSerializer.serialize(updatedAfter, "Date", "date-time"));
}
if (updatedBefore !== undefined) {
requestContext.setQueryParam("updatedBefore", ObjectSerializer_1.ObjectSerializer.serialize(updatedBefore, "Date", "date-time"));
}
if (contentType !== undefined) {
requestContext.setQueryParam("contentType", ObjectSerializer_1.ObjectSerializer.serialize(contentType, "string", ""));
}
if (archived !== undefined) {
requestContext.setQueryParam("archived", ObjectSerializer_1.ObjectSerializer.serialize(archived, "boolean", ""));
}
if (isGetLocalizedSchema !== undefined) {
requestContext.setQueryParam("isGetLocalizedSchema", ObjectSerializer_1.ObjectSerializer.serialize(isGetLocalizedSchema, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
getAllTables(sort, after, limit, createdAt, createdAfter, createdBefore, updatedAt, updatedAfter, updatedBefore, contentType, archived, isGetLocalizedSchema, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
const localVarPath = '/cms/v3/hubdb/tables';
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (sort !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(sort, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("sort", serializedParam);
}
}
if (after !== undefined) {
requestContext.setQueryParam("after", ObjectSerializer_1.ObjectSerializer.serialize(after, "string", ""));
}
if (limit !== undefined) {
requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", "int32"));
}
if (createdAt !== undefined) {
requestContext.setQueryParam("createdAt", ObjectSerializer_1.ObjectSerializer.serialize(createdAt, "Date", "date-time"));
}
if (createdAfter !== undefined) {
requestContext.setQueryParam("createdAfter", ObjectSerializer_1.ObjectSerializer.serialize(createdAfter, "Date", "date-time"));
}
if (createdBefore !== undefined) {
requestContext.setQueryParam("createdBefore", ObjectSerializer_1.ObjectSerializer.serialize(createdBefore, "Date", "date-time"));
}
if (updatedAt !== undefined) {
requestContext.setQueryParam("updatedAt", ObjectSerializer_1.ObjectSerializer.serialize(updatedAt, "Date", "date-time"));
}
if (updatedAfter !== undefined) {
requestContext.setQueryParam("updatedAfter", ObjectSerializer_1.ObjectSerializer.serialize(updatedAfter, "Date", "date-time"));
}
if (updatedBefore !== undefined) {
requestContext.setQueryParam("updatedBefore", ObjectSerializer_1.ObjectSerializer.serialize(updatedBefore, "Date", "date-time"));
}
if (contentType !== undefined) {
requestContext.setQueryParam("contentType", ObjectSerializer_1.ObjectSerializer.serialize(contentType, "string", ""));
}
if (archived !== undefined) {
requestContext.setQueryParam("archived", ObjectSerializer_1.ObjectSerializer.serialize(archived, "boolean", ""));
}
if (isGetLocalizedSchema !== undefined) {
requestContext.setQueryParam("isGetLocalizedSchema", ObjectSerializer_1.ObjectSerializer.serialize(isGetLocalizedSchema, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
getDraftTableDetailsById(tableIdOrName, isGetLocalizedSchema, archived, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "getDraftTableDetailsById", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (archived !== undefined) {
requestContext.setQueryParam("archived", ObjectSerializer_1.ObjectSerializer.serialize(archived, "boolean", ""));
}
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
if (isGetLocalizedSchema !== undefined) {
requestContext.setQueryParam("isGetLocalizedSchema", ObjectSerializer_1.ObjectSerializer.serialize(isGetLocalizedSchema, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
getTableDetails(tableIdOrName, isGetLocalizedSchema, archived, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "getTableDetails", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (archived !== undefined) {
requestContext.setQueryParam("archived", ObjectSerializer_1.ObjectSerializer.serialize(archived, "boolean", ""));
}
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
if (isGetLocalizedSchema !== undefined) {
requestContext.setQueryParam("isGetLocalizedSchema", ObjectSerializer_1.ObjectSerializer.serialize(isGetLocalizedSchema, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
importDraftTable(tableIdOrName, config, file, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "importDraftTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/import'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
const useForm = (0, util_1.canConsumeForm)([
'multipart/form-data',
]);
let localVarFormParams;
if (useForm) {
localVarFormParams = new form_data_1.default();
}
else {
localVarFormParams = new url_1.URLSearchParams();
}
if (config !== undefined) {
localVarFormParams.append('config', config);
}
if (file !== undefined) {
if (localVarFormParams instanceof form_data_1.default) {
localVarFormParams.append('file', file.data, file.name);
}
}
requestContext.setBody(localVarFormParams);
if (!useForm) {
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"multipart/form-data"
]);
requestContext.setHeaderParam("Content-Type", contentType);
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
publishDraftTable(tableIdOrName, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "publishDraftTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/publish'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
removeTableVersion(tableIdOrName, versionId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "removeTableVersion", "tableIdOrName");
}
if (versionId === null || versionId === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "removeTableVersion", "versionId");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/versions/{versionId}'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)))
.replace('{' + 'versionId' + '}', encodeURIComponent(String(versionId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
resetDraftTable(tableIdOrName, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "resetDraftTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft/reset'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
unpublishTable(tableIdOrName, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "unpublishTable", "tableIdOrName");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/unpublish'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
updateDraftTable(tableIdOrName, hubDbTableV3Request, isGetLocalizedSchema, archived, includeForeignIds, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (tableIdOrName === null || tableIdOrName === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "updateDraftTable", "tableIdOrName");
}
if (hubDbTableV3Request === null || hubDbTableV3Request === undefined) {
throw new baseapi_1.RequiredError("TablesApi", "updateDraftTable", "hubDbTableV3Request");
}
const localVarPath = '/cms/v3/hubdb/tables/{tableIdOrName}/draft'
.replace('{' + 'tableIdOrName' + '}', encodeURIComponent(String(tableIdOrName)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (archived !== undefined) {
requestContext.setQueryParam("archived", ObjectSerializer_1.ObjectSerializer.serialize(archived, "boolean", ""));
}
if (includeForeignIds !== undefined) {
requestContext.setQueryParam("includeForeignIds", ObjectSerializer_1.ObjectSerializer.serialize(includeForeignIds, "boolean", ""));
}
if (isGetLocalizedSchema !== undefined) {
requestContext.setQueryParam("isGetLocalizedSchema", ObjectSerializer_1.ObjectSerializer.serialize(isGetLocalizedSchema, "boolean", ""));
}
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(hubDbTableV3Request, "HubDbTableV3Request", ""), contentType);
requestContext.setBody(serializedBody);
let authMethod;
authMethod = _config.authMethods["oauth2"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = (_a = _config === null || _config === void 0 ? void 0 : _config.authMethods) === null || _a === void 0 ? void 0 : _a.default;
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
}
exports.TablesApiRequestFactory = TablesApiRequestFactory;
class TablesApiResponseProcessor {
archiveTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("204", response.httpStatusCode)) {
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, undefined);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "void", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
cloneDraftTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
createTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("201", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
exportDraftTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = yield response.getBodyAsFile();
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "binary");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HttpFile", "binary");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
exportTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = yield response.getBodyAsFile();
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "binary");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HttpFile", "binary");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
getAllDraftTablesWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CollectionResponseWithTotalHubDbTableV3ForwardPaging", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CollectionResponseWithTotalHubDbTableV3ForwardPaging", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
getAllTablesWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CollectionResponseWithTotalHubDbTableV3ForwardPaging", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CollectionResponseWithTotalHubDbTableV3ForwardPaging", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
getDraftTableDetailsByIdWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
getTableDetailsWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if ((0, util_1.isCodeInRange)("0", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "An error occurred.", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "HubDbTableV3", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
importDraftTableWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if ((0, util_1.isCodeInRange)("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerial