UNPKG

auth0

Version:

Auth0 Node.js SDK for the Management API v2.

536 lines (535 loc) 34.3 kB
"use strict"; // This file was auto-generated by Fern from our API Definition. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); 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.ConnectionsClient = void 0; const BaseClient_js_1 = require("../../../../BaseClient.js"); const core = __importStar(require("../../../../core/index.js")); const headers_js_1 = require("../../../../core/headers.js"); const environments = __importStar(require("../../../../environments.js")); const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatusCodeError.js"); const errors = __importStar(require("../../../../errors/index.js")); const Management = __importStar(require("../../../index.js")); const Client_js_1 = require("../resources/clients/client/Client.js"); const Client_js_2 = require("../resources/directoryProvisioning/client/Client.js"); const Client_js_3 = require("../resources/keys/client/Client.js"); const Client_js_4 = require("../resources/scimConfiguration/client/Client.js"); const Client_js_5 = require("../resources/users/client/Client.js"); class ConnectionsClient { constructor(options) { this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options); } get clients() { var _a; return ((_a = this._clients) !== null && _a !== void 0 ? _a : (this._clients = new Client_js_1.ClientsClient(this._options))); } get directoryProvisioning() { var _a; return ((_a = this._directoryProvisioning) !== null && _a !== void 0 ? _a : (this._directoryProvisioning = new Client_js_2.DirectoryProvisioningClient(this._options))); } get keys() { var _a; return ((_a = this._keys) !== null && _a !== void 0 ? _a : (this._keys = new Client_js_3.KeysClient(this._options))); } get scimConfiguration() { var _a; return ((_a = this._scimConfiguration) !== null && _a !== void 0 ? _a : (this._scimConfiguration = new Client_js_4.ScimConfigurationClient(this._options))); } get users() { var _a; return ((_a = this._users) !== null && _a !== void 0 ? _a : (this._users = new Client_js_5.UsersClient(this._options))); } /** * Retrieves detailed list of all <a href="https://auth0.com/docs/authenticate/identity-providers">connections</a> that match the specified strategy. If no strategy is provided, all connections within your tenant are retrieved. This action can accept a list of fields to include or exclude from the resulting list of connections. * * This endpoint supports two types of pagination: * <ul> * <li>Offset pagination</li> * <li>Checkpoint pagination</li> * </ul> * * Checkpoint pagination must be used if you need to retrieve more than 1000 connections. * * <h2>Checkpoint Pagination</h2> * * To search by checkpoint, use the following parameters: * <ul> * <li><code>from</code>: Optional id from which to start selection.</li> * <li><code>take</code>: The total amount of entries to retrieve when using the from parameter. Defaults to 50.</li> * </ul> * * <b>Note</b>: The first time you call this endpoint using checkpoint pagination, omit the <code>from</code> parameter. If there are more results, a <code>next</code> value is included in the response. You can use this for subsequent API calls. When <code>next</code> is no longer included in the response, no pages are remaining. * * @param {Management.ListConnectionsQueryParameters} request * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.list({ * from: "from", * take: 1, * name: "name", * fields: "fields", * include_fields: true * }) */ list() { return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) { const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; const { from: from_, take = 50, strategy, name, fields, include_fields: includeFields } = request; const _queryParams = {}; if (from_ !== undefined) { _queryParams["from"] = from_; } if (take !== undefined) { _queryParams["take"] = (_a = take === null || take === void 0 ? void 0 : take.toString()) !== null && _a !== void 0 ? _a : null; } if (strategy !== undefined) { if (Array.isArray(strategy)) { _queryParams["strategy"] = strategy.map((item) => item); } else { _queryParams["strategy"] = strategy; } } if (name !== undefined) { _queryParams["name"] = name; } if (fields !== undefined) { _queryParams["fields"] = fields; } if (includeFields !== undefined) { _queryParams["include_fields"] = (_b = includeFields === null || includeFields === void 0 ? void 0 : includeFields.toString()) !== null && _b !== void 0 ? _b : null; } const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.ManagementEnvironment.Default, "connections"), method: "GET", headers: _headers, queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams), timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000, maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: _response.body, rawResponse: _response.rawResponse, }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/connections"); })); const dataWithRawResponse = yield list(request).withRawResponse(); return new core.Page({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.next) != null && !(typeof (response === null || response === void 0 ? void 0 : response.next) === "string" && (response === null || response === void 0 ? void 0 : response.next) === ""), getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.connections) !== null && _a !== void 0 ? _a : []; }, loadPage: (response) => { return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next)); }, }); }); } /** * Creates a new connection according to the JSON object received in <code>body</code>.<br/> * * @param {Management.CreateConnectionRequestContent} request * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.ConflictError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.create({ * name: "name", * strategy: "ad" * }) */ create(request, requestOptions) { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } __create(request, requestOptions) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, "connections"), method: "POST", headers: _headers, contentType: "application/json", queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams, requestType: "json", body: request, timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000, maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: _response.body, rawResponse: _response.rawResponse, }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 409: throw new Management.ConflictError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/connections"); }); } /** * Retrieve details for a specified <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> along with options that can be used for identity provider configuration. * * @param {string} id - The id of the connection to retrieve * @param {Management.GetConnectionRequestParameters} request * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.NotFoundError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.get("id", { * fields: "fields", * include_fields: true * }) */ get(id, request = {}, requestOptions) { return core.HttpResponsePromise.fromPromise(this.__get(id, request, requestOptions)); } __get(id_1) { return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; const { fields, include_fields: includeFields } = request; const _queryParams = {}; if (fields !== undefined) { _queryParams["fields"] = fields; } if (includeFields !== undefined) { _queryParams["include_fields"] = (_a = includeFields === null || includeFields === void 0 ? void 0 : includeFields.toString()) !== null && _a !== void 0 ? _a : null; } const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_b = this._options) === null || _b === void 0 ? void 0 : _b.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({ url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ManagementEnvironment.Default, `connections/${core.url.encodePathParam(id)}`), method: "GET", headers: _headers, queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams), timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 60) * 1000, maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: _response.body, rawResponse: _response.rawResponse, }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 404: throw new Management.NotFoundError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/connections/{id}"); }); } /** * Removes a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a> from your tenant. This action cannot be undone. Once removed, users can no longer use this connection to authenticate. * * @param {string} id - The id of the connection to delete * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.delete("id") */ delete(id, requestOptions) { return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions)); } __delete(id, requestOptions) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `connections/${core.url.encodePathParam(id)}`), method: "DELETE", headers: _headers, queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams, timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000, maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/connections/{id}"); }); } /** * Update details for a specific <a href="https://auth0.com/docs/authenticate/identity-providers">connection</a>, including option properties for identity provider configuration. * * <b>Note</b>: If you use the <code>options</code> parameter, the entire <code>options</code> object is overriden. To avoid partial data or other issues, ensure all parameters are present when using this option. * * @param {string} id - The id of the connection to update * @param {Management.UpdateConnectionRequestContent} request * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.NotFoundError} * @throws {@link Management.ConflictError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.update("id") */ update(id, request = {}, requestOptions) { return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions)); } __update(id_1) { return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `connections/${core.url.encodePathParam(id)}`), method: "PATCH", headers: _headers, contentType: "application/json", queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams, requestType: "json", body: request, timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000, maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: _response.body, rawResponse: _response.rawResponse, }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 404: throw new Management.NotFoundError(_response.error.body, _response.rawResponse); case 409: throw new Management.ConflictError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/connections/{id}"); }); } /** * Retrieves the status of an ad/ldap connection referenced by its <code>ID</code>. <code>200 OK</code> http status code response is returned when the connection is online, otherwise a <code>404</code> status code is returned along with an error message * * @param {string} id - ID of the connection to check * @param {ConnectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Management.BadRequestError} * @throws {@link Management.UnauthorizedError} * @throws {@link Management.ForbiddenError} * @throws {@link Management.NotFoundError} * @throws {@link Management.TooManyRequestsError} * * @example * await client.connections.checkStatus("id") */ checkStatus(id, requestOptions) { return core.HttpResponsePromise.fromPromise(this.__checkStatus(id, requestOptions)); } __checkStatus(id, requestOptions) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; const _authRequest = yield this._options.authProvider.getAuthRequest(); let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers); const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `connections/${core.url.encodePathParam(id)}/status`), method: "GET", headers: _headers, queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams, timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000, maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries, abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal, fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch, logging: this._options.logging, }); if (_response.ok) { return { data: undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { case 400: throw new Management.BadRequestError(_response.error.body, _response.rawResponse); case 401: throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse); case 403: throw new Management.ForbiddenError(_response.error.body, _response.rawResponse); case 404: throw new Management.NotFoundError(_response.error.body, _response.rawResponse); case 429: throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse); default: throw new errors.ManagementError({ statusCode: _response.error.statusCode, body: _response.error.body, rawResponse: _response.rawResponse, }); } } return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/connections/{id}/status"); }); } } exports.ConnectionsClient = ConnectionsClient;