UNPKG

@datadog/datadog-api-client

Version:

OpenAPI client for Datadog APIs

863 lines 45.9 kB
"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.RumAudienceManagementApi = exports.RumAudienceManagementApiResponseProcessor = exports.RumAudienceManagementApiRequestFactory = 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 RumAudienceManagementApiRequestFactory extends baseapi_1.BaseAPIRequestFactory { createConnection(entity, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'createConnection'"); if (!_config.unstableOperations["v2.createConnection"]) { throw new Error("Unstable operation 'createConnection' is disabled"); } // verify required parameter 'entity' is not null or undefined if (entity === null || entity === undefined) { throw new baseapi_1.RequiredError("entity", "createConnection"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "createConnection"); } // Path Params const localVarPath = "/api/v2/product-analytics/{entity}/mapping/connection".replace("{entity}", encodeURIComponent(String(entity))); // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.createConnection") .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, "CreateConnectionRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } deleteConnection(id, entity, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'deleteConnection'"); if (!_config.unstableOperations["v2.deleteConnection"]) { throw new Error("Unstable operation 'deleteConnection' is disabled"); } // verify required parameter 'id' is not null or undefined if (id === null || id === undefined) { throw new baseapi_1.RequiredError("id", "deleteConnection"); } // verify required parameter 'entity' is not null or undefined if (entity === null || entity === undefined) { throw new baseapi_1.RequiredError("entity", "deleteConnection"); } // Path Params const localVarPath = "/api/v2/product-analytics/{entity}/mapping/connection/{id}" .replace("{id}", encodeURIComponent(String(id))) .replace("{entity}", encodeURIComponent(String(entity))); // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.deleteConnection") .makeRequestContext(localVarPath, http_1.HttpMethod.DELETE); requestContext.setHeaderParam("Accept", "*/*"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } getAccountFacetInfo(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'getAccountFacetInfo'"); if (!_config.unstableOperations["v2.getAccountFacetInfo"]) { throw new Error("Unstable operation 'getAccountFacetInfo' is disabled"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "getAccountFacetInfo"); } // Path Params const localVarPath = "/api/v2/product-analytics/accounts/facet_info"; // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.getAccountFacetInfo") .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, "FacetInfoRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } getMapping(entity, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'getMapping'"); if (!_config.unstableOperations["v2.getMapping"]) { throw new Error("Unstable operation 'getMapping' is disabled"); } // verify required parameter 'entity' is not null or undefined if (entity === null || entity === undefined) { throw new baseapi_1.RequiredError("entity", "getMapping"); } // Path Params const localVarPath = "/api/v2/product-analytics/{entity}/mapping".replace("{entity}", encodeURIComponent(String(entity))); // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.getMapping") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } getUserFacetInfo(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'getUserFacetInfo'"); if (!_config.unstableOperations["v2.getUserFacetInfo"]) { throw new Error("Unstable operation 'getUserFacetInfo' is disabled"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "getUserFacetInfo"); } // Path Params const localVarPath = "/api/v2/product-analytics/users/facet_info"; // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.getUserFacetInfo") .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, "FacetInfoRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } listConnections(entity, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'listConnections'"); if (!_config.unstableOperations["v2.listConnections"]) { throw new Error("Unstable operation 'listConnections' is disabled"); } // verify required parameter 'entity' is not null or undefined if (entity === null || entity === undefined) { throw new baseapi_1.RequiredError("entity", "listConnections"); } // Path Params const localVarPath = "/api/v2/product-analytics/{entity}/mapping/connections".replace("{entity}", encodeURIComponent(String(entity))); // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.listConnections") .makeRequestContext(localVarPath, http_1.HttpMethod.GET); requestContext.setHeaderParam("Accept", "application/json"); requestContext.setHttpConfig(_config.httpConfig); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } queryAccounts(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'queryAccounts'"); if (!_config.unstableOperations["v2.queryAccounts"]) { throw new Error("Unstable operation 'queryAccounts' is disabled"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "queryAccounts"); } // Path Params const localVarPath = "/api/v2/product-analytics/accounts/query"; // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.queryAccounts") .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, "QueryAccountRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } queryEventFilteredUsers(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'queryEventFilteredUsers'"); if (!_config.unstableOperations["v2.queryEventFilteredUsers"]) { throw new Error("Unstable operation 'queryEventFilteredUsers' is disabled"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "queryEventFilteredUsers"); } // Path Params const localVarPath = "/api/v2/product-analytics/users/event_filtered_query"; // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.queryEventFilteredUsers") .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, "QueryEventFilteredUsersRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } queryUsers(body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'queryUsers'"); if (!_config.unstableOperations["v2.queryUsers"]) { throw new Error("Unstable operation 'queryUsers' is disabled"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "queryUsers"); } // Path Params const localVarPath = "/api/v2/product-analytics/users/query"; // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.queryUsers") .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, "QueryUsersRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } updateConnection(entity, body, _options) { return __awaiter(this, void 0, void 0, function* () { const _config = _options || this.configuration; logger_1.logger.warn("Using unstable operation 'updateConnection'"); if (!_config.unstableOperations["v2.updateConnection"]) { throw new Error("Unstable operation 'updateConnection' is disabled"); } // verify required parameter 'entity' is not null or undefined if (entity === null || entity === undefined) { throw new baseapi_1.RequiredError("entity", "updateConnection"); } // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new baseapi_1.RequiredError("body", "updateConnection"); } // Path Params const localVarPath = "/api/v2/product-analytics/{entity}/mapping/connection".replace("{entity}", encodeURIComponent(String(entity))); // Make Request Context const requestContext = _config .getServer("v2.RumAudienceManagementApi.updateConnection") .makeRequestContext(localVarPath, http_1.HttpMethod.PUT); 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, "UpdateConnectionRequest", ""), contentType); requestContext.setBody(serializedBody); // Apply auth methods (0, configuration_1.applySecurityAuthentication)(_config, requestContext, [ "apiKeyAuth", "appKeyAuth", "AuthZ", ]); return requestContext; }); } } exports.RumAudienceManagementApiRequestFactory = RumAudienceManagementApiRequestFactory; class RumAudienceManagementApiResponseProcessor { /** * 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 createConnection * @throws ApiException if the response code was not in [200, 299] */ createConnection(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 201) { return; } if (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) { return; } 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 deleteConnection * @throws ApiException if the response code was not in [200, 299] */ deleteConnection(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 === 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) { return; } 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 getAccountFacetInfo * @throws ApiException if the response code was not in [200, 299] */ getAccountFacetInfo(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), "FacetInfoResponse"); return body; } if (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), "FacetInfoResponse", ""); 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 getMapping * @throws ApiException if the response code was not in [200, 299] */ getMapping(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), "GetMappingResponse"); return body; } if (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), "GetMappingResponse", ""); 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 getUserFacetInfo * @throws ApiException if the response code was not in [200, 299] */ getUserFacetInfo(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), "FacetInfoResponse"); return body; } if (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), "FacetInfoResponse", ""); 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 listConnections * @throws ApiException if the response code was not in [200, 299] */ listConnections(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), "ListConnectionsResponse"); return body; } if (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), "ListConnectionsResponse", ""); 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 queryAccounts * @throws ApiException if the response code was not in [200, 299] */ queryAccounts(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), "QueryResponse"); return body; } if (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), "QueryResponse", ""); 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 queryEventFilteredUsers * @throws ApiException if the response code was not in [200, 299] */ queryEventFilteredUsers(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), "QueryResponse"); return body; } if (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), "QueryResponse", ""); 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 queryUsers * @throws ApiException if the response code was not in [200, 299] */ queryUsers(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), "QueryResponse"); return body; } if (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), "QueryResponse", ""); 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 updateConnection * @throws ApiException if the response code was not in [200, 299] */ updateConnection(response) { return __awaiter(this, void 0, void 0, function* () { const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (response.httpStatusCode === 200) { return; } if (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) { return; } const body = (yield response.body.text()) || ""; throw new exception_1.ApiException(response.httpStatusCode, 'Unknown API Status Code!\nBody: "' + body + '"'); }); } } exports.RumAudienceManagementApiResponseProcessor = RumAudienceManagementApiResponseProcessor; class RumAudienceManagementApi { constructor(configuration, requestFactory, responseProcessor) { this.configuration = configuration; this.requestFactory = requestFactory || new RumAudienceManagementApiRequestFactory(configuration); this.responseProcessor = responseProcessor || new RumAudienceManagementApiResponseProcessor(); } /** * Create a new data connection and its fields for an entity * @param param The request object */ createConnection(param, options) { const requestContextPromise = this.requestFactory.createConnection(param.entity, param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.createConnection(responseContext); }); }); } /** * Delete an existing data connection for an entity * @param param The request object */ deleteConnection(param, options) { const requestContextPromise = this.requestFactory.deleteConnection(param.id, param.entity, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.deleteConnection(responseContext); }); }); } /** * Get facet information for account attributes including possible values and counts * @param param The request object */ getAccountFacetInfo(param, options) { const requestContextPromise = this.requestFactory.getAccountFacetInfo(param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.getAccountFacetInfo(responseContext); }); }); } /** * Get entity mapping configuration including all available attributes and their properties * @param param The request object */ getMapping(param, options) { const requestContextPromise = this.requestFactory.getMapping(param.entity, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.getMapping(responseContext); }); }); } /** * Get facet information for user attributes including possible values and counts * @param param The request object */ getUserFacetInfo(param, options) { const requestContextPromise = this.requestFactory.getUserFacetInfo(param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.getUserFacetInfo(responseContext); }); }); } /** * List all data connections for an entity * @param param The request object */ listConnections(param, options) { const requestContextPromise = this.requestFactory.listConnections(param.entity, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.listConnections(responseContext); }); }); } /** * Query accounts with flexible filtering by account properties * @param param The request object */ queryAccounts(param, options) { const requestContextPromise = this.requestFactory.queryAccounts(param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.queryAccounts(responseContext); }); }); } /** * Query users filtered by both user properties and event platform data * @param param The request object */ queryEventFilteredUsers(param, options) { const requestContextPromise = this.requestFactory.queryEventFilteredUsers(param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.queryEventFilteredUsers(responseContext); }); }); } /** * Query users with flexible filtering by user properties, with optional wildcard search * @param param The request object */ queryUsers(param, options) { const requestContextPromise = this.requestFactory.queryUsers(param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.queryUsers(responseContext); }); }); } /** * Update an existing data connection by adding, updating, or deleting fields * @param param The request object */ updateConnection(param, options) { const requestContextPromise = this.requestFactory.updateConnection(param.entity, param.body, options); return requestContextPromise.then((requestContext) => { return this.configuration.httpApi .send(requestContext) .then((responseContext) => { return this.responseProcessor.updateConnection(responseContext); }); }); } } exports.RumAudienceManagementApi = RumAudienceManagementApi; //# sourceMappingURL=RumAudienceManagementApi.js.map