@datadog/datadog-api-client
Version:
OpenAPI client for Datadog APIs
920 lines • 96.3 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.TeamsApi = exports.TeamsApiResponseProcessor = exports.TeamsApiRequestFactory = 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 TeamsApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
addMemberTeam(superTeamId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'addMemberTeam'");
if (!_config.unstableOperations["v2.addMemberTeam"]) {
throw new Error("Unstable operation 'addMemberTeam' is disabled");
}
// verify required parameter 'superTeamId' is not null or undefined
if (superTeamId === null || superTeamId === undefined) {
throw new baseapi_1.RequiredError("superTeamId", "addMemberTeam");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "addMemberTeam");
}
// Path Params
const localVarPath = "/api/v2/team/{super_team_id}/member_teams".replace("{super_team_id}", encodeURIComponent(String(superTeamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.addMemberTeam")
.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "*/*");
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, "AddMemberTeamRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createTeam(body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createTeam");
}
// Path Params
const localVarPath = "/api/v2/team";
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.createTeam")
.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, "TeamCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createTeamLink(teamId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "createTeamLink");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createTeamLink");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/links".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.createTeamLink")
.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, "TeamLinkCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
createTeamMembership(teamId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "createTeamMembership");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "createTeamMembership");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/memberships".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.createTeamMembership")
.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, "UserTeamRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
deleteTeam(teamId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "deleteTeam");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.deleteTeam")
.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;
});
}
deleteTeamLink(teamId, linkId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "deleteTeamLink");
}
// verify required parameter 'linkId' is not null or undefined
if (linkId === null || linkId === undefined) {
throw new baseapi_1.RequiredError("linkId", "deleteTeamLink");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/links/{link_id}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{link_id}", encodeURIComponent(String(linkId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.deleteTeamLink")
.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;
});
}
deleteTeamMembership(teamId, userId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "deleteTeamMembership");
}
// verify required parameter 'userId' is not null or undefined
if (userId === null || userId === undefined) {
throw new baseapi_1.RequiredError("userId", "deleteTeamMembership");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/memberships/{user_id}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{user_id}", encodeURIComponent(String(userId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.deleteTeamMembership")
.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;
});
}
getTeam(teamId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "getTeam");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getTeam")
.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;
});
}
getTeamLink(teamId, linkId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "getTeamLink");
}
// verify required parameter 'linkId' is not null or undefined
if (linkId === null || linkId === undefined) {
throw new baseapi_1.RequiredError("linkId", "getTeamLink");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/links/{link_id}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{link_id}", encodeURIComponent(String(linkId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getTeamLink")
.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;
});
}
getTeamLinks(teamId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "getTeamLinks");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/links".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getTeamLinks")
.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;
});
}
getTeamMemberships(teamId, pageSize, pageNumber, sort, filterKeyword, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "getTeamMemberships");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/memberships".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getTeamMemberships")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (pageSize !== undefined) {
requestContext.setQueryParam("page[size]", ObjectSerializer_1.ObjectSerializer.serialize(pageSize, "number", "int64"), "");
}
if (pageNumber !== undefined) {
requestContext.setQueryParam("page[number]", ObjectSerializer_1.ObjectSerializer.serialize(pageNumber, "number", "int64"), "");
}
if (sort !== undefined) {
requestContext.setQueryParam("sort", ObjectSerializer_1.ObjectSerializer.serialize(sort, "GetTeamMembershipsSort", ""), "");
}
if (filterKeyword !== undefined) {
requestContext.setQueryParam("filter[keyword]", ObjectSerializer_1.ObjectSerializer.serialize(filterKeyword, "string", ""), "");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
getTeamPermissionSettings(teamId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "getTeamPermissionSettings");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/permission-settings".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getTeamPermissionSettings")
.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;
});
}
getUserMemberships(userUuid, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'userUuid' is not null or undefined
if (userUuid === null || userUuid === undefined) {
throw new baseapi_1.RequiredError("userUuid", "getUserMemberships");
}
// Path Params
const localVarPath = "/api/v2/users/{user_uuid}/memberships".replace("{user_uuid}", encodeURIComponent(String(userUuid)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.getUserMemberships")
.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;
});
}
listMemberTeams(superTeamId, pageSize, pageNumber, fieldsTeam, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'listMemberTeams'");
if (!_config.unstableOperations["v2.listMemberTeams"]) {
throw new Error("Unstable operation 'listMemberTeams' is disabled");
}
// verify required parameter 'superTeamId' is not null or undefined
if (superTeamId === null || superTeamId === undefined) {
throw new baseapi_1.RequiredError("superTeamId", "listMemberTeams");
}
// Path Params
const localVarPath = "/api/v2/team/{super_team_id}/member_teams".replace("{super_team_id}", encodeURIComponent(String(superTeamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.listMemberTeams")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (pageSize !== undefined) {
requestContext.setQueryParam("page[size]", ObjectSerializer_1.ObjectSerializer.serialize(pageSize, "number", "int64"), "");
}
if (pageNumber !== undefined) {
requestContext.setQueryParam("page[number]", ObjectSerializer_1.ObjectSerializer.serialize(pageNumber, "number", "int64"), "");
}
if (fieldsTeam !== undefined) {
requestContext.setQueryParam("fields[team]", ObjectSerializer_1.ObjectSerializer.serialize(fieldsTeam, "Array<TeamsField>", ""), "csv");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
listTeams(pageNumber, pageSize, sort, include, filterKeyword, filterMe, fieldsTeam, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// Path Params
const localVarPath = "/api/v2/team";
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.listTeams")
.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json");
requestContext.setHttpConfig(_config.httpConfig);
// Query Params
if (pageNumber !== undefined) {
requestContext.setQueryParam("page[number]", ObjectSerializer_1.ObjectSerializer.serialize(pageNumber, "number", "int64"), "");
}
if (pageSize !== undefined) {
requestContext.setQueryParam("page[size]", ObjectSerializer_1.ObjectSerializer.serialize(pageSize, "number", "int64"), "");
}
if (sort !== undefined) {
requestContext.setQueryParam("sort", ObjectSerializer_1.ObjectSerializer.serialize(sort, "ListTeamsSort", ""), "");
}
if (include !== undefined) {
requestContext.setQueryParam("include", ObjectSerializer_1.ObjectSerializer.serialize(include, "Array<ListTeamsInclude>", ""), "multi");
}
if (filterKeyword !== undefined) {
requestContext.setQueryParam("filter[keyword]", ObjectSerializer_1.ObjectSerializer.serialize(filterKeyword, "string", ""), "");
}
if (filterMe !== undefined) {
requestContext.setQueryParam("filter[me]", ObjectSerializer_1.ObjectSerializer.serialize(filterMe, "boolean", ""), "");
}
if (fieldsTeam !== undefined) {
requestContext.setQueryParam("fields[team]", ObjectSerializer_1.ObjectSerializer.serialize(fieldsTeam, "Array<TeamsField>", ""), "csv");
}
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
removeMemberTeam(superTeamId, memberTeamId, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
logger_1.logger.warn("Using unstable operation 'removeMemberTeam'");
if (!_config.unstableOperations["v2.removeMemberTeam"]) {
throw new Error("Unstable operation 'removeMemberTeam' is disabled");
}
// verify required parameter 'superTeamId' is not null or undefined
if (superTeamId === null || superTeamId === undefined) {
throw new baseapi_1.RequiredError("superTeamId", "removeMemberTeam");
}
// verify required parameter 'memberTeamId' is not null or undefined
if (memberTeamId === null || memberTeamId === undefined) {
throw new baseapi_1.RequiredError("memberTeamId", "removeMemberTeam");
}
// Path Params
const localVarPath = "/api/v2/team/{super_team_id}/member_teams/{member_team_id}"
.replace("{super_team_id}", encodeURIComponent(String(superTeamId)))
.replace("{member_team_id}", encodeURIComponent(String(memberTeamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.removeMemberTeam")
.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;
});
}
updateTeam(teamId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "updateTeam");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateTeam");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}".replace("{team_id}", encodeURIComponent(String(teamId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.updateTeam")
.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, "TeamUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateTeamLink(teamId, linkId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "updateTeamLink");
}
// verify required parameter 'linkId' is not null or undefined
if (linkId === null || linkId === undefined) {
throw new baseapi_1.RequiredError("linkId", "updateTeamLink");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateTeamLink");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/links/{link_id}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{link_id}", encodeURIComponent(String(linkId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.updateTeamLink")
.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, "TeamLinkCreateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateTeamMembership(teamId, userId, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "updateTeamMembership");
}
// verify required parameter 'userId' is not null or undefined
if (userId === null || userId === undefined) {
throw new baseapi_1.RequiredError("userId", "updateTeamMembership");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateTeamMembership");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/memberships/{user_id}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{user_id}", encodeURIComponent(String(userId)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.updateTeamMembership")
.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, "UserTeamUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
updateTeamPermissionSetting(teamId, action, body, _options) {
return __awaiter(this, void 0, void 0, function* () {
const _config = _options || this.configuration;
// verify required parameter 'teamId' is not null or undefined
if (teamId === null || teamId === undefined) {
throw new baseapi_1.RequiredError("teamId", "updateTeamPermissionSetting");
}
// verify required parameter 'action' is not null or undefined
if (action === null || action === undefined) {
throw new baseapi_1.RequiredError("action", "updateTeamPermissionSetting");
}
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new baseapi_1.RequiredError("body", "updateTeamPermissionSetting");
}
// Path Params
const localVarPath = "/api/v2/team/{team_id}/permission-settings/{action}"
.replace("{team_id}", encodeURIComponent(String(teamId)))
.replace("{action}", encodeURIComponent(String(action)));
// Make Request Context
const requestContext = _config
.getServer("v2.TeamsApi.updateTeamPermissionSetting")
.makeRequestContext(localVarPath, http_1.HttpMethod.PUT);
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, "TeamPermissionSettingUpdateRequest", ""), contentType);
requestContext.setBody(serializedBody);
// Apply auth methods
(0, configuration_1.applySecurityAuthentication)(_config, requestContext, [
"AuthZ",
"apiKeyAuth",
"appKeyAuth",
]);
return requestContext;
});
}
}
exports.TeamsApiRequestFactory = TeamsApiRequestFactory;
class TeamsApiResponseProcessor {
/**
* 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 addMemberTeam
* @throws ApiException if the response code was not in [200, 299]
*/
addMemberTeam(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 204) {
return;
}
if (response.httpStatusCode === 403 ||
response.httpStatusCode === 409 ||
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), "void", "");
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 createTeam
* @throws ApiException if the response code was not in [200, 299]
*/
createTeam(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), "TeamResponse");
return body;
}
if (response.httpStatusCode === 403 ||
response.httpStatusCode === 409 ||
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), "TeamResponse", "");
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 createTeamLink
* @throws ApiException if the response code was not in [200, 299]
*/
createTeamLink(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "TeamLinkResponse");
return body;
}
if (response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 422 ||
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), "TeamLinkResponse", "");
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 createTeamMembership
* @throws ApiException if the response code was not in [200, 299]
*/
createTeamMembership(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 200) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "UserTeamResponse");
return body;
}
if (response.httpStatusCode === 403 ||
response.httpStatusCode === 404 ||
response.httpStatusCode === 409 ||
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), "UserTeamResponse", "");
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 deleteTeam
* @throws ApiException if the response code was not in [200, 299]
*/
deleteTeam(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 204) {
return;
}
if (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), "void", "");
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 deleteTeamLink
* @throws ApiException if the response code was not in [200, 299]
*/
deleteTeamLink(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (response.httpStatusCode === 204) {
return;
}
if (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), "void", "");
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 deleteTeamMembership
* @throws ApiExcepti