@hubspot/api-client
Version:
NodeJS v3 [HubSpot API](https://developers.hubspot.com/docs/api/overview) SDK(Client) files
677 lines • 55.1 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasicApiResponseProcessor = exports.BasicApiRequestFactory = void 0;
const baseapi_1 = require("./baseapi");
const http_1 = require("../http/http");
const ObjectSerializer_1 = require("../models/ObjectSerializer");
const exception_1 = require("./exception");
const util_1 = require("../util");
class BasicApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
archive(objectType, pipelineId, validateDealStageUsagesBeforeDelete, validateReferencesBeforeDelete, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "archive", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "archive", "pipelineId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (validateDealStageUsagesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateDealStageUsagesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateDealStageUsagesBeforeDelete, "boolean", ""));
}
if (validateReferencesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateReferencesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateReferencesBeforeDelete, "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;
});
}
archive_1(objectType, pipelineId, stageId, validateReferencesBeforeDelete, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "archive_1", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "archive_1", "pipelineId");
}
if (stageId === null || stageId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "archive_1", "stageId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)))
.replace('{' + 'stageId' + '}', encodeURIComponent(String(stageId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (validateReferencesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateReferencesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateReferencesBeforeDelete, "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;
});
}
create(objectType, pipelineInput, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "create", "objectType");
}
if (pipelineInput === null || pipelineInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "create", "pipelineInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)));
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(pipelineInput, "PipelineInput", ""), 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;
});
}
create_2(objectType, pipelineId, pipelineStageInput, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "create_2", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "create_2", "pipelineId");
}
if (pipelineStageInput === null || pipelineStageInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "create_2", "pipelineStageInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
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(pipelineStageInput, "PipelineStageInput", ""), 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;
});
}
getAll(objectType, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAll", "objectType");
}
const localVarPath = '/crm/v3/pipelines/{objectType}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
getAll_3(objectType, pipelineId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAll_3", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAll_3", "pipelineId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
getAudit(objectType, pipelineId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAudit", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAudit", "pipelineId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/audit'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
getAudit_4(objectType, pipelineId, stageId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAudit_4", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAudit_4", "pipelineId");
}
if (stageId === null || stageId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getAudit_4", "stageId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}/audit'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)))
.replace('{' + 'stageId' + '}', encodeURIComponent(String(stageId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
getById(objectType, pipelineId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getById", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getById", "pipelineId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
getById_5(objectType, pipelineId, stageId, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getById_5", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getById_5", "pipelineId");
}
if (stageId === null || stageId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "getById_5", "stageId");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)))
.replace('{' + 'stageId' + '}', encodeURIComponent(String(stageId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
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;
});
}
replace(objectType, pipelineId, pipelineReplaceInput, validateDealStageUsagesBeforeDelete, validateReferencesBeforeDelete, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace", "pipelineId");
}
if (pipelineReplaceInput === null || pipelineReplaceInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace", "pipelineReplaceInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (validateDealStageUsagesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateDealStageUsagesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateDealStageUsagesBeforeDelete, "boolean", ""));
}
if (validateReferencesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateReferencesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateReferencesBeforeDelete, "boolean", ""));
}
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(pipelineReplaceInput, "PipelineReplaceInput", ""), 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;
});
}
replace_6(objectType, pipelineId, stageId, pipelineStageReplaceInput, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace_6", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace_6", "pipelineId");
}
if (stageId === null || stageId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace_6", "stageId");
}
if (pipelineStageReplaceInput === null || pipelineStageReplaceInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "replace_6", "pipelineStageReplaceInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)))
.replace('{' + 'stageId' + '}', encodeURIComponent(String(stageId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
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(pipelineStageReplaceInput, "PipelineStageReplaceInput", ""), 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;
});
}
update(objectType, pipelineId, pipelinePatchInput, validateDealStageUsagesBeforeDelete, validateReferencesBeforeDelete, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update", "pipelineId");
}
if (pipelinePatchInput === null || pipelinePatchInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update", "pipelinePatchInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (validateDealStageUsagesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateDealStageUsagesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateDealStageUsagesBeforeDelete, "boolean", ""));
}
if (validateReferencesBeforeDelete !== undefined) {
requestContext.setQueryParam("validateReferencesBeforeDelete", ObjectSerializer_1.ObjectSerializer.serialize(validateReferencesBeforeDelete, "boolean", ""));
}
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(pipelinePatchInput, "PipelinePatchInput", ""), 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;
});
}
update_7(objectType, pipelineId, stageId, pipelineStagePatchInput, _options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (objectType === null || objectType === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update_7", "objectType");
}
if (pipelineId === null || pipelineId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update_7", "pipelineId");
}
if (stageId === null || stageId === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update_7", "stageId");
}
if (pipelineStagePatchInput === null || pipelineStagePatchInput === undefined) {
throw new baseapi_1.RequiredError("BasicApi", "update_7", "pipelineStagePatchInput");
}
const localVarPath = '/crm/v3/pipelines/{objectType}/{pipelineId}/stages/{stageId}'
.replace('{' + 'objectType' + '}', encodeURIComponent(String(objectType)))
.replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)))
.replace('{' + 'stageId' + '}', encodeURIComponent(String(stageId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
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(pipelineStagePatchInput, "PipelineStagePatchInput", ""), 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.BasicApiRequestFactory = BasicApiRequestFactory;
class BasicApiResponseProcessor {
archiveWithHttpInfo(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);
});
}
archive_1WithHttpInfo(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);
});
}
createWithHttpInfo(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), "Pipeline", "");
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), "Pipeline", "");
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);
});
}
create_2WithHttpInfo(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), "PipelineStage", "");
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), "PipelineStage", "");
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);
});
}
getAllWithHttpInfo(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), "CollectionResponsePipelineNoPaging", "");
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), "CollectionResponsePipelineNoPaging", "");
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);
});
}
getAll_3WithHttpInfo(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), "CollectionResponsePipelineStageNoPaging", "");
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), "CollectionResponsePipelineStageNoPaging", "");
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);
});
}
getAuditWithHttpInfo(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), "CollectionResponsePublicAuditInfoNoPaging", "");
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), "CollectionResponsePublicAuditInfoNoPaging", "");
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);
});
}
getAudit_4WithHttpInfo(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), "CollectionResponsePublicAuditInfoNoPaging", "");
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), "CollectionResponsePublicAuditInfoNoPaging", "");
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);
});
}
getByIdWithHttpInfo(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), "Pipeline", "");
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), "Pipeline", "");
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);
});
}
getById_5WithHttpInfo(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), "PipelineStage", "");
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), "PipelineStage", "");
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);
});
}
replaceWithHttpInfo(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), "Pipeline", "");
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.