UNPKG

atlas-app-services-admin-api

Version:
850 lines 1.04 MB
/* tslint:disable */ /* eslint-disable */ /** * MongoDB Atlas App Services Admin API * The App Services Admin API lets you programmatically perform administrative tasks over HTTPS. This includes defining & configuring things like: - App Deployment & Security - APIs & Endpoints - Authentication & User Management - Data Sources - Device Sync - Environments - Functions - Logs - Rules - Schemas - Static Hosting - Triggers - Usage & Billing Metrics - Values & Secrets The Admin API is for application development, configuration, and deployment. To actually use the features you configure with the Admin API, client applications connect with a [Realm SDK](https://mongodb.com/docs/realm/) or over an HTTPS API specific to your App. ## Project & Application IDs **Note**: The terms _Project ID_ and _Group ID_ are interchangeable. Atlas App Services Admin API endpoints frequently require you to include two parameters in the URL: - Your Atlas _Project ID_ (also sometimes called a _Group ID_) - Your App Services _Application ID_ ### Project ID You can find your Project ID from the MongoDB Atlas dashboard or with the MongoDB Atlas CLI. ### Application ID To find an Application ID, make a request to the [List Apps](#operation/adminListApplications) endpoint for your project. You\'ll need an `access_token` to make this request. To learn how to get one, see [Get an Admin API Session Access Token](#get-an-admin-api-session-access-token). ```sh curl --request GET \\ --header \'Authorization: Bearer <access_token>\' \\ https://realm.mongodb.com/api/admin/v3.0/groups/{groupId}/apps ``` This will return a list of objects describing each App Services App in the provided project/group. For Admin API requests, your Application ID is the ObjectId value in the `_id` field, _not_ the `client_app_id`. ```json [ { \"_id\": \"5997529e46224c6e42gb6dd9\", \"group_id\": \"57879f6cc4b32dbe440bb8c5\", \"domain_id\": \"5886619e46124e4c42fb5dd8\", \"client_app_id\": \"myapp-abcde\", \"name\": \"myapp\", \"location\": \"US-VA\", \"deployment_model\": \"GLOBAL\", \"last_used\": 1615153544, \"last_modified\": 0, \"product\": \"standard\", \"environment\": \"\" } ] ``` ## Get an Admin API Session Access Token Every request to the App Services Admin API must include a valid, unexpired access token issued by the MongoDB Cloud API. You include this token in the `Authorization` header of each request using the bearer auth scheme. You need a valid [MongoDB Atlas programmatic API key](https://docs.atlas.mongodb.com/configure-api-access) for MongoDB Atlas to get a token. Once you have an API key pair, call the authentication endpoint: ```shell curl --request POST \\ --header \'Content-Type: application/json\' \\ --header \'Accept: application/json\' \\ --data \'{\"username\": \"<Public API Key>\", \"apiKey\": \"<Private API Key>\"}\' \\ https://realm.mongodb.com/api/admin/v3.0/auth/providers/mongodb-cloud/login ``` If authentication succeeds, App Services returns an access token as part of the JSON response document: ```json { \"access_token\": \"<access_token>\", \"refresh_token\": \"<refresh_token>\", \"user_id\": \"<user_id>\", \"device_id\": \"<device_id>\" } ``` The `access_token` represents a limited-time authorization to interact with the Admin API. To authenticate a request, include the token in a [Bearer token](https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication) `Authorization` header. ```http Authorization: Bearer <access_token> ``` ## Refresh an Admin API Session Access Token Session access tokens expire 30 minutes after they are issued. When you login, the response also includes a `refresh_token` that you can use to get a new access token. This is useful because you only need to log in with credentials one time. After that you can use the refresh token to re-authenticate for as long as its valid. Refresh tokens expire 60 days after being issued. To refresh your authentication and get a new `access_token`, call the auth session endpoint with your `refresh_token` in the `Authorization` header: ```shell curl --request POST \\ --header \'Authorization: Bearer <refresh_token>\' \\ https://realm.mongodb.com/api/admin/v3.0/auth/session ``` If the refresh token is valid, the response body includes a new `access_token` that\'s valid for the next 30 minutes: ```json { \"access_token\": \"<access_token>\" } ``` * * The version of the OpenAPI document: 3.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ 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()); }); }; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common'; // @ts-ignore import { BASE_PATH, BaseAPI } from './base'; export const AdminUserTypeEnum = { Normal: 'normal', Server: 'server', System: 'system', Unknown: 'unknown' }; export const AtlasClusterNameEnum = { MongodbAtlas: 'mongodb-atlas' }; export const AtlasClusterTypeEnum = { MongodbAtlas: 'mongodb-atlas' }; export const AtlasClusterConfigReadPreferenceEnum = { Primary: 'primary', PrimaryPreferred: 'primaryPreferred', Secondary: 'secondary', SecondaryPreferred: 'secondaryPreferred', Nearest: 'nearest' }; export const AtlasFederatedInstanceNameEnum = { MongodbDatafederation: 'mongodb-datafederation' }; export const AtlasFederatedInstanceTypeEnum = { Datalake: 'datalake' }; export const CustomResolverInputTypeFormatEnum = { Scalar: 'scalar', ScalarList: 'scalar-list', Generated: 'generated', GeneratedList: 'generated-list', Custom: 'custom' }; export const CustomResolverPayloadTypeFormatEnum = { Scalar: 'scalar', ScalarList: 'scalar-list', Generated: 'generated', GeneratedList: 'generated-list', Custom: 'custom' }; export const DataApiConfigValidationMethodEnum = { NoValidation: 'NO_VALIDATION', SecretAsQueryParam: 'SECRET_AS_QUERY_PARAM', VerifyPayload: 'VERIFY_PAYLOAD' }; export const DeploymentConfigAutomaticDeploymentProviderEnum = { Github: 'github' }; export const DeploymentMigrationStatusEnum = { Started: 'started', Downtime: 'downtime', EnablingEventSubscriptions: 'enabling_event_subscriptions', Cleanup: 'cleanup', Successful: 'successful', Failed: 'failed' }; export const EndpointHttpMethodEnum = { Get: 'GET', Post: 'POST', Put: 'PUT', Patch: 'PATCH', Delete: 'DELETE', Star: '*' }; export const EndpointValidationMethodEnum = { NoValidation: 'NO_VALIDATION', SecretAsQueryParam: 'SECRET_AS_QUERY_PARAM', VerifyPayload: 'VERIFY_PAYLOAD' }; export const HostingConfigurationStatusEnum = { SetupOk: 'setup_ok', ChangeInProgress: 'change_in_progress', ChangeFailed: 'change_failed', ChangeFailedFatal: 'change_failed_fatal' }; export const LogForwardingActionTypeEnum = { Collection: 'collection', Function: 'function' }; export const LogForwardingPolicyTypeEnum = { Single: 'single', Batch: 'batch' }; export const SyncDataResponseReadPreferenceEnum = { Primary: 'primary', PrimaryPreferred: 'primaryPreferred', Secondary: 'secondary', SecondaryPreferred: 'secondaryPreferred', Nearest: 'nearest' }; export const ThirdPartyServiceTypeEnum = { Aws: 'aws', Twilio: 'twilio', Github: 'github', Gcm: 'gcm' }; export const UserTypeEnum = { Normal: 'normal', Server: 'server' }; /** * AdminApi - axios parameter creator * @export */ export const AdminApiAxiosParamCreator = function (configuration) { return { /** * * @summary Obtain a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateSession: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/auth/session`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication refreshAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Delete a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteSession: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/auth/session`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Authenticate as an App Services administrator using an Atlas programmatic API key pair. To learn more, see [Get An Admin API Session Access Token](#get-an-admin-api-session-access-token). * @summary Authenticate as an App Services administrator * @param {ProviderType} provider The authentication provider to use. * @param {AdminLoginRequest} adminLoginRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminLogin: (provider, adminLoginRequest, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'provider' is not null or undefined assertParamExists('adminLogin', 'provider', provider); // verify required parameter 'adminLoginRequest' is not null or undefined assertParamExists('adminLogin', 'adminLoginRequest', adminLoginRequest); const localVarPath = `/auth/providers/{provider}/login` .replace(`{${"provider"}}`, encodeURIComponent(String(provider))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = serializeDataIfNeeded(adminLoginRequest, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary List App Services Admin Auth Providers * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminAuthProviders: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/auth/providers`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * * @summary Get information about the currently logged in user * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminProfile: (options = {}) => __awaiter(this, void 0, void 0, function* () { const localVarPath = `/auth/profile`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * AdminApi - functional programming interface * @export */ export const AdminApiFp = function (configuration) { const localVarAxiosParamCreator = AdminApiAxiosParamCreator(configuration); return { /** * * @summary Obtain a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateSession(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminCreateSession(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * * @summary Delete a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteSession(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminDeleteSession(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * Authenticate as an App Services administrator using an Atlas programmatic API key pair. To learn more, see [Get An Admin API Session Access Token](#get-an-admin-api-session-access-token). * @summary Authenticate as an App Services administrator * @param {ProviderType} provider The authentication provider to use. * @param {AdminLoginRequest} adminLoginRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminLogin(provider, adminLoginRequest, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminLogin(provider, adminLoginRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * * @summary List App Services Admin Auth Providers * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminAuthProviders(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.getAdminAuthProviders(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * * @summary Get information about the currently logged in user * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminProfile(options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.getAdminProfile(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, }; }; /** * AdminApi - factory interface * @export */ export const AdminApiFactory = function (configuration, basePath, axios) { const localVarFp = AdminApiFp(configuration); return { /** * * @summary Obtain a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateSession(options) { return localVarFp.adminCreateSession(options).then((request) => request(axios, basePath)); }, /** * * @summary Delete a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteSession(options) { return localVarFp.adminDeleteSession(options).then((request) => request(axios, basePath)); }, /** * Authenticate as an App Services administrator using an Atlas programmatic API key pair. To learn more, see [Get An Admin API Session Access Token](#get-an-admin-api-session-access-token). * @summary Authenticate as an App Services administrator * @param {ProviderType} provider The authentication provider to use. * @param {AdminLoginRequest} adminLoginRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminLogin(provider, adminLoginRequest, options) { return localVarFp.adminLogin(provider, adminLoginRequest, options).then((request) => request(axios, basePath)); }, /** * * @summary List App Services Admin Auth Providers * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminAuthProviders(options) { return localVarFp.getAdminAuthProviders(options).then((request) => request(axios, basePath)); }, /** * * @summary Get information about the currently logged in user * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAdminProfile(options) { return localVarFp.getAdminProfile(options).then((request) => request(axios, basePath)); }, }; }; /** * AdminApi - object-oriented interface * @export * @class AdminApi * @extends {BaseAPI} */ export class AdminApi extends BaseAPI { /** * * @summary Obtain a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdminApi */ adminCreateSession(options) { return AdminApiFp(this.configuration).adminCreateSession(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Delete a session access token * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdminApi */ adminDeleteSession(options) { return AdminApiFp(this.configuration).adminDeleteSession(options).then((request) => request(this.axios, this.basePath)); } /** * Authenticate as an App Services administrator using an Atlas programmatic API key pair. To learn more, see [Get An Admin API Session Access Token](#get-an-admin-api-session-access-token). * @summary Authenticate as an App Services administrator * @param {ProviderType} provider The authentication provider to use. * @param {AdminLoginRequest} adminLoginRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdminApi */ adminLogin(provider, adminLoginRequest, options) { return AdminApiFp(this.configuration).adminLogin(provider, adminLoginRequest, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List App Services Admin Auth Providers * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdminApi */ getAdminAuthProviders(options) { return AdminApiFp(this.configuration).getAdminAuthProviders(options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Get information about the currently logged in user * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdminApi */ getAdminProfile(options) { return AdminApiFp(this.configuration).getAdminProfile(options).then((request) => request(this.axios, this.basePath)); } } /** * ApikeysApi - axios parameter creator * @export */ export const ApikeysApiAxiosParamCreator = function (configuration) { return { /** * Create a new [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Create a new API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {AdminCreateApiKeyRequest} adminCreateApiKeyRequest The API key to create. * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateApiKey: (groupId, appId, adminCreateApiKeyRequest, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminCreateApiKey', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminCreateApiKey', 'appId', appId); // verify required parameter 'adminCreateApiKeyRequest' is not null or undefined assertParamExists('adminCreateApiKey', 'adminCreateApiKeyRequest', adminCreateApiKeyRequest); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = serializeDataIfNeeded(adminCreateApiKeyRequest, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Delete an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Delete an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteApiKey: (groupId, appId, apiKeyId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminDeleteApiKey', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminDeleteApiKey', 'appId', appId); // verify required parameter 'apiKeyId' is not null or undefined assertParamExists('adminDeleteApiKey', 'apiKeyId', apiKeyId); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys/{apiKeyId}` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))) .replace(`{${"apiKeyId"}}`, encodeURIComponent(String(apiKeyId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Disable an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Disable an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDisableApiKey: (groupId, appId, apiKeyId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminDisableApiKey', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminDisableApiKey', 'appId', appId); // verify required parameter 'apiKeyId' is not null or undefined assertParamExists('adminDisableApiKey', 'apiKeyId', apiKeyId); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys/{apiKeyId}/disable` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))) .replace(`{${"apiKeyId"}}`, encodeURIComponent(String(apiKeyId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Enable an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Enable an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminEnableApiKey: (groupId, appId, apiKeyId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminEnableApiKey', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminEnableApiKey', 'appId', appId); // verify required parameter 'apiKeyId' is not null or undefined assertParamExists('adminEnableApiKey', 'apiKeyId', apiKeyId); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys/{apiKeyId}/enable` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))) .replace(`{${"apiKeyId"}}`, encodeURIComponent(String(apiKeyId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Retrieve information about an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Retrieve information about an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminGetApiKey: (groupId, appId, apiKeyId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminGetApiKey', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminGetApiKey', 'appId', appId); // verify required parameter 'apiKeyId' is not null or undefined assertParamExists('adminGetApiKey', 'apiKeyId', apiKeyId); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys/{apiKeyId}` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))) .replace(`{${"apiKeyId"}}`, encodeURIComponent(String(apiKeyId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * List [API keys](https://www.mongodb.com/docs/realm/authentication/api-key/) associated with a Atlas App Services App. * @summary List API keys * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminListApiKeys: (groupId, appId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'groupId' is not null or undefined assertParamExists('adminListApiKeys', 'groupId', groupId); // verify required parameter 'appId' is not null or undefined assertParamExists('adminListApiKeys', 'appId', appId); const localVarPath = `/groups/{groupId}/apps/{appId}/api_keys` .replace(`{${"groupId"}}`, encodeURIComponent(String(groupId))) .replace(`{${"appId"}}`, encodeURIComponent(String(appId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication tokenAuth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * ApikeysApi - functional programming interface * @export */ export const ApikeysApiFp = function (configuration) { const localVarAxiosParamCreator = ApikeysApiAxiosParamCreator(configuration); return { /** * Create a new [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Create a new API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {AdminCreateApiKeyRequest} adminCreateApiKeyRequest The API key to create. * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateApiKey(groupId, appId, adminCreateApiKeyRequest, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminCreateApiKey(groupId, appId, adminCreateApiKeyRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * Delete an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Delete an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteApiKey(groupId, appId, apiKeyId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminDeleteApiKey(groupId, appId, apiKeyId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * Disable an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Disable an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDisableApiKey(groupId, appId, apiKeyId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminDisableApiKey(groupId, appId, apiKeyId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * Enable an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Enable an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminEnableApiKey(groupId, appId, apiKeyId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminEnableApiKey(groupId, appId, apiKeyId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * Retrieve information about an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Retrieve information about an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminGetApiKey(groupId, appId, apiKeyId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminGetApiKey(groupId, appId, apiKeyId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, /** * List [API keys](https://www.mongodb.com/docs/realm/authentication/api-key/) associated with a Atlas App Services App. * @summary List API keys * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminListApiKeys(groupId, appId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield localVarAxiosParamCreator.adminListApiKeys(groupId, appId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }); }, }; }; /** * ApikeysApi - factory interface * @export */ export const ApikeysApiFactory = function (configuration, basePath, axios) { const localVarFp = ApikeysApiFp(configuration); return { /** * Create a new [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Create a new API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {AdminCreateApiKeyRequest} adminCreateApiKeyRequest The API key to create. * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminCreateApiKey(groupId, appId, adminCreateApiKeyRequest, options) { return localVarFp.adminCreateApiKey(groupId, appId, adminCreateApiKeyRequest, options).then((request) => request(axios, basePath)); }, /** * Delete an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Delete an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDeleteApiKey(groupId, appId, apiKeyId, options) { return localVarFp.adminDeleteApiKey(groupId, appId, apiKeyId, options).then((request) => request(axios, basePath)); }, /** * Disable an [API key](https://www.mongodb.com/docs/realm/authentication/api-key/). * @summary Disable an API key * @param {any} groupId An Atlas [Project/Group ID](https://docs.atlas.mongodb.com/tutorial/manage-projects/). * @param {any} appId The ObjectID of your application. [The App Services API Project and Application IDs section](#section/Project-and-Application-IDs) demonstrates how to find this value. * @param {any} apiKeyId The unique &#x60;_id&#x60; value of an API key * @param {*} [options] Override http request option. * @throws {RequiredError} */ adminDisableApiKey(groupId, appId, apiKeyId, options) { return localVarFp.adminDisableApi