@datadog/datadog-api-client
Version:
OpenAPI client for Datadog APIs
893 lines • 117 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 __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IncidentsApi = exports.IncidentsApiResponseProcessor = exports.IncidentsApiRequestFactory = void 0;
const baseapi_1 = require("../../datadog-api-client-common/baseapi");
const configuration_1 = require("../../datadog-api-client-common/configuration");
const http_1 = require("../../datadog-api-client-common/http/http");
const logger_1 = require("../../../logger");
const ObjectSerializer_1 = require("../models/ObjectSerializer");
const exception_1 = require("../../datadog-api-client-common/exception");
class IncidentsApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
createIncident(body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createIncident'");
if (!_config.unstableOperations["v2.createIncident"]) {
throw new Error("Unstable operation 'createIncident' is disabled");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createIncident");
}
// Path Params
const localVarPath = "/api/v2/incidents";
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.createIncident")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createIncidentIntegration(incidentId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createIncidentIntegration'");
if (!_config.unstableOperations["v2.createIncidentIntegration"]) {
throw new Error("Unstable operation 'createIncidentIntegration' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "createIncidentIntegration");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createIncidentIntegration");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/integrations".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.createIncidentIntegration")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentIntegrationMetadataCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createIncidentTodo(incidentId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createIncidentTodo'");
if (!_config.unstableOperations["v2.createIncidentTodo"]) {
throw new Error("Unstable operation 'createIncidentTodo' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "createIncidentTodo");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createIncidentTodo");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/todos".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.createIncidentTodo")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentTodoCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createIncidentType(body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'createIncidentType'");
if (!_config.unstableOperations["v2.createIncidentType"]) {
throw new Error("Unstable operation 'createIncidentType' is disabled");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createIncidentType");
}
// Path Params
const localVarPath = "/api/v2/incidents/config/types";
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.createIncidentType")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentTypeCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteIncident(incidentId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'deleteIncident'");
if (!_config.unstableOperations["v2.deleteIncident"]) {
throw new Error("Unstable operation 'deleteIncident' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "deleteIncident");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.deleteIncident")
.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "*/*");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteIncidentIntegration(incidentId, integrationMetadataId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'deleteIncidentIntegration'");
if (!_config.unstableOperations["v2.deleteIncidentIntegration"]) {
throw new Error("Unstable operation 'deleteIncidentIntegration' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "deleteIncidentIntegration");
}
// verify required parameter 'integrationMetadataId' is not null or undefined
if (integrationMetadataId === null || integrationMetadataId === undefined) {
throw new baseapi_1.RequiredError("integrationMetadataId", "deleteIncidentIntegration");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{integration_metadata_id}", encodeURIComponent(String(integrationMetadataId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.deleteIncidentIntegration")
.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "*/*");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteIncidentTodo(incidentId, todoId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'deleteIncidentTodo'");
if (!_config.unstableOperations["v2.deleteIncidentTodo"]) {
throw new Error("Unstable operation 'deleteIncidentTodo' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "deleteIncidentTodo");
}
// verify required parameter 'todoId' is not null or undefined
if (todoId === null || todoId === undefined) {
throw new baseapi_1.RequiredError("todoId", "deleteIncidentTodo");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{todo_id}", encodeURIComponent(String(todoId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.deleteIncidentTodo")
.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "*/*");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteIncidentType(incidentTypeId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'deleteIncidentType'");
if (!_config.unstableOperations["v2.deleteIncidentType"]) {
throw new Error("Unstable operation 'deleteIncidentType' is disabled");
}
// verify required parameter 'incidentTypeId' is not null or undefined
if (incidentTypeId === null || incidentTypeId === undefined) {
throw new baseapi_1.RequiredError("incidentTypeId", "deleteIncidentType");
}
// Path Params
const localVarPath = "/api/v2/incidents/config/types/{incident_type_id}".replace("{incident_type_id}", encodeURIComponent(String(incidentTypeId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.deleteIncidentType")
.makeRequestContext(localVarPath, http_1.HttpMethod.DELETE);
requestContext.setHeaderParam("Accept", "*/*");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getIncident(incidentId, include, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'getIncident'");
if (!_config.unstableOperations["v2.getIncident"]) {
throw new Error("Unstable operation 'getIncident' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "getIncident");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.getIncident")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<IncidentRelatedObject>", ""), "csv");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getIncidentIntegration(incidentId, integrationMetadataId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'getIncidentIntegration'");
if (!_config.unstableOperations["v2.getIncidentIntegration"]) {
throw new Error("Unstable operation 'getIncidentIntegration' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "getIncidentIntegration");
}
// verify required parameter 'integrationMetadataId' is not null or undefined
if (integrationMetadataId === null || integrationMetadataId === undefined) {
throw new baseapi_1.RequiredError("integrationMetadataId", "getIncidentIntegration");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{integration_metadata_id}", encodeURIComponent(String(integrationMetadataId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.getIncidentIntegration")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getIncidentTodo(incidentId, todoId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'getIncidentTodo'");
if (!_config.unstableOperations["v2.getIncidentTodo"]) {
throw new Error("Unstable operation 'getIncidentTodo' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "getIncidentTodo");
}
// verify required parameter 'todoId' is not null or undefined
if (todoId === null || todoId === undefined) {
throw new baseapi_1.RequiredError("todoId", "getIncidentTodo");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{todo_id}", encodeURIComponent(String(todoId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.getIncidentTodo")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getIncidentType(incidentTypeId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'getIncidentType'");
if (!_config.unstableOperations["v2.getIncidentType"]) {
throw new Error("Unstable operation 'getIncidentType' is disabled");
}
// verify required parameter 'incidentTypeId' is not null or undefined
if (incidentTypeId === null || incidentTypeId === undefined) {
throw new baseapi_1.RequiredError("incidentTypeId", "getIncidentType");
}
// Path Params
const localVarPath = "/api/v2/incidents/config/types/{incident_type_id}".replace("{incident_type_id}", encodeURIComponent(String(incidentTypeId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.getIncidentType")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listIncidentAttachments(incidentId, include, filterAttachmentType, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listIncidentAttachments'");
if (!_config.unstableOperations["v2.listIncidentAttachments"]) {
throw new Error("Unstable operation 'listIncidentAttachments' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "listIncidentAttachments");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/attachments".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.listIncidentAttachments")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<IncidentAttachmentRelatedObject>", ""), "csv");
}
if (filterAttachmentType !== undefined) {
requestContext.setQueryParam("filter[attachment_type]", ObjectSerializer_1.ObjectSerializer.serialize(filterAttachmentType, "Array<IncidentAttachmentAttachmentType>", ""), "csv");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listIncidentIntegrations(incidentId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listIncidentIntegrations'");
if (!_config.unstableOperations["v2.listIncidentIntegrations"]) {
throw new Error("Unstable operation 'listIncidentIntegrations' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "listIncidentIntegrations");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/integrations".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.listIncidentIntegrations")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listIncidents(include, pageSize, pageOffset, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listIncidents'");
if (!_config.unstableOperations["v2.listIncidents"]) {
throw new Error("Unstable operation 'listIncidents' is disabled");
}
// Path Params
const localVarPath = "/api/v2/incidents";
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.listIncidents")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<IncidentRelatedObject>", ""), "csv");
}
if (pageSize !== undefined) {
requestContext.setQueryParam("page[size]", ObjectSerializer_1.ObjectSerializer.serialize(pageSize, "number", "int64"), "");
}
if (pageOffset !== undefined) {
requestContext.setQueryParam("page[offset]", ObjectSerializer_1.ObjectSerializer.serialize(pageOffset, "number", "int64"), "");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listIncidentTodos(incidentId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listIncidentTodos'");
if (!_config.unstableOperations["v2.listIncidentTodos"]) {
throw new Error("Unstable operation 'listIncidentTodos' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "listIncidentTodos");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/todos".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.listIncidentTodos")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listIncidentTypes(includeDeleted, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listIncidentTypes'");
if (!_config.unstableOperations["v2.listIncidentTypes"]) {
throw new Error("Unstable operation 'listIncidentTypes' is disabled");
}
// Path Params
const localVarPath = "/api/v2/incidents/config/types";
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.listIncidentTypes")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (includeDeleted !== undefined) {
requestContext.setQueryParam("include_deleted", ObjectSerializer_1.ObjectSerializer.serialize(includeDeleted, "boolean", ""), "");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
searchIncidents(query, include, sort, pageSize, pageOffset, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'searchIncidents'");
if (!_config.unstableOperations["v2.searchIncidents"]) {
throw new Error("Unstable operation 'searchIncidents' is disabled");
}
// verify required parameter 'query' is not null or undefined
if (query === null || query === undefined) {
throw new baseapi_1.RequiredError("query", "searchIncidents");
}
// Path Params
const localVarPath = "/api/v2/incidents/search";
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.searchIncidents")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "IncidentRelatedObject", ""), "");
}
if (query !== undefined) {
requestContext.setQueryParam("query", ObjectSerializer_1.ObjectSerializer.serialize(query, "string", ""), "");
}
if (sort !== undefined) {
requestContext.setQueryParam("sort", ObjectSerializer_1.ObjectSerializer.serialize(sort, "IncidentSearchSortOrder", ""), "");
}
if (pageSize !== undefined) {
requestContext.setQueryParam("page[size]", ObjectSerializer_1.ObjectSerializer.serialize(pageSize, "number", "int64"), "");
}
if (pageOffset !== undefined) {
requestContext.setQueryParam("page[offset]", ObjectSerializer_1.ObjectSerializer.serialize(pageOffset, "number", "int64"), "");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateIncident(incidentId, body, include, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateIncident'");
if (!_config.unstableOperations["v2.updateIncident"]) {
throw new Error("Unstable operation 'updateIncident' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "updateIncident");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateIncident");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.updateIncident")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<IncidentRelatedObject>", ""), "csv");
}
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateIncidentAttachments(incidentId, body, include, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateIncidentAttachments'");
if (!_config.unstableOperations["v2.updateIncidentAttachments"]) {
throw new Error("Unstable operation 'updateIncidentAttachments' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "updateIncidentAttachments");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateIncidentAttachments");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/attachments".replace("{incident_id}", encodeURIComponent(String(incidentId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.updateIncidentAttachments")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<IncidentAttachmentRelatedObject>", ""), "csv");
}
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentAttachmentUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateIncidentIntegration(incidentId, integrationMetadataId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateIncidentIntegration'");
if (!_config.unstableOperations["v2.updateIncidentIntegration"]) {
throw new Error("Unstable operation 'updateIncidentIntegration' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "updateIncidentIntegration");
}
// verify required parameter 'integrationMetadataId' is not null or undefined
if (integrationMetadataId === null || integrationMetadataId === undefined) {
throw new baseapi_1.RequiredError("integrationMetadataId", "updateIncidentIntegration");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateIncidentIntegration");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{integration_metadata_id}", encodeURIComponent(String(integrationMetadataId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.updateIncidentIntegration")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentIntegrationMetadataPatchRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateIncidentTodo(incidentId, todoId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateIncidentTodo'");
if (!_config.unstableOperations["v2.updateIncidentTodo"]) {
throw new Error("Unstable operation 'updateIncidentTodo' is disabled");
}
// verify required parameter 'incidentId' is not null or undefined
if (incidentId === null || incidentId === undefined) {
throw new baseapi_1.RequiredError("incidentId", "updateIncidentTodo");
}
// verify required parameter 'todoId' is not null or undefined
if (todoId === null || todoId === undefined) {
throw new baseapi_1.RequiredError("todoId", "updateIncidentTodo");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateIncidentTodo");
}
// Path Params
const localVarPath = "/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}"
.replace("{incident_id}", encodeURIComponent(String(incidentId)))
.replace("{todo_id}", encodeURIComponent(String(todoId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.updateIncidentTodo")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentTodoPatchRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateIncidentType(incidentTypeId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'updateIncidentType'");
if (!_config.unstableOperations["v2.updateIncidentType"]) {
throw new Error("Unstable operation 'updateIncidentType' is disabled");
}
// verify required parameter 'incidentTypeId' is not null or undefined
if (incidentTypeId === null || incidentTypeId === undefined) {
throw new baseapi_1.RequiredError("incidentTypeId", "updateIncidentType");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateIncidentType");
}
// Path Params
const localVarPath = "/api/v2/incidents/config/types/{incident_type_id}".replace("{incident_type_id}", encodeURIComponent(String(incidentTypeId)));
// Make Request Context
const requestContext = _config
.getServer("v2.IncidentsApi.updateIncidentType")
.makeRequestContext(localVarPath, http_1.HttpMethod.PATCH);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Body Params
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json",
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(body, "IncidentTypePatchRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
}
exports.IncidentsApiRequestFactory = IncidentsApiRequestFactory;
class IncidentsApiResponseProcessor {
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to createIncident
* @throws ApiException if the response code was not in [200, 299]
*/
createIncident(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 201) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "IncidentResponse");
return body;
}
if (response.httpStatusCode === 400 ||
response.httpStatusCode === 401 ||
response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 429) {
const bodyText = ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType);
let body;
try {
body = ObjectSerializer_1.ObjectSerializer.deserialize(bodyText, "APIErrorResponse");
}
catch (error) {
logger_1.logger.debug(`Got error deserializing error: ${error}`);
throw new exception_1.ApiException(response.httpStatusCode, bodyText);
}
throw new exception_1.ApiException(response.httpStatusCode, body);
}
// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "IncidentResponse", "");
return body;
}
const body = (yield response.body.text()) || "";
throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"');
});
}
/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to createIncidentIntegration
* @throws ApiException if the response code was not in [200, 299]
*/
createIncidentIntegration(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response